/* ============================================================
   WorkerHub.OS — Responsive Styles
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   DESKTOP ONLY (> 992px)
══════════════════════════════════════════════════════════ */
@media (min-width: 993px) {
  .mobile-topbar  { display: none !important; }
  .mobile-nav     { display: none !important; }
  .hide-desktop   { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   TABLET + MOBILE (≤ 992px)
══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  /* Prevent horizontal viewport overflow */
  html, body {
    max-width: 100vw;
    overflow-x: hidden !important;
  }

  /* Constrain cards and chart wraps from stretching screen width */
  .card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .chart-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  .chart-wrap canvas {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Show mobile top bar */
  .mobile-topbar { display: flex; }

  /* Show mobile bottom nav */
  .mobile-nav { display: flex; }

  /* Sidebar Drawer on Mobile */
  .sidebar {
    display: flex !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 400; /* above mobile elements (300) */
    box-shadow: 0 0 24px rgba(0,0,0,0.5);
    height: 100vh;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* Sidebar Backdrop */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 350; /* below sidebar, above mobile-nav */
  }
  .sidebar-backdrop.active {
    display: block;
  }

  /* Main area: remove sidebar offset, add top/bottom padding */
  .main {
    margin-left: 0;
    max-width: 100vw;
    overflow-x: hidden !important;
  }
  .main-inner {
    padding: 0 16px 80px;
    padding-top: 72px; /* below mobile header */
  }

  /* Topbar — hide on mobile, replaced by mobile-topbar */
  .topbar { display: none; }

  /* Page toolbar wraps */
  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-left {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrap {
    max-width: 100%;
  }
  .filter-select { width: 100%; }
  .toolbar-right { justify-content: flex-end; }

  /* KPI grid: 2 columns on tablet, 1 on tiny */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Content grid: stack */
  .content-grid,
  .content-grid.cols-3 {
    grid-template-columns: 1fr;
  }
  .col-span-2 { grid-column: span 1; }

  /* Tables: horizontal scroll */
  .table-wrap { overflow-x: auto; }
  .table { min-width: 640px; }

  /* Form grid */
  .form-grid-2 { grid-template-columns: 1fr; }

  /* Form actions stack */
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  /* Sidebar-style page (settings, profile) */
  .settings-layout { flex-direction: column; }

  /* Tabs horizontal scroll on mobile */
  .tabs {
    overflow-x: auto;
    white-space: nowrap;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide default scrollbar in Firefox */
  }
  .tabs::-webkit-scrollbar {
    display: none; /* Hide scrollbar in Chrome/Safari/Webkit */
  }
  .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Hide non-critical desktop elements */
  .hide-mobile { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   SMALL MOBILE (≤ 576px)
══════════════════════════════════════════════════════════ */
@media (max-width: 576px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi-value { font-size: 1.25rem; }

  /* Tighten padding */
  .main-inner { padding-left: 12px; padding-right: 12px; }

  /* Mobile card list for tables */
  .mobile-card { display: block !important; }
  .desktop-only-table { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   LANDING PAGE HERO (auth layout)
══════════════════════════════════════════════════════════ */
.auth-layout {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════════════════
   MOBILE CARD VIEW (replaces table on small screens)
══════════════════════════════════════════════════════════ */
.mobile-card {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.m-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.m-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.m-card-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--txt-primary);
}
.m-card-sub {
  font-size: .75rem;
  color: var(--txt-muted);
  margin-top: 2px;
}
.m-card-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 14px;
  font-size: .8rem;
}
.m-card-field-label {
  font-size: .7rem;
  color: var(--txt-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.m-card-field-value {
  color: var(--txt-secondary);
  font-weight: 500;
}
.m-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 576px) {
  .mobile-card { display: flex; }
  .desktop-only-table { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   VERY SMALL MOBILE (≤ 480px)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

