/* ============================================================================
   AXADLE DIRECT — Global Responsive / Mobile-First Overrides
   Covers: Hero, Content Rows, Live TV Hub, Browse Grid, Cards, Bottom Nav
   Breakpoints used: 1280px | 991px | 980px | 767px | 575px | 400px
   ========================================================================== */

/* ── 1. Hero — all browse pages (Movies, TV Series hero partial) ─────────── */
.ax-hero {
    /* Tall on desktop (set by home + content-rows.css); clamp on tablets/mobile */
}
@media (max-width: 991px) {
    .ax-hero { height: 62vh; min-height: 420px; }
    .ax-hero-inner { padding: 60px 0 40px; max-width: 100%; }
    .ax-hero-title { font-size: clamp(22px, 5vw, 36px); }
}
@media (max-width: 767px) {
    .ax-hero { height: 54vh; min-height: 340px; }
    .ax-hero-inner { padding: 24px 20px 28px; }
    .ax-hero-title { font-size: clamp(20px, 6vw, 28px); margin-bottom: 8px; }
    .ax-hero-desc { font-size: 13px; margin-bottom: 16px; -webkit-line-clamp: 3; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
    .ax-hero-badge { font-size: 10px; padding: 3px 10px; margin-bottom: 10px; }
    .ax-hero-meta { gap: 8px; margin-bottom: 10px; }
    .ax-hero-meta-item { font-size: 12px; }
    .ax-hero-actions { gap: 8px; }
    .ax-hero-actions .btn-ax { padding: 11px 18px; font-size: 13px; border-radius: 10px; }
    .hero-swiper-pagination { bottom: 14px; }
}
@media (max-width: 400px) {
    .ax-hero { height: 52vh; min-height: 300px; }
    .ax-hero-actions .btn-ax.btn-lg { padding: 10px 14px; font-size: 12px; }
}

/* ── 2. Content Rows (Browse pages + Home) ───────────────────────────────── */
@media (max-width: 767px) {
    .ax-section { padding: 20px 0 0; }
    .ax-row-header { padding: 0 14px; margin-bottom: 10px; }
    .ax-section-title { font-size: 15px; }
    .ax-section-more { font-size: 12px; }
    .content-swiper { padding-left: 14px !important; }
    .ax-row-carousel::before,
    .ax-row-carousel::after { width: 36px; }
    /* Larger touch target for nav arrows */
    .ax-row-nav { width: 34px; height: 34px; font-size: 14px; }
    .ax-row-nav-prev { left: 6px; }
    .ax-row-nav-next { right: 6px; }
}
/* Browse mode wrapper bottom padding so mobile nav doesn't cover last row */
.browse-mode-rows { padding-bottom: 100px; }
@media (max-width: 767px) {
    .browse-mode-rows { padding-bottom: 120px; }
}

/* ── 3. Genre Chip Row ───────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .genre-chip-row { padding: 0 14px; gap: 8px; }
    .genre-chip { padding: 7px 13px; font-size: 12px; }
    .browse-genre-jump { padding-top: 28px !important; padding-bottom: 20px; }
}

/* ── 4. Content Card ─────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Always show title + meta (no hover required on touch) */
    .ax-content-card .ax-card-overlay { opacity: 1; }
    .ax-content-card .ax-card-info { opacity: 1; }
    .ax-content-card:hover { transform: none; box-shadow: none; }
    .ax-card-cap { padding: 6px 2px 0; }
    .ax-card-title { font-size: 12px; }
    .ax-card-meta { font-size: 10px; gap: 6px; }
    /* Quick-action buttons: hide on mobile (detail link still works via poster) */
    .ax-card-hoveractions { display: none; }
}

/* ── 5. Live TV Hub ──────────────────────────────────────────────────────── */

/* 5a. Always prevent hub from causing horizontal scroll */
.hub { overflow-x: hidden; }
/* Search input can't enforce a min-width and overflow the container */
.hub-search input { min-width: 0 !important; }

/* 5b. Top bar: stack title + search on narrow screens */
@media (max-width: 575px) {
    .hub-top { flex-direction: column; align-items: stretch; gap: 10px; }
    .hub-search { max-width: 100%; min-width: 0; }
}

/* 5c. Tablet/mobile (≤980px): collapse both grids to a single column */
@media (max-width: 980px) {
    /* Hero area: player takes full row, sidebar stacks below */
    .hub-hero {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    .hub-featured { width: 100%; min-width: 0; }
    .hub-side { display: block; width: 100%; min-width: 0; }

    /* Categories sidebar → horizontal scrollable pill strip */
    .hub-cats {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-height: none !important;
        padding: 10px 12px;
        gap: 8px;
        border-radius: 10px;
    }
    .hub-cats::-webkit-scrollbar { display: none; }
    .hub-cats-head { display: none !important; }
    .hub-cat { white-space: nowrap; flex-shrink: 0; padding: 8px 14px; font-size: 13px; }
    /* "On now" sidebar panel: hidden — channels are listed in hub-lower */
    .hub-side-now { display: none !important; }

    /* Lower two-panel area: single column stack */
    .hub-lower {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
}

/* 5d. Mobile (≤767px): compact spacing + cap player height */
@media (max-width: 767px) {
    .hub-top { margin-bottom: 12px; }
    .hub-title { font-size: 20px; }

    /* Cap video player height so content below the fold is still visible */
    .hub-featured { border-radius: 12px; overflow: hidden; }
    .hub-featured .ax-vjs-shell,
    .hub-featured .video-js { max-height: 56vw !important; }
    .hub-featured-fallback { aspect-ratio: 16/9; max-height: 56vw; }

    .hub-badge { top: 10px; left: 10px; font-size: 10px; padding: 3px 8px; }

    .hub-now { padding: 10px 12px 11px; }
    .hub-now-label { font-size: 9px; margin-bottom: 4px; }
    .hub-now-logo { width: 36px; height: 36px; border-radius: 6px; }
    .hub-now-title { font-size: 14px; }
    .hub-now-time { font-size: 11px; }
    .hub-now-bar { margin-top: 6px; }
    .hub-fav { width: 34px; height: 34px; font-size: 15px; }

    /* Panels */
    .hub-panel { padding: 12px; border-radius: 10px; }
    .hub-panel-head { font-size: 14px; margin-bottom: 10px; }
    .hub-lower { gap: 10px; margin-bottom: 12px; }

    /* Channel list */
    .hub-ch { grid-template-columns: 42px minmax(0,1fr) 28px; gap: 10px; padding: 8px; border-radius: 10px; }
    .hub-ch-logo { width: 42px; height: 30px; border-radius: 6px; }
    .hub-ch-name { font-size: 13px; }
    .hub-ch-sub { font-size: 11px; }
    .hub-ch-play { font-size: 18px; }

    /* TV Guide */
    .hub-guide { max-height: 320px; }
    .hub-guide-row { padding: 9px 4px; gap: 10px; font-size: 12.5px; }
    .hub-guide-time { min-width: 58px; }

    /* Channel rail (More Channels) */
    .hub-rail { gap: 10px; }
    .hub-tile { flex-basis: 96px; }
    .hub-tile-thumb { width: 96px; height: 58px; border-radius: 8px; }
    .hub-tile-name { font-size: 11px; }
    .ltv-rail-card { flex-basis: 96px; }
    .ltv-rail-thumb { width: 96px; height: 58px; border-radius: 8px; }

    /* Pager */
    .hub-page-btn { width: 30px; height: 30px; font-size: 13px; }
    .hub-page-status { font-size: 11px; min-width: 72px; }
}

/* 5e. Extra-small (≤400px): tighter spacing */
@media (max-width: 400px) {
    .hub-ch { grid-template-columns: 38px minmax(0,1fr) 26px; gap: 8px; }
    .hub-ch-logo { width: 38px; height: 28px; }
    .hub-tile { flex-basis: 88px; }
    .hub-tile-thumb { width: 88px; height: 52px; }
}

/* ── 6. Browse (filter grid) page tweaks ─────────────────────────────────── */
@media (max-width: 767px) {
    /* Movie grid — already 3 columns in main CSS; ensure no x-overflow */
    .ax-grid, .content-grid { overflow-x: hidden; }
    .ax-browse-wrap { padding: 10px 0 80px; }
    /* Make the filter sidebar/form usable on small screens */
    .browse-filters { flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; }
    .browse-filters .ax-input { min-width: 0; width: 100%; }
    .browse-filters .ax-btn { width: 100%; justify-content: center; }
    .browse-page { padding: 14px 12px 100px; }
}

/* ── 7. Home page hero (premium skin: goes under nav) ───────────────────── */
@media (max-width: 991px) {
    .ax-home-dashboard .ax-hero { height: min(64vh, 560px); min-height: 400px; }
}
@media (max-width: 767px) {
    .ax-home-dashboard .ax-hero {
        height: 55vh;
        min-height: 310px;
        border-radius: 0;
        margin-top: calc(-1 * var(--ax-navbar-h));
    }
    .ax-home-dashboard .hero-nav-btn { display: none; }
}

/* ── 8. Bottom nav: always on top; content scrolls clear of it ──────────── */
/* Force the nav above every stacking context (player backdrop-filter, panels) */
.ax-mobile-bottom-nav { z-index: 2100 !important; }
@media (max-width: 767px) {
    .ax-footer { padding-bottom: 110px !important; }
    /* Hub bottom padding must clear the 64px nav + 10px gap + safe area */
    .hub { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ── 9. Global: horizontal overflow guard + touch scroll on swipe rows ──── */
@media (max-width: 767px) {
    main { overflow-x: hidden; }
    .swiper, .swiper-wrapper, .ax-row-carousel, .hub-rail,
    .hub-cats, .genre-chip-row {
        -webkit-overflow-scrolling: touch;
    }
    .ax-hero-gradient {
        background:
            linear-gradient(to top, rgba(5,10,20,.97) 0%, rgba(5,10,20,.72) 40%, rgba(5,10,20,.3) 100%);
    }
}
