/* ============================================================
   RESPONSIVE.CSS — Tablet-First Responsive Design System
   FilmSuite AI Production Manager
   ============================================================
   Breakpoints:
     Mobile:  < 768px
     Tablet:  768px – 1024px  ← PRIMARY baseline
     Desktop: > 1024px
   ============================================================ */

/* ── MOBILE BOTTOM NAV ──────────────────────────────────────── */
#mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  z-index: 200;
  padding: 0;
  height: 60px;
}
#mobile-bottom-nav nav {
  display: flex;
  height: 100%;
}
.mob-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
  border: none;
  background: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mob-nav-item .mob-nav-icon {
  font-size: 20px;
  line-height: 1;
}
.mob-nav-item.active {
  color: var(--gold);
}
.mob-nav-item:hover {
  color: var(--text-primary);
}

/* ── MOBILE MENU OVERLAY ────────────────────────────────────── */
#mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}
#mobile-menu-overlay.open {
  opacity: 1;
}
#mobile-nav-drawer {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--dur-base) var(--ease);
}
#mobile-nav-drawer.open {
  transform: translateX(0);
}
.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.mobile-drawer-close {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  background: none; border: none;
}
.mobile-drawer-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.mobile-drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-drawer-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── HAMBURGER BUTTON in TOPBAR ─────────────────────────────── */
#btn-menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 22px;
  transition: all var(--dur-fast) var(--ease);
  background: none; border: none;
  flex-shrink: 0;
}
#btn-menu-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   TABLET (768px – 1024px) — PRIMARY
   ════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) {
  :root {
    --sidebar-w: 200px;
  }

  /* Sidebar - slim but visible */
  #sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
  }
  .sidebar-logo .logo-text span {
    display: none; /* hide tagline, keep brand */
  }
  .sidebar-logo {
    padding: 14px 14px 12px;
  }
  .sidebar-nav {
    padding: 8px 8px;
  }
  .nav-item {
    padding: 9px 10px;
    font-size: 13px;
  }
  .nav-section-label {
    font-size: 9px;
    padding: 10px 8px 4px;
  }

  /* Topbar */
  #topbar {
    padding: 0 16px;
    gap: 10px;
  }
  .project-title-input {
    width: 160px;
    font-size: 13px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .topbar-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Content padding */
  .page-content {
    padding: 20px 24px;
  }

  /* Page header */
  .page-title {
    font-size: 22px;
  }
  .page-header-row {
    gap: 14px;
  }

  /* Stats row - 2 col on tablet */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Provider grid - 2 col */
  #provider-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Provider Quick Reference - 2 col */
  .card mb-4 > div[style*="minmax(280px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

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

  /* Pipeline bar - comfortable */
  .pipeline-step-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* ════════════════════════════════════════════════════════════
   MOBILE (< 768px) — SECONDARY
   ════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  :root {
    --header-h: 54px;
  }

  /* ── HIDE DESKTOP SIDEBAR ── */
  #sidebar {
    display: none !important;
  }

  /* ── SHOW MOBILE ELEMENTS ── */
  #mobile-bottom-nav {
    display: block;
  }
  #btn-menu-toggle {
    display: inline-flex;
  }

  /* ── MAIN WRAP — full width ── */
  #main-wrap {
    width: 100%;
  }

  /* ── TOPBAR ── */
  #topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .project-title-input {
    width: auto;
    min-width: 0;
    flex: 1;
    font-size: 13px;
  }
  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }
  /* Hide less-critical topbar buttons on mobile */
  .topbar-actions .btn-ghost {
    display: none;
  }
  .topbar-actions .btn {
    padding: 6px 10px;
    font-size: 11px;
    gap: 4px;
  }

  /* ── PIPELINE BAR ── */
  .pipeline-bar {
    padding: 0 8px;
    gap: 0;
  }
  .pipeline-step-btn {
    padding: 8px 8px;
    font-size: 10px;
    gap: 4px;
  }
  .pipeline-step-btn .pipeline-step-label {
    display: none; /* show icon/number only on mobile */
  }
  .pipeline-step-num {
    width: 20px; height: 20px;
    font-size: 10px;
  }

  /* ── PAGE CONTENT ── */
  .page-content {
    padding: 16px;
    /* leave room for bottom nav */
    padding-bottom: 76px;
  }

  /* ── PAGE HEADER ── */
  .page-header {
    margin-bottom: 16px;
  }
  .page-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-title {
    font-size: 20px;
  }
  .page-subtitle {
    font-size: 12px;
  }
  .page-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
  }
  .page-actions .btn {
    justify-content: center;
    min-height: 44px;
    font-size: 12px;
  }

  /* ── CARDS ── */
  .card {
    padding: 16px;
    border-radius: var(--radius-md);
  }
  .card-header {
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── STATS ROW — 2 col mobile ── */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-value {
    font-size: 22px;
  }
  .stat-label {
    font-size: 10px;
  }

  /* ── BUTTONS — touch friendly ── */
  .btn {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12.5px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 11.5px;
  }
  .btn-lg {
    min-height: 48px;
    padding: 12px 20px;
    font-size: 14px;
  }
  .btn-icon {
    min-height: 40px;
    min-width: 40px;
  }

  /* ── FORM ROWS — single column ── */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .form-group {
    gap: 6px;
  }
  input[type="text"], input[type="date"],
  input[type="number"], input[type="time"],
  textarea, select {
    font-size: 16px; /* prevent iOS zoom */
    padding: 10px 12px;
    min-height: 44px;
  }
  textarea {
    min-height: 100px;
  }

  /* ── PROVIDER GRID — 1 col on mobile ── */
  #provider-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── PROVIDER QUICK REFERENCE — 1 col ── */
  .provider-ref-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── TABLES — horizontal scroll container ── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }
  table {
    min-width: 480px;
  }
  thead th, tbody td {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* ── MODALS — full screen on mobile ── */
  .modal-overlay {
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px 20px 32px;
  }

  /* ── TOAST — full width ── */
  #toast-container {
    bottom: 70px; /* above bottom nav */
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
    min-width: 0;
  }

  /* ── SCENE CARD ── */
  .scene-card-header {
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .scene-heading-text {
    font-size: 11px;
    flex-basis: 100%;
    order: 3;
  }
  .scene-meta-chips {
    display: none; /* collapse on very small screens */
  }
  .scene-card-body {
    padding: 14px;
  }

  /* ── BREAKDOWN ── */
  .breakdown-scene-header {
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }

  /* ── SCHEDULE ── */
  .schedule-day-header {
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  .schedule-scenes {
    gap: 6px;
    padding: 10px 12px;
  }

  /* ── ONSET DASHBOARD ── */
  .onset-grid {
    height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .now-shooting-shot {
    font-size: 22px;
  }
  .now-shooting-card {
    padding: 18px;
  }
  .dashboard-action-row {
    flex-wrap: wrap;
  }
  .dashboard-action-row .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }

  /* ── SETTINGS PAGE ── */
  #ai-status-banner .flex {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  #ai-status-badge {
    margin-left: 0 !important;
  }
  #config-form-card .form-row {
    grid-template-columns: 1fr;
  }

  /* ── CALLSHEET ── */
  .callsheet-header {
    padding: 16px 18px;
  }
  .callsheet-title {
    font-size: 18px;
  }
  .callsheet-meta-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 14px 18px;
  }
  .callsheet-section {
    padding: 14px 18px;
  }

  /* ── UPLOAD ZONE ── */
  .upload-zone {
    padding: 32px 20px;
  }
  .upload-icon {
    font-size: 36px;
  }
  .upload-title {
    font-size: 16px;
  }

  /* ── TABS ── */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* ── HIDE horizontal overflow globally ── */
  body {
    overflow-x: hidden;
  }
  #app {
    overflow-x: hidden;
  }
  #main-wrap {
    overflow-x: hidden;
  }
}

/* ════════════════════════════════════════════════════════════
   DESKTOP (> 1024px) — TERTIARY
   ════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {
  :root {
    --sidebar-w: 260px;
  }

  /* Provider grid - 4 col max on wide screens */
  #provider-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* Stats - more columns */
  .stats-row {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  /* Page content - more breathing room */
  .page-content {
    padding: 32px 40px;
  }
  .page-title {
    font-size: 28px;
  }

  /* Active sidebar items */
  .nav-item:hover {
    transform: translateX(2px);
  }
}

/* ════════════════════════════════════════════════════════════
   WIDE DESKTOP (> 1440px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 1440px) {
  .page-content {
    padding: 36px 48px;
  }
}

/* ════════════════════════════════════════════════════════════
   SHARED TOUCH IMPROVEMENTS (all sizes)
   ════════════════════════════════════════════════════════════ */
@media (pointer: coarse) {
  /* Bigger touch targets */
  .nav-item {
    min-height: 44px;
  }
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 40px;
  }
  .tab-btn {
    min-height: 44px;
    padding: 10px 16px;
  }
  .equip-checkbox {
    width: 22px;
    height: 22px;
  }
  .shot-complete-btn {
    width: 34px;
    height: 34px;
  }
  .breakdown-cat-tab {
    padding: 8px 14px;
    font-size: 12px;
  }
}

/* ════════════════════════════════════════════════════════════
   UTILITY: Responsive helpers
   ════════════════════════════════════════════════════════════ */
/* Responsive visibility helpers — defaults (visible at all sizes) */
.hide-mobile  { display: revert; }
.hide-tablet  { display: revert; }
.hide-desktop { display: revert; }

@media (max-width: 767px) {
  .hide-mobile  { display: none !important; }
  .mobile-only  { display: block; }
  .mobile-flex  { display: flex; }
}
@media (min-width: 768px) {
  .mobile-only  { display: none !important; }
  .mobile-flex  { display: none !important; }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .hide-tablet  { display: none !important; }
}
@media (min-width: 1025px) {
  .hide-desktop { display: none !important; }
}
