/* ============================================================
   mobile.css — Responsive layout: tablet & mobile breakpoints
   Desktop (1280px+): unchanged (base styles in layout.css)
   Tablet (768px–1279px): narrower sidebar, reduced padding
   Mobile (<768px): single-column, bottom drawer for sidebar
   ============================================================ */

/* ════════════════════════════════════════
   GLOBAL MOBILE SAFETY
   ════════════════════════════════════════ */
body {
  overflow-x: hidden;
}

/* Ensure all scroll containers get smooth touch scrolling */
.left-col__feed,
.right-sidebar,
.quick-chips,
.video-scroll,
.topnav__nav,
.email-tray {
  -webkit-overflow-scrolling: touch;
}

/* Hover styles only on devices that support hover (avoids sticky
   hover states on touch screens) */
@media (hover: none) {
  .nav-pill:hover,
  .quick-chip:hover,
  .mini-panel:hover,
  .news-card:hover,
  .video-card:hover .video-card__play,
  .email-row:hover,
  .btn--primary:hover,
  .btn--ghost:hover,
  .ai-source-chip:hover,
  .video-row-label__see-all:hover,
  .panel-card__close:hover {
    background: unset;
    color: unset;
    opacity: unset;
  }
}

/* ════════════════════════════════════════
   TABLET  768px – 1279px
   ════════════════════════════════════════ */
@media (max-width: 1279px) and (min-width: 768px) {
  /* Narrower sidebar */
  .main-content {
    grid-template-columns: 1fr 260px;
  }

  /* Slightly reduced nav gap */
  .topnav__nav {
    gap: 3px;
  }

  /* Reduced padding */
  .topnav {
    padding: 0 16px;
  }

  .left-col__top {
    padding: 16px 18px 0;
  }

  .left-col__feed {
    padding: 14px 18px 20px;
  }

  .right-sidebar {
    padding: 16px 12px 20px;
  }
}

/* ════════════════════════════════════════
   MOBILE  < 768px
   ════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Top Navigation ── */
  .topnav {
    height: 48px;
    padding: 0 14px;
    gap: 8px;
  }

  .topnav__logo {
    font-size: 1.05rem;
    margin-right: 4px;
  }

  /* Nav pills: horizontally scrollable, no wrap */
  .topnav__nav {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .topnav__nav::-webkit-scrollbar {
    display: none;
  }

  .nav-pill {
    font-size: 11px;
    padding: 5px 11px;
    flex-shrink: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Hide the spacer — nav takes the flex space */
  .topnav__spacer {
    display: none;
  }

  .topnav__avatar {
    width: 32px;
    height: 32px;
    font-size: 0.65rem;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
  }

  /* ── Main Layout: single column ── */
  .main-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Left column takes all space */
  .left-col {
    border-right: none;
    flex: 1;
    min-height: 0;
  }

  .left-col__top {
    padding: 14px 14px 0;
  }

  .left-col__feed {
    padding: 12px 14px 80px; /* bottom padding for floating button */
  }

  /* Right sidebar hidden on mobile — shown in bottom drawer */
  .right-sidebar {
    display: none;
  }

  /* ── Command Bar ── */
  .command-bar {
    padding: 8px 12px;
    gap: 10px;
  }

  .command-bar__input::placeholder {
    /* JS will handle placeholder text; CSS fallback */
    font-size: 0.85rem;
  }

  /* Hide ⌘K badge on mobile */
  .command-bar__shortcut {
    display: none;
  }

  /* ── Quick-Action Chips ── */
  .quick-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .quick-chips::-webkit-scrollbar {
    display: none;
  }

  .quick-chip {
    flex-shrink: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* ── Mini Status Panels: 2×2 grid ── */
  .mini-panels {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .mini-panel {
    min-height: 44px;
  }

  .mini-panel__value {
    font-size: 0.78rem;
  }

  .mini-panel__sub {
    font-size: 0.68rem;
  }

  /* ── News Feed: single column ── */
  .news-grid {
    grid-template-columns: 1fr;
  }

  /* ── Video Row: narrower thumbnails ── */
  .video-card {
    width: 130px;
  }

  .video-card__thumb {
    width: 130px;
    height: 73px;
  }

  /* ── General touch targets ── */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .email-row {
    min-height: 44px;
  }

  .panel-card__close {
    width: 44px;
    height: 44px;
  }

  /* ── Panel overlay: full-screen on mobile ── */
  .panel-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .panel-card {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 16px 28px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .panel-card__iframe {
    height: 280px;
  }

  /* ════════════════════════════════════════
     BOTTOM DRAWER
     ════════════════════════════════════════ */

  /* Floating trigger button */
  .bottom-drawer-trigger {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 0 20px;
    height: 44px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(82, 120, 255, 0.45);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  }

  .bottom-drawer-trigger:active {
    transform: translateX(-50%) scale(0.96);
  }

  /* Drawer backdrop */
  .bottom-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(8, 11, 20, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .bottom-drawer-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Drawer panel */
  .bottom-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 450;
    height: 60vh;
    background: #0E1220;
    border-top: 1px solid var(--border-default);
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
  }

  .bottom-drawer.open {
    transform: translateY(0);
  }

  /* Drag handle bar */
  .bottom-drawer__handle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0 8px;
    cursor: grab;
    touch-action: none;
  }

  .bottom-drawer__handle::after {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-default);
  }

  /* Drawer scrollable content */
  .bottom-drawer__content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 14px 24px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .bottom-drawer__content::-webkit-scrollbar {
    display: none;
  }

  /* Drawer title */
  .bottom-drawer__title {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-hint);
    margin-bottom: 12px;
    padding-top: 4px;
  }
}
