/* 
 * EasyContact Digital CRM - Responsive Design System
 * This file contains responsive design rules to ensure optimal viewing on different screen sizes
 */

/* Base container styles for all pages */
.container-fluid {
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Content wrapper for proper centering */
.content-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Card sizing and positioning */
.card {
  height: auto;
  width: 100%;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

/* Table responsiveness */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Form controls */
.form-control, .form-select {
  max-width: 100%;
}

/* Button sizing */
.btn {
  white-space: nowrap;
}

/* Dashboard grid system */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
}

/* Utility classes */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive typography */
html {
  font-size: 16px;
}

/* Responsive breakpoints */

/* Extra large screens (1440px and up) */
@media (min-width: 1440px) {
  .container-fluid {
    padding: 0 30px;
  }
  
  html {
    font-size: 18px;
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  }
}

/* Large screens (1200px to 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
  .container-fluid {
    padding: 0 25px;
  }
  
  html {
    font-size: 17px;
  }
}

/* Medium screens (992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  .container-fluid {
    padding: 0 20px;
  }
  
  html {
    font-size: 16px;
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Small screens (768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .container-fluid {
    padding: 0 15px;
  }
  
  html {
    font-size: 15px;
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* Charts and graphs responsiveness */
.chart-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.chart-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Modal responsiveness */
.modal-dialog {
  max-width: 95%;
  margin: 1.75rem auto;
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
  }
}

@media (min-width: 992px) {
  .modal-dialog.modal-lg {
    max-width: 800px;
  }
}

@media (min-width: 1200px) {
  .modal-dialog.modal-xl {
    max-width: 1140px;
  }
}

/* Navigation and sidebar responsiveness */
.sidebar {
  width: 100%;
  max-height: none;
  overflow-y: auto;
}

@media (min-width: 992px) {
  .sidebar {
    width: 250px;
    height: 100vh;
    position: sticky;
    top: 0;
  }
  
  .main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
  }
}

/* Form layouts */
.form-row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -10px;
  margin-left: -10px;
}

.form-col {
  flex: 1 0 100%;
  padding: 0 10px;
}

@media (min-width: 768px) {
  .form-col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  .form-col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
  
  .form-col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .container-fluid {
    width: 100%;
    padding: 0;
    margin: 0;
  }
  
  body {
    background-color: #fff;
  }
  
  .card {
    break-inside: avoid;
  }
}

/* Utility classes for spacing */
.vh-100 {
  height: 100vh;
}

.min-vh-100 {
  min-height: 100vh;
}

/* Ensure content is always centered vertically */
.vertical-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

/* Ensure proper scaling for images */
img {
  max-width: 100%;
  height: auto;
}

/* Fix for fixed position elements */
.fixed-top, .fixed-bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1030;
}

.fixed-top {
  top: 0;
}

.fixed-bottom {
  bottom: 0;
}

/* Ensure proper padding when using fixed headers/footers */
body.has-fixed-header {
  padding-top: 60px;
}

body.has-fixed-footer {
  padding-bottom: 60px;
}
