/* ===== RESPONSIVE OVERRIDES ===== */

/* ---- DASHBOARD LAYOUT ---- */
#sidebarToggle { display: none; }

@media (max-width: 767px) {
  .dashboard-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 256px;
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    z-index: 40;
    background: var(--bg-card, #0D121C);
    border-right: 1px solid var(--border-color, #1E293B);
    overflow-y: auto;
  }
  .dashboard-sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(0,0,0,0.5);
    z-index: 35;
  }
  .sidebar-overlay.open { display: block; }

  .dashboard-main {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 1.5rem !important;
  }

  #sidebarToggle { display: flex; }
  .dashboard-navbar { padding-left: 1rem; padding-right: 1rem; }
  .dashboard-navbar h1 { font-size: 1rem; }
  #nav-username { display: none; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .dashboard-sidebar { width: 200px; }
  .dashboard-main {
    margin-left: 200px !important;
    width: calc(100vw - 200px) !important;
    padding: 1.5rem 2rem !important;
  }
}

/* ---- DASHBOARD VIEWS ---- */
@media (max-width: 639px) {
  .grid.grid-cols-1.md\:grid-cols-5 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid.grid-cols-1.md\:grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 767px) {
  .grid.grid-cols-4.grid-rows-1 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid.grid-cols-2 { grid-template-columns: 1fr !important; }
  .grid.grid-cols-3 { grid-template-columns: 1fr !important; }
  .grid.grid-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .overflow-x-auto table { font-size: 0.75rem; }
  .overflow-x-auto table th,
  .overflow-x-auto table td { padding: 0.5rem 0.25rem; white-space: nowrap; }
  .overflow-y-auto { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 479px) {
  .grid.grid-cols-4.grid-rows-1 { grid-template-columns: 1fr !important; }
  .grid.grid-cols-4 { grid-template-columns: 1fr !important; }
}

/* ---- LOGIN ---- */
@media (max-width: 639px) {
  .login-form-row { flex-direction: column; gap: 0.25rem; }
  .login-form-row label { width: 100% !important; }
  .login-form-row input, .login-form-row select { width: 100%; }
  .login-container { padding: 1.5rem !important; margin: 1rem; }
}

/* ---- STATIC PAGES ---- */
@media (max-width: 767px) {
  #contentBox, #policyBox {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
  }
}

/* ---- ACTION BUTTONS ---- */
@media (max-width: 639px) {
  .sticky.bottom-0 .flex.justify-end { flex-wrap: wrap; gap: 0.5rem; }
  .sticky.bottom-0 button { flex: 1 1 auto; min-width: 80px; font-size: 0.8rem; padding: 0.5rem 0.75rem; }
  #modalContent { padding: 1.5rem !important; margin: 0.5rem; }
  #addAccMenu { width: 200px !important; }
  #addAccMenu button { width: 100% !important; }
}

/* ---- CONNECTED ACCOUNTS ---- */
@media (max-width: 639px) {
  .border.border-gray-700.rounded-lg.p-4 .flex.items-center.justify-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .h-\[600px\], .min-h-\[600px\] { height: auto !important; min-height: 300px !important; }
  .h-\[500px\], .min-h-\[500px\] { height: auto !important; min-height: 250px !important; }
}

/* ---- DESIGN POLISH ---- */
button, a, input, select, textarea { transition: all 0.2s ease; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-blue, #3B82F6) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dashboard-sidebar button.active {
  background: var(--bg-surface, #141A27);
  border-left: 3px solid var(--accent-blue, #3B82F6);
}
.dashboard-sidebar button:hover {
  background: var(--bg-surface, #141A27);
  transform: translateX(2px);
}

.overflow-y-auto::-webkit-scrollbar { width: 6px; }
.overflow-y-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-y-auto::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.overflow-y-auto::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ---- PRINT ---- */
@media print {
  nav, .dashboard-sidebar, #sidebarToggle, .sidebar-overlay { display: none !important; }
  .dashboard-main { margin-left: 0 !important; width: 100% !important; }
}
