/**
 * mobile-first.css — Soccer808
 * ==============================
 * Single source of truth for mobile-first responsive design.
 * Written entirely with min-width breakpoints (true mobile-first).
 * Loaded LAST in app.blade.php so it wins specificity battles.
 *
 * Breakpoints:
 *   xs:  0–479px      (phones, portrait)
 *   sm:  480px+       (phones, landscape / large phones)
 *   md:  768px+       (tablets)
 *   lg:  1024px+      (small laptops)
 *   xl:  1280px+      (desktops)
 *
 * Fixes applied:
 *   1. Horizontal overflow prevention
 *   2. Touch targets ≥ 44px on all interactive elements
 *   3. Unreadable font sizes lifted to minimum 11px
 *   4. Safe-area-inset-bottom on bottom nav + footer
 *   5. Negative margin bleed fix on date nav
 *   6. Date item / market filter tab height fix
 *   7. Footer social icon tap areas
 *   8. Hero stat strip: 2-col on phones, 4-col on tablet+
 *   9. Match row layout improvements on phones
 *  10. Article cards: single column on phones, grid on tablet+
 *  11. VIP banner stacking on phones
 *  12. Scroll-to-top button clear of bottom nav on all devices
 *  13. Content body left/right padding never below 12px
 */

/* ═══════════════════════════════════════════════════════════
   0. GLOBAL OVERFLOW PREVENTION
   Never let any element cause horizontal scroll on any screen.
   ═══════════════════════════════════════════════════════════ */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Prevent any fixed-width child from escaping its container */
*,
*::before,
*::after {
    max-width: 100%;
    box-sizing: border-box;
}

/* Images always shrink to fit */
img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* ═══════════════════════════════════════════════════════════
   1. LAYOUT — MOBILE BASE (xs, all screens start here)
   ═══════════════════════════════════════════════════════════ */

/* Content body: generous padding on phones */
.ep-content-body {
    padding: 14px 0;
}

/* Below-nav: no horizontal padding on tiny screens */
.ep-below-nav {
    padding: 0 10px;
}

/* Main content never overflows */
.ep-main-content {
    min-width: 0;
    overflow-x: hidden;
}

/* Right panel: off by default (phones & tablets) */
.ep-right-panel {
    display: none;
}

/* ─────────────────────────────────────────────────
   Tablet (768px+): slightly more breathing room
   ───────────────────────────────────────────────── */
@media (min-width: 768px) {
    .ep-below-nav   { padding: 0 16px; }
    .ep-content-body { padding: 20px 0; }
}

/* ─────────────────────────────────────────────────
   Desktop (1100px+): show right panel
   ───────────────────────────────────────────────── */
@media (min-width: 1100px) {
    .ep-right-panel { display: flex; flex-direction: column; }
    .ep-below-nav   { padding: 0 20px; }
    .ep-content-body { padding: 24px 0; }
}


/* ═══════════════════════════════════════════════════════════
   2. NAVBAR — touch targets + overflow
   ═══════════════════════════════════════════════════════════ */

/* Ensure navbar never overflows */
.ep-navbar,
.ep-navbar-inner {
    overflow: hidden;
}

/* Hamburger: 44×44px minimum tap area */
.ep-hamburger,
.ep-icon-btn {
    min-width:  44px;
    min-height: 44px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo: limit height on small screens */
.ep-navbar-logo img {
    max-height: 30px;
}

@media (min-width: 480px) {
    .ep-navbar-logo img { max-height: 34px; }
}

@media (min-width: 1024px) {
    .ep-navbar-logo img { max-height: 38px; }
}

/* VIP button: always ≥ 44px tall */
.ep-vip-btn {
    min-height: 44px;
    height: auto;
    padding: 0 14px;
}

/* Nav links: 44px min tap height on desktop */
.ep-nav-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}


/* ═══════════════════════════════════════════════════════════
   3. MOBILE DRAWER — safe area + full height
   ═══════════════════════════════════════════════════════════ */
.ep-drawer {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Drawer links: 48px tap areas */
.ep-drawer-link {
    min-height: 48px;
    padding: 12px 20px;
}

.ep-drawer-section-title {
    font-size: 0.72rem; /* was 0.7rem, barely readable */
}


/* ═══════════════════════════════════════════════════════════
   4. BOTTOM NAVIGATION — 44px+ items + safe area
   ═══════════════════════════════════════════════════════════ */
.s8-bottom-nav {
    /* Height accounts for the safe area */
    height: calc(var(--s8-bottom-nav-h, 64px) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* Always show on mobile */
    display: flex;
}

/* Hide on desktop */
@media (min-width: 1024px) {
    .s8-bottom-nav { display: none !important; }
}

/* Each nav item: minimum 44px height */
.s8-nav-item {
    min-height: 44px;
    min-width:  44px;
}

/* Icon size: visible and touchable */
.s8-nav-item i,
.s8-nav-item .s8-nav-icon {
    font-size: 1.2rem;
}

/* Label: keep readable */
.s8-nav-item span {
    font-size: 0.67rem;
}

/* Active state: thicker indicator */
.s8-nav-item.active::before {
    height: 3px;
}


/* ═══════════════════════════════════════════════════════════
   5. DATE NAVIGATOR — fix negative margin bleed + touch
   ═══════════════════════════════════════════════════════════ */

/* Override the desktop-first betmines negative margin hack */
.bm-date-nav {
    margin-left:  0 !important;
    margin-right: 0 !important;
    overflow: visible !important;   /* was hidden — prevented inner scroll */
    padding: 4px 0 !important;
    display: flex;
    gap: 3px;
}

/* Inner scrollable wrapper must be unrestricted */
.bm-date-items-wrapper {
    overflow-x: auto !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 3px;
    flex: 1;
}
.bm-date-items-wrapper::-webkit-scrollbar { display: none; }

/* Date items: 44px minimum tap height */
.bm-date-item {
    min-height: 44px;
    min-width:  40px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 10px !important;
}

/* Active date item */
.bm-date-item.active {
    padding: 6px 10px !important;
}

/* Live pill: 44px tap height */
.bm-date-live {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 14px !important;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Date day text: readable minimum */
.bm-date-day   { font-size: 0.9rem !important; }
.bm-date-label { font-size: 0.6rem !important; }  /* lifted from 7–9px */

/* Calendar picker: 44px */
#bm-calendar-picker {
    min-height: 44px;
    min-width:  44px;
}


/* ═══════════════════════════════════════════════════════════
   6. MARKET FILTER TABS — 44px touch + readable
   ═══════════════════════════════════════════════════════════ */
.ep-cat-tab,
.bm-market-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
}

/* Larger on tablet+ */
@media (min-width: 768px) {
    .ep-cat-tab  { padding: 9px 20px !important; }
    .bm-market-btn { padding: 9px 20px !important; }
}


/* ═══════════════════════════════════════════════════════════
   7. HERO STATS STRIP — 2 col phones → 4 col tablet+
   ═══════════════════════════════════════════════════════════ */
.ep-hero-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;  /* 2 columns on phones */
    gap: 10px;
    margin-bottom: 16px;
}

.ep-hero-stat {
    padding: 12px;
    gap: 10px;
    border-radius: 10px;
}

.ep-hero-stat-icon {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
}

.ep-hero-stat-value { font-size: 1.1rem; }

/* Tablet: 4 columns */
@media (min-width: 640px) {
    .ep-hero-strip {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    .ep-hero-stat {
        padding: 14px 16px;
        gap: 12px;
    }
    .ep-hero-stat-icon { width: 38px; height: 38px; font-size: 1.1rem; }
    .ep-hero-stat-value { font-size: 1.25rem; }
}

@media (min-width: 1024px) {
    .ep-hero-stat { padding: 16px 20px; gap: 14px; }
    .ep-hero-stat-icon { width: 42px; height: 42px; font-size: 1.2rem; }
    .ep-hero-stat-value { font-size: 1.4rem; }
}


/* ═══════════════════════════════════════════════════════════
   8. MATCH LIST — toolbar + row improvements on phones
   ═══════════════════════════════════════════════════════════ */

/* Search bar: stack sort button below search on very small screens */
.bm-search-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
}

/* Ensure search input fills available width on mobile */
.bm-search-input {
    flex: 1;
    min-width: 0;
    max-width: 100% !important;
}

/* Sort button: 44px tap height */
.bm-filter-btn {
    min-height: 44px;
    padding: 8px 14px;
}

/* Table header text: hide on phones, show on tablet */
.bm-table-headers {
    display: none;
}
@media (min-width: 768px) {
    .bm-table-headers { display: flex; }
}

/* League header: taller for touch */
.bm-league-header {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* Match row: min 52px touch area on phones */
.bm-match-row-premium {
    min-height: 52px;
    padding: 10px 10px !important;
}

/* Time column: wider to avoid clipping "90+5'" */
.bm-match-time {
    width: 42px !important;
    font-size: 0.72rem !important;
    flex-shrink: 0;
}

/* Team name: slightly larger on mobile for readability */
.bm-team-name-text {
    font-size: 0.85rem !important;
}

/* Stats block: fixed right column on phones */
.bm-match-stats {
    width: auto;
    min-width: 70px;
    flex-shrink: 0;
}

/* On tablet: restore wider stats */
@media (min-width: 640px) {
    .bm-match-time  { width: 52px !important; font-size: 0.8rem !important; }
    .bm-match-stats { min-width: 160px; }
    .bm-match-row-premium { padding: 11px 14px !important; }
    .bm-team-name-text { font-size: 0.88rem !important; }
}


/* ═══════════════════════════════════════════════════════════
   9. VIP BANNER — stack on phones, row on tablet+
   ═══════════════════════════════════════════════════════════ */
.s8-vip-banner {
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    text-align: center;
    border-radius: 12px;
}

.s8-vip-banner-icon {
    font-size: 2rem;
}

.s8-vip-banner-text h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.s8-vip-banner-text p {
    font-size: 0.8rem;
}

/* CTA button: full-width on phones */
.s8-vip-banner .s8-btn-gold {
    width: 100%;
    justify-content: center;
    min-height: 48px;
}

@media (min-width: 640px) {
    .s8-vip-banner {
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 20px;
        padding: 20px;
    }
    .s8-vip-banner .s8-btn-gold {
        width: auto;
    }
}


/* ═══════════════════════════════════════════════════════════
   10. ARTICLE CARDS — full width phones → grid tablet+
   ═══════════════════════════════════════════════════════════ */

/* Override Bootstrap col-md-4 stacking */
.s8-card .row > [class*="col-md-4"] {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    margin-bottom: 12px;
}

@media (min-width: 576px) {
    .s8-card .row > [class*="col-md-4"] {
        width: 50%;
        max-width: 50%;
        flex: 0 0 50%;
    }
}

@media (min-width: 992px) {
    .s8-card .row > [class*="col-md-4"] {
        width: 33.333%;
        max-width: 33.333%;
        flex: 0 0 33.333%;
    }
}

/* Article card image: taller thumbnail on mobile for visibility */
.s8-article-thumb,
.bm-article-img {
    height: 180px;
}

@media (min-width: 768px) {
    .s8-article-thumb,
    .bm-article-img { height: 160px; }
}


/* ═══════════════════════════════════════════════════════════
   11. FOOTER — tap targets + safe area
   ═══════════════════════════════════════════════════════════ */

/* Footer: clear bottom nav + safe area on mobile */
.bm-footer {
    padding-bottom: calc(
        var(--s8-bottom-nav-h, 64px)
        + env(safe-area-inset-bottom, 0px)
        + 16px
    ) !important;
}

@media (min-width: 1024px) {
    .bm-footer { padding-bottom: 40px !important; }
}

/* Social icons: 44×44px tap areas */
.bm-footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width:  44px;
    min-height: 44px;
    border-radius: 50%;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.bm-footer-social a:hover {
    background: rgba(255,255,255,0.1);
}

/* Footer extra links: space them for touch */
.bm-footer-extra-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.bm-footer-extra-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 2px 0;
}

/* Footer nav links: min 36px line height for touch */
.bm-footer-link {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 2px 0;
}

/* Partner unfold button: 44px tap area */
.bm-partners-unfold-btn {
    min-height: 44px;
    padding: 8px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Footer bottom: stack on phones */
.bm-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

@media (min-width: 640px) {
    .bm-footer-bottom {
        flex-direction: row;
        align-items: center;
    }
}


/* ═══════════════════════════════════════════════════════════
   12. SCROLL-TO-TOP — clear bottom nav + safe area
   ═══════════════════════════════════════════════════════════ */
.s8-scroll-top {
    bottom: calc(
        var(--s8-bottom-nav-h, 64px)
        + env(safe-area-inset-bottom, 0px)
        + 12px
    );
    right: 14px;
    width:  44px;
    height: 44px;
}

@media (min-width: 1024px) {
    .s8-scroll-top { bottom: 28px; right: 24px; }
}


/* ═══════════════════════════════════════════════════════════
   13. AD SLOTS — prevent horizontal overflow on small screens
   ═══════════════════════════════════════════════════════════ */

/* Rectangle ad: shrink to fit, never overflow viewport */
.ad-rectangle-link,
.ad-rectangle-img,
.ad-rectangle-fallback {
    width: 100% !important;
    max-width: 300px;
}

.ad-rectangle-img {
    height: auto !important;
    aspect-ratio: 6 / 5;  /* maintains 300:250 proportion while scaling */
    object-fit: cover;
}

.ad-rectangle-fallback {
    height: auto !important;
    min-height: 160px;
    aspect-ratio: 6 / 5;
}

/* Leaderboard: never wider than viewport */
.ad-leaderboard-link,
.ad-leaderboard-img,
.ad-leaderboard-fallback {
    max-width: 100%;
    width: 100%;
}

.ad-leaderboard-fallback {
    padding: 0 12px;
}

/* Native cards: 1 col phones → 2 col sm → auto on lg */
.ad-native-cards {
    grid-template-columns: 1fr 1fr;
}

@media (min-width: 480px) {
    .ad-native-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
    .ad-native-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Native card CTA: 44px tap area */
.ad-native-cta {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 14px;
}


/* ═══════════════════════════════════════════════════════════
   14. BUTTONS — base touch-friendly sizes
   ═══════════════════════════════════════════════════════════ */
.s8-btn {
    min-height: 44px;
}

.s8-btn-sm {
    min-height: 40px;
    padding: 8px 16px;
}

.s8-btn-lg {
    min-height: 52px;
}

/* Sort/filter buttons */
.ep-sort-btn,
.bm-filter-btn {
    min-height: 44px;
}

/* Standings sub-pill tabs */
.bm-sub-pill,
.bm-standings-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
}


/* ═══════════════════════════════════════════════════════════
   15. TYPOGRAPHY — minimum readable font sizes
   ═══════════════════════════════════════════════════════════ */

/* Lift any 8–9px text to at least 11px */
.bm-date-label,
.bm-winning-category,
.bm-header-tip,
.bm-article-date,
.s8-label,
.ad-label {
    font-size: 0.7rem !important;  /* 11.2px */
}

/* Page title: fluid on phones */
.ep-page-title,
.bm-page-title {
    font-size: clamp(1.25rem, 5vw, 2rem) !important;
    line-height: 1.2;
}

/* Match time: readable on all screen sizes */
.bm-match-time,
.s8-match-kickoff {
    font-size: 0.72rem;
}

/* Live elapsed time */
.bm-match-time .text-danger {
    font-size: 0.7rem;
    font-weight: 700;
}


/* ═══════════════════════════════════════════════════════════
   16. PAGE-TITLE AREA — compact on phones
   ═══════════════════════════════════════════════════════════ */
.ep-page-header {
    margin-bottom: 14px;
}

.ep-page-subtitle {
    font-size: 0.82rem;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .ep-page-header  { margin-bottom: 20px; }
    .ep-page-subtitle { font-size: 0.9rem; }
}


/* ═══════════════════════════════════════════════════════════
   17. SECTION CARDS — compact padding on phones
   ═══════════════════════════════════════════════════════════ */
.s8-card {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 14px;
}

@media (min-width: 640px) {
    .s8-card { padding: 18px; margin-bottom: 18px; }
}

@media (min-width: 1024px) {
    .s8-card { padding: var(--s8-space-5, 20px); margin-bottom: var(--s8-space-5, 20px); }
}


/* ═══════════════════════════════════════════════════════════
   18. STICKY MOBILE AD BAR — clear bottom nav properly
   ═══════════════════════════════════════════════════════════ */
.ep-sticky-mobile-ad {
    bottom: calc(
        var(--s8-bottom-nav-h, 64px)
        + env(safe-area-inset-bottom, 0px)
    );
}


/* ═══════════════════════════════════════════════════════════
   19. LEADERBOARD AD WRAP — don't let it push content
   ═══════════════════════════════════════════════════════════ */
.ep-leaderboard-wrap {
    padding: 4px 10px;
}

@media (min-width: 768px) {
    .ep-leaderboard-wrap { padding: 6px 16px; }
}


/* ═══════════════════════════════════════════════════════════
   20. UTILITIES — mobile visibility helpers
   ═══════════════════════════════════════════════════════════ */

/* hideSM — referenced in home.blade.php: hide on small screens */
.hideSM {
    display: none !important;
}
@media (min-width: 640px) {
    .hideSM { display: flex !important; }
}

/* hideXS — helper for elements to hide only on very small phones */
.hideXS { display: none !important; }
@media (min-width: 480px) {
    .hideXS { display: initial !important; }
}

/* Tap-highlight: remove default blue flash on iOS/Android */
a, button, [role="button"] {
    -webkit-tap-highlight-color: transparent;
}


/* ═══════════════════════════════════════════════════════════
   21. SMOOTH SCROLL + FOCUS STYLES (accessibility)
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* Visible focus ring for keyboard nav */
:focus-visible {
    outline: 2px solid var(--s8-brand-accent, #00C853);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remove outline on mouse/touch */
:focus:not(:focus-visible) {
    outline: none;
}


/* ═══════════════════════════════════════════════════════════
   22. LIVE / ALL TOGGLE (match list header)
   ═══════════════════════════════════════════════════════════ */
.s8-live-toggle {
    display:     inline-flex;
    align-items: stretch;
    background:  rgba(255,255,255,0.06);
    border:      1px solid rgba(255,255,255,0.1);
    border-radius: var(--s8-radius, 10px);
    overflow:    hidden;
    flex-shrink: 0;
}

.s8-live-toggle-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             5px;
    padding:         7px 14px;
    font-size:       0.78rem;
    font-weight:     600;
    color:           rgba(255,255,255,0.55);
    text-decoration: none !important;
    white-space:     nowrap;
    transition:      background 0.15s, color 0.15s;
    min-height:      36px;
    -webkit-tap-highlight-color: transparent;
}

.s8-live-toggle-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}

.s8-live-toggle-btn.active {
    background: var(--s8-bg-card-alt, #1c2230);
    color: var(--s8-text-primary, #f0f4f8);
    font-weight: 700;
}

/* Live variant: red accent when active */
.s8-live-toggle-live.active {
    background: rgba(239,68,68,0.15);
    color: var(--s8-live, #ef4444) !important;
}

.s8-live-toggle-count {
    display:       inline-flex;
    align-items:   center;
    justify-content: center;
    min-width:     18px;
    height:        18px;
    padding:       0 4px;
    border-radius: 9px;
    background:    var(--s8-live, #ef4444);
    color:         #fff;
    font-size:     0.65rem;
    font-weight:   800;
    line-height:   1;
}

@media (min-width: 640px) {
    .s8-live-toggle-btn { padding: 8px 16px; }
}
