/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }

  .auth-card {
    max-width: 450px;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }

  .sidebar {
    width: var(--sidebar-width);
  }

  .main-content {
    margin-left: var(--sidebar-width);
  }

  .dashboard-widgets {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-recent {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }

  .dashboard-widgets {
    grid-template-columns: repeat(4, 1fr);
  }

  .dashboard-charts {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-recent {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Mobile-first responsive styles */
/* Small devices (landscape phones, 576px and up) */
@media (max-width: 576px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }

  .dashboard-recent {
    grid-template-columns: 1fr;
  }

  .users-table-container {
    overflow-x: scroll;
  }

  .users-table {
    min-width: 600px;
  }

  .coming-soon-actions {
    flex-direction: column;
  }

  .coming-soon-actions .btn {
    width: 100%;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .dashboard-widgets {
    grid-template-columns: 1fr;
  }

  .users-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .permissions-list {
    grid-template-columns: 1fr;
  }

  .data-filters form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
  }

  .data-management-header,
  .add-data-header,
  .edit-data-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .chart-controls {
    width: 100%;
    flex-direction: column;
  }

  .chart-controls select,
  .chart-controls button {
    width: 100%;
  }
}

/* Sidebar toggle for mobile */
.menu-toggle {
  background-color: var(--primary-color);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: var(--box-shadow);
  display: none;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  .hide-sm{
    display: none;
  }

  .sidebar {
    z-index: 999;
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Adjust padding for smaller screens */
  .content-body {
    padding: 15px;
  }

  .card-body {
    padding: 1.5rem;
  }

  .page-header {
    padding: 1.5rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .profile-card .card-body {
    padding: 1.5rem;
  }

  .profile-avatar img {
    width: 100px;
    height: 100px;
  }

  .nav-tabs .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }

  .form-control {
    padding: 0.75rem;
  }

  .header {
    padding: 0;
  }
}

/* Dark mode adjustments for mobile */
@media (max-width: 768px) {
  [data-theme="dark"] .sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.7);
  }

  [data-theme="dark"] .menu-toggle {
    background-color: var(--secondary-color);
  }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --hover-bg: #e0e0e0;
  }

  [data-theme="dark"] {
    --border-color: #fff;
    --hover-bg: #404040;
  }

  .btn {
    border: 1px solid currentColor;
  }

  .form-control {
    border-width: 2px;
  }
}

/* Reduced motion adjustments */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
