/* ============================================================
   MOBILE RESPONSIVE — 768px and below
   ============================================================ */

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --header-height: 56px;
  }

  /* Header */
  .site-header {
    padding: 0 14px;
    gap: 10px;
  }

  .logo-text { font-size: 0.95rem; }

  .header-center { display: none; }

  .header-right { gap: 8px; }

  /* Mobile tab bar replaces header tabs */
  .mobile-tab-bar {
    display: flex !important;
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    background: rgba(7, 7, 15, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 8px 14px;
    gap: 6px;
  }

  .mobile-tab-bar .header-tab {
    flex: 1;
    text-align: center;
    padding: 8px 8px;
    font-size: 0.8rem;
  }

  /* Main Layout — stacked */
  .main-layout {
    flex-direction: column;
  }

  /* Sidebar becomes collapsible drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 88vw;
    max-width: 320px;
    z-index: 200;
    transform: translateX(-105%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 56px;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 40px rgba(0,0,0,0.6);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: all;
  }

  /* Mobile exam selector bar (compact, above content) */
  .mobile-exam-bar {
    display: flex !important;
    padding: 10px 14px;
    gap: 8px;
    align-items: center;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
  }

  .mobile-exam-selector-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
  }

  .mobile-exam-selector-btn.has-exam {
    border-color: rgba(108, 99, 255, 0.4);
    color: var(--primary);
    background: rgba(108, 99, 255, 0.06);
  }

  .hamburger-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: var(--transition);
  }

  .hamburger-btn:hover {
    background: rgba(108, 99, 255, 0.1);
    border-color: var(--primary);
  }

  /* Content Area */
  .content-area {
    padding: 14px;
    gap: 16px;
  }

  /* Spec Grid */
  .spec-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Upload Area */
  .upload-area { padding: 28px 16px; }

  .upload-icon-wrap { width: 56px; height: 56px; font-size: 1.6rem; }

  .upload-title { font-size: 0.95rem; }

  /* Comparison Grid — stack on mobile */
  .comparison-grid {
    grid-template-columns: 1fr;
  }

  /* Result Actions */
  .result-actions {
    flex-direction: column;
  }

  .result-actions .btn-primary { width: 100%; }
  .share-btn { width: 100%; justify-content: center; }

  /* Savings Banner */
  .savings-banner { padding: 12px 14px; }

  /* Result Section */
  .result-section { padding: 18px; }
}

/* ============================================================
   TABLET — 769px to 1024px
   ============================================================ */

@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  .content-area { padding: 16px; }

  .spec-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   HIDE ON DESKTOP (mobile-only elements)
   ============================================================ */
.mobile-tab-bar,
.mobile-exam-bar,
.sidebar-overlay,
.hamburger-btn {
  display: none;
}

/* ============================================================
   TOUCH IMPROVEMENTS
   ============================================================ */
@media (hover: none) {
  .exam-btn:hover,
  .category-btn:hover,
  .btn:hover {
    transform: none !important;
  }
}

/* ============================================================
   REDUCE MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
