/* ============================================================
   Mobile-responsive overrides
   Loaded AFTER style.css so !important selectors take effect.
   ============================================================ */

/* ---------- Hamburger button (hidden on desktop, shown on mobile) ---------- */
.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 26px;
  padding: 8px 12px;
  cursor: pointer;
  color: inherit;
  line-height: 1;
}

/* Sidebar backdrop when open on mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 998;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { display: block; }

/* ============================================================
   ≤ 768px — Tablet + phone
   ============================================================ */
@media (max-width: 768px) {

  /* Hamburger always visible */
  .hamburger-btn { display: inline-block !important; }

  /* Sidebar → drawer */
  .sidebar,
  aside.sidebar,
  nav.sidebar,
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -280px !important;
    height: 100vh !important;
    width: 260px !important;
    z-index: 999 !important;
    transition: left 0.28s ease !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5) !important;
    overflow-y: auto !important;
  }
  .sidebar.mobile-open,
  aside.sidebar.mobile-open,
  nav.sidebar.mobile-open,
  #sidebar.mobile-open {
    left: 0 !important;
  }

  /* Content: no sidebar margin */
  .main, .content, main, .app-content, .page-content {
    margin-left: 0 !important;
    padding: 12px !important;
  }

  /* Cards: less padding */
  .card, .card.section {
    padding: 14px !important;
    margin-bottom: 12px !important;
  }
  .card-title { font-size: 15px !important; }

  /* Grids collapse to 1 column */
  .grid-2, .grid-3, .grid-4, .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Modals: full-screen */
  .modal, .modal-content {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 100vh !important;
    height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
    position: fixed !important;
    inset: 0 !important;
  }
  .modal-header {
    position: sticky !important;
    top: 0 !important;
    background: var(--bg-elev, #0f172a) !important;   /* solid — no text bleeding through */
    z-index: 10 !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--border, #334155) !important;
  }
  .modal-header h3 { font-size: 16px !important; margin: 0 !important; }

  /* Tables: horizontal scroll + hint scrollbar */
  .table-wrap, .table-scroll {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
  }
  table {
    min-width: 500px;
    font-size: 13px !important;
  }
  th, td { padding: 8px 6px !important; }

  /* Buttons: touch-friendly (min 44px) */
  .btn { min-height: 44px !important; padding: 10px 14px !important; font-size: 14px !important; }
  .btn-sm { min-height: 36px !important; padding: 6px 10px !important; font-size: 13px !important; }

  /* Form fields */
  .input, .select, .textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    padding: 10px !important;
    min-height: 44px !important;
  }
  .textarea { min-height: 80px !important; }
  .label { font-size: 13px !important; }

  /* Topbar: shrink + wrap */
  .topbar {
    padding: 8px 12px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }
  .topbar h1, .topbar .brand { font-size: 15px !important; }
  .user-chip, #userChip {
    padding: 4px 8px !important;
    font-size: 13px !important;
  }

  /* Page title */
  .page-title, h1.page-title { font-size: 20px !important; }
  .page-subtitle, #pgSub { font-size: 13px !important; }

  /* Filters row: stack */
  .filter-bar, .filters, #filterBar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .filter-bar > *, .filters > * {
    width: 100% !important;
  }

  /* Flex utilities: allow wrap */
  .flex-between {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Calendar month view: tighter cells */
  .mcal-cell {
    min-height: 55px !important;
    padding: 3px !important;
    font-size: 11px !important;
  }
  .mcal-daynum { font-size: 12px !important; }
  .mcal-pill {
    font-size: 10px !important;
    padding: 2px 4px !important;
    margin-bottom: 2px !important;
  }
  .mcal-tech-name { display: none !important; }  /* Hide tech names on mobile */
  .mcal-header {
    font-size: 11px !important;
    padding: 6px 2px !important;
  }

  /* Hide desktop-only elements */
  .hide-mobile, .desktop-only { display: none !important; }
  .show-mobile, .mobile-only { display: block !important; }

  /* Profile dropdown: keep opaque, position adjusts naturally */
  .profile-dropdown {
    max-width: calc(100vw - 20px) !important;
    right: 10px !important;
    left: auto !important;
  }
}

/* ============================================================
   ≤ 480px — Phone-specific tightening
   ============================================================ */
@media (max-width: 480px) {

  /* Even tighter cards */
  .card { padding: 10px !important; }

  /* Calendar: handled by the responsive month view in calendar.html
     (dot indicators + agenda). Do NOT hide pills globally here — the
     old rule made events invisible on phones. */

  /* Modal header + title tighter */
  .modal-header { padding: 10px 12px !important; }
  .modal-header h3 { font-size: 15px !important; }

  /* Buttons in modals: full width on tiny screens */
  .modal .flex.gap-2 > .btn { flex: 1 !important; }

  /* Fonts */
  body { font-size: 14px !important; }
  h1 { font-size: 18px !important; }
  h2 { font-size: 16px !important; }
  h3 { font-size: 15px !important; }
}

/* ============================================================
   Force 24-hour time inputs across browsers.
   Hides the AM/PM selector on Chrome/Safari that ignores locale settings.
   ============================================================ */
input[type="time"]::-webkit-datetime-edit-ampm-field { display: none; }
input[type="time"]::-webkit-datetime-edit-meridiem-field { display: none; }
