/* ============================================================
   SportyXi – Mobile Native App Experience
   Only affects screens <= 768px (mobile devices)
   ============================================================ */

/* ─── Global Font Awesome Polyfill for Cricket Icon ─── */
.fa-cricket-bat-ball::before {
    content: '' !important;
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M366.1 19.9L492.1 145.9c12.5 12.5 12.5 32.8 0 45.3L223.8 459.4c-12.5 12.5-32.8 12.5-45.3 0L52.5 333.5c-12.5-12.5-12.5-32.8 0-45.3L320.8 19.9c12.5-12.5 32.8-12.5 45.3 0zM95.1 326.3L186 417.2 46.1 487.2c-15.7 7.8-33.8-4.7-31-22l19.8-88.7 60.2-50.2zM448 400a48 48 0 1 1 -96 0 48 48 0 1 1 96 0z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M366.1 19.9L492.1 145.9c12.5 12.5 12.5 32.8 0 45.3L223.8 459.4c-12.5 12.5-32.8 12.5-45.3 0L52.5 333.5c-12.5-12.5-12.5-32.8 0-45.3L320.8 19.9c12.5-12.5 32.8-12.5 45.3 0zM95.1 326.3L186 417.2 46.1 487.2c-15.7 7.8-33.8-4.7-31-22l19.8-88.7 60.2-50.2zM448 400a48 48 0 1 1 -96 0 48 48 0 1 1 96 0z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ─── Native App Feel ─── */
@media (max-width: 768px) {

    /* Prevent overscroll bounce for native feel */
    html {
        overscroll-behavior: none;
        -webkit-tap-highlight-color: transparent;
    }

    body {
        -webkit-text-size-adjust: 100%;
        padding-bottom: 80px; /* Space for bottom nav */
    }

    /* Smoother scrolling everywhere */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* ─── Category Bar: Icon-Only ─── */
    .cat-btn span,
    #category-container .cat-btn {
        font-size: 0; /* hide text */
        padding: 10px 14px;
        min-width: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    #category-container .cat-btn i {
        font-size: 16px;
        margin: 0;
    }
    /* "All Sports" button has no icon, show short text */
    #category-container .cat-btn[data-category="all"] {
        font-size: 12px;
        padding: 8px 16px;
    }

    /* ─── Minimized Player adjustment for bottom nav ─── */
    .player-minimized {
        bottom: 90px !important;
        right: 12px !important;
        width: 200px !important;
        height: 113px !important;
    }

    /* ─── Hide desktop hover sidebar on mobile ─── */
    aside.fixed.left-0.top-0.h-full.w-20 {
        display: none !important;
    }

    /* ─── Footer spacing fix ─── */
    footer {
        margin-bottom: 0;
        padding-bottom: 80px !important;
    }
}


/* ============================================================
   iOS-Style Bottom Navigation Bar
   ============================================================ */
#mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    #mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        flex-direction: column;
        align-items: center;
        pointer-events: auto;
    }

    #mobile-bottom-nav .bottom-nav-bar {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 8px 0 4px 0;
        /* Dark Glassmorphism */
        background: rgba(10, 10, 14, 0.78);
        backdrop-filter: blur(28px) saturate(180%);
        -webkit-backdrop-filter: blur(28px) saturate(180%);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    }

    /* iOS Home Indicator */
    #mobile-bottom-nav .ios-home-indicator {
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 6px 0 8px 0;
        background: rgba(10, 10, 14, 0.78);
        backdrop-filter: blur(28px) saturate(180%);
        -webkit-backdrop-filter: blur(28px) saturate(180%);
    }
    #mobile-bottom-nav .ios-home-indicator::after {
        content: '';
        width: 134px;
        height: 5px;
        border-radius: 100px;
        background: rgba(255, 255, 255, 0.3);
    }

    /* Nav Items */
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.45);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.02em;
        transition: color 0.25s ease, transform 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        padding: 4px 0;
        min-width: 56px;
        position: relative;
        background: none;
        border: none;
        cursor: pointer;
    }
    .bottom-nav-item:active {
        transform: scale(0.88);
    }

    .bottom-nav-item i {
        font-size: 20px;
        transition: color 0.25s ease, transform 0.2s ease;
    }

    .bottom-nav-item span {
        font-size: 10px;
        line-height: 1;
    }

    /* Active state */
    .bottom-nav-item.active {
        color: #fff;
    }
    .bottom-nav-item.active i {
        transform: translateY(-1px);
    }

    /* ─── Center Search Button (Highlighted Neon/Brand) ─── */
    .bottom-nav-item.nav-search {
        color: #ff3b3b;
        position: relative;
    }
    .bottom-nav-item.nav-search i {
        font-size: 22px;
        filter: drop-shadow(0 0 8px rgba(255, 59, 59, 0.6));
        transition: filter 0.3s ease, transform 0.2s ease;
    }
    .bottom-nav-item.nav-search:active i {
        filter: drop-shadow(0 0 14px rgba(255, 59, 59, 0.9));
    }
    .bottom-nav-item.nav-search span {
        color: #ff3b3b;
    }
    /* Glow ring behind search icon */
    .bottom-nav-item.nav-search::before {
        content: '';
        position: absolute;
        top: -2px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(255, 59, 59, 0.15) 0%, transparent 70%);
        pointer-events: none;
    }
}


/* ============================================================
   Navbar Search Mode (Triggered from Bottom Nav)
   ============================================================ */
@media (max-width: 768px) {

    /* When search mode is active, transform navbar into search bar */
    nav.search-mode-active .nav-logo-section,
    nav.search-mode-active .nav-actions-section,
    nav.search-mode-active #mobileSidebarOpenBtn {
        display: none !important;
    }

    nav.search-mode-active .nav-search-section {
        display: flex !important;
        flex: 1 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    nav.search-mode-active .nav-search-section input {
        font-size: 16px !important;
        padding: 10px 48px 10px 16px !important;
        border-radius: 14px !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    /* Close search button shown in search mode */
    .mobile-search-close-btn {
        display: none;
    }
    nav.search-mode-active .mobile-search-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: #fff;
        font-size: 14px;
        margin-left: 8px;
        flex-shrink: 0;
        cursor: pointer;
        transition: background 0.2s ease;
    }
    nav.search-mode-active .mobile-search-close-btn:active {
        background: rgba(255, 255, 255, 0.15);
    }

    /* Smooth transition for nav content changes */
    nav .nav-logo-section,
    nav .nav-actions-section,
    nav .nav-search-section,
    nav #mobileSidebarOpenBtn {
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    /* Search results dropdown on mobile */
    #mobile-search-results {
        position: fixed;
        top: 66px;
        left: 0;
        right: 0;
        bottom: 80px;
        background: rgba(11, 12, 16, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 45;
        overflow-y: auto;
        padding: 12px 16px;
        display: none;
    }
    #mobile-search-results.show {
        display: block;
    }
    #mobile-search-results .search-result-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        border-radius: 12px;
        margin-bottom: 6px;
        transition: background 0.2s ease;
        cursor: pointer;
    }
    #mobile-search-results .search-result-item:active {
        background: rgba(255, 255, 255, 0.06);
    }
    #mobile-search-results .search-result-item img {
        width: 56px;
        height: 36px;
        border-radius: 8px;
        object-fit: cover;
        flex-shrink: 0;
    }
    #mobile-search-results .search-result-item .sr-info {
        flex: 1;
        min-width: 0;
    }
    #mobile-search-results .search-result-item .sr-title {
        color: #fff;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #mobile-search-results .search-result-item .sr-meta {
        color: rgba(255,255,255,0.4);
        font-size: 11px;
        margin-top: 2px;
    }
}


/* ============================================================
   Native Video Player UI (Mobile Touch-Friendly)
   Carefully targeted — no aggressive overrides
   ============================================================ */
@media (max-width: 768px) {

    /* Make control buttons easier to tap */
    #player-container button {
        min-width: 40px;
        min-height: 40px;
    }

    /* Slightly bigger timeline for finger tapping */
    #timeline-container {
        height: 5px !important;
    }
    #timeline-container:active {
        height: 8px !important;
    }

    /* Center play button slight size boost */
    #center-play-btn {
        transform: scale(1.1);
    }

    /* Video player modal — no side padding on mobile */
    #video-player-modal {
        padding: 0 !important;
    }

    /* Player container full-width, no rounded corners on mobile */
    #player-container {
        border-radius: 0 !important;
        border: none !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
    }
}

/* ============================================================
   Hide Bottom Nav When Video Player is Open
   ============================================================ */
@media (max-width: 768px) {
    body.video-player-open #mobile-bottom-nav {
        display: none !important;
    }
}

/* ============================================================
   Smooth Transitions & Micro-Animations
   ============================================================ */
@media (max-width: 768px) {
    /* Smooth page transitions */
    .animate-mobile-fade-in {
        animation: mobileFadeIn 0.35s ease-out forwards;
    }
    @keyframes mobileFadeIn {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* Bottom nav entrance animation */
    #mobile-bottom-nav {
        animation: slideUpNav 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    @keyframes slideUpNav {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Search mode transition */
    nav.search-mode-active {
        animation: searchExpand 0.3s ease-out forwards;
    }
    @keyframes searchExpand {
        from { background: rgba(11, 12, 16, 0.85); }
        to { background: rgba(11, 12, 16, 0.98); }
    }

    /* Haptic-like press effect on bottom nav */
    .bottom-nav-item:active {
        transform: scale(0.85);
        transition: transform 0.1s ease;
    }
}
