/* ---------------- Navbar: force single-line menu items on mobile ---------------- */
@media (max-width: 575.98px) {
    .navbar .navbar-nav-link{
        white-space: nowrap !important;
        flex-wrap: nowrap !important;
    }
    .navbar .navbar-nav-link i,
    .navbar .navbar-nav-link svg{ flex: 0 0 auto; }
    .navbar .navbar-nav-link{
        padding-left: .55rem !important;
        padding-right: .55rem !important;
        font-size: 12px !important;
        line-height: 1.1 !important;
    }
    .navbar .nav.gap-1{
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .navbar .nav.gap-1::-webkit-scrollbar{ display: none; }
    .navbar .nav.gap-1 > .nav-item{ flex: 0 0 auto !important; }
}

/* ---------------- Page background image (load only if exists) ---------------- */
:root{
    --page-bg: none;
    --page-bg-url: ""; /* ✅ اگر نمیخوای بک‌گراند: "" */
    --controls-h: 56px;
}
html, body { height: 100%; }
body{
    background-image: var(--page-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
body.has-bg::before{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: -1;
}

/* ---------------- Dropdown z-index fix ---------------- */
.navbar{ position: relative; z-index: 1030; }
.dropdown-menu{ z-index: 2000; }

/* ---------------- Mobile topbar layout (must swap in RTL/LTR) ---------------- */
.nav-topbar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}
@media (min-width: 1200px){ .nav-topbar{ display:none; } }

/* ✅ Mobile topbar swap (FA = hamburger left, lang right) (EN = hamburger right, lang left) */
#hamburgerBtn{ order: 1; }   /* default */
.lang-dd{ order: 2; }

[dir="rtl"] #hamburgerBtn{ order: 1; } /* FA */
[dir="rtl"] .lang-dd{ order: 2; }

[dir="ltr"] #hamburgerBtn{ order: 2; } /* EN */
[dir="ltr"] .lang-dd{ order: 1; }

[dir="rtl"] #langMenu { right: 0; left: auto; }
[dir="ltr"] #langMenu { left: 0; right: auto; }
#langToggle{ white-space: nowrap; }

/* ---------------- Offcanvas base ---------------- */
.offcanvas{
    background: #1f2a3a;
    color: #fff;
    border: 0;
}
.offcanvas .nav-link,
.offcanvas a.dropdown-item{
    color: #fff !important;
}
.offcanvas .nav-link:hover,
.offcanvas a.dropdown-item:hover{
    background: rgba(255,255,255,.08);
}
.offcanvas .nav-item + .nav-item{ margin-top: 6px; }

.offcanvas .nav-group-sub{
    list-style: none;
    padding: 6px 0 0 0;
    margin: 0;
}
.offcanvas .nav-group-sub .nav-link{
    padding: .55rem .75rem;
    border-radius: .5rem;
    opacity: .95;
}

/* ✅ Remove template default arrows (double icons) */
.offcanvas .nav-item-submenu > .nav-link::before,
.offcanvas .nav-item-submenu > .nav-link::after{
    content: none !important;
    display: none !important;
}

/* ✅ Our own caret */
.mobile-sub-toggle{
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}
.mobile-sub-toggle .caret{
    transition: transform .18s ease;
    opacity: .9;
}
.mobile-sub-toggle[aria-expanded="true"] .caret{
    transform: rotate(180deg);
}

/* ✅ Kill "bright focus bar" stuck on click */
.offcanvas .nav-link:focus,
.offcanvas .nav-link:focus-visible{
    box-shadow: none !important;
    outline: none !important;
}

/* ✅ Offcanvas side override based on dir */
.offcanvas-dir-rtl.offcanvas-start{
    left: auto !important;
    right: 0 !important;
    transform: translateX(100%);
}
.offcanvas-dir-rtl.offcanvas-start.show{ transform: none; }

.offcanvas-dir-ltr.offcanvas-start{
    left: 0 !important;
    right: auto !important;
    transform: translateX(-100%);
}
.offcanvas-dir-ltr.offcanvas-start.show{ transform: none; }

/* ---------------- Matches list scroll (mobile) ---------------- */
@media (max-width: 991.98px){
    .matches-card{
        max-height: calc(100vh - 210px);
        overflow: hidden;
    }
    .matches-card .card-body{
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    .matches-card .tab-content{
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }
    .matches-card .tab-pane{ min-height: 0; }
    .matches-card .tab-pane.active.show{
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0;
    }
    #liveList, #upcomingList{
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ----- Fullscreen fixes ----- */
.player-wrap { position: relative; }
.player-wrap:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
.player-wrap:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; }
.player-wrap:fullscreen .player-frame { height: calc(100vh - var(--controls-h)) !important; }
.player-wrap:-webkit-full-screen .player-frame { height: calc(100vh - var(--controls-h)) !important; }
.player-wrap:fullscreen .player-controls,
.player-wrap:-webkit-full-screen .player-controls{
    position: absolute;
    left: 0; right: 0; bottom: 0;
    border-radius: 0;
}

/* ---------------- Watermark (IMAGE) ---------------- */
.player-watermark{
    position: absolute;
    z-index: 10;
    bottom: calc(var(--controls-h) + 12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 14px;
    background: rgba(0,0,0,.28);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(6px);
    opacity: .88;
    transition: opacity .18s ease, transform .18s ease, background .18s ease, border-color .18s ease;
    user-select: none;
    pointer-events: auto;
}
.player-watermark img{
    display: block;
    width: 120px;
    height: auto;
    max-width: 38vw;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(0,0,0,.35));
}
.player-watermark.wm-left{ left: 12px; right: auto; }
.player-watermark.wm-right{ right: 12px; left: auto; }

/* Player frame */
.player-wrap{
    position: relative;
    width: 100%;
    background: #0f0f10;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.player-frame{
    width: 100%;
    height: 420px;
    display: block;
    background: #000;
    border: 0;
}
@media (max-width: 992px) { .player-frame { height: 260px; } }

/* ---------------- Player controls ---------------- */
.player-controls{
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,.06);
    background: rgb(40 50 71);
    backdrop-filter: blur(6px);
}
.player-controls .left,
.player-controls .right{
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.player-controls button{
    border: 0;
    background: rgba(255,255,255,.10);
    color: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
}
.player-controls button:hover{ background: rgba(255,255,255,.16); }

/* Desktop volume */
.vol-desktop{
    display: flex;
    align-items: center;
    gap: 8px;
}
.vol-desktop input[type="range"]{ width: 130px; accent-color: #fff; }
.vol-label{
    font-size: 12px;
    opacity: .75;
    min-width: 44px;
    text-align: center;
}

/* ✅ Source selector */
.source-wrap{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.source-label{
    font-size: 12px;
    font-weight: 700;
    opacity: .9;
    white-space: nowrap;
}
#sourceSelect.form-select{ min-width: 160px; max-width: 260px; }

/* ✅ Mobile: keep one row, and make select ~ 1/3 of bar */
@media (max-width: 575.98px){
    .player-controls{
        flex-wrap: nowrap;         /* ✅ never go 2 rows */
        gap: 6px;
        padding: 8px 10px;
    }
    .player-controls .left{ flex: 0 0 auto; gap: 6px; }
    .player-controls .right{
        flex: 1 1 auto;
        justify-content: flex-end;
        gap: 6px;
        min-width: 0;
    }

    .source-label{ display:none !important; }

    .source-wrap{
        flex: 0 0 33%;
        max-width: 33%;
        min-width: 0;
    }
    #sourceSelect.form-select{
        width: 100%;
        max-width: 100%;
        min-width: 0;
        font-size: 12px;
        padding-left: .6rem;
        padding-right: 1.6rem; /* space for arrow */
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }

    .vol-desktop{ display:none !important; }
    #btnVolMobile{ display:inline-flex !important; }
}
@media (min-width: 576px){
    #btnVolMobile{ display:none !important; }
}

/* ✅ Mobile Volume Popover */
.vol-pop{
    position: absolute;
    z-index: 9999; /* ✅ above iframe */
    bottom: calc(var(--controls-h) + 10px);
    background: rgba(0,0,0,.35);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 10px;
    width: 230px;
    box-shadow: 0 12px 34px rgba(0,0,0,.35);
    display: none;
    pointer-events: auto; /* ✅ */
}
.vol-pop.show{ display: block; }
.vol-pop .row1{
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.vol-pop .row1 .lbl{
    font-size: 12px;
    opacity: .9;
    white-space: nowrap;
}
.vol-pop input[type="range"]{
    width: 100%;
    accent-color: #fff;
    pointer-events: auto; /* ✅ */
}
[dir="rtl"] .vol-pop{ right: 12px; left: auto; }
[dir="ltr"] .vol-pop{ left: 12px; right: auto; }
@media (min-width: 576px){ .vol-pop{ display:none !important; } }
/* ✅ Submenu toggle row: same look in RTL/LTR */
#mobileSidebar .nav-item-submenu > .mobile-sub-toggle{
    width: 100% !important;
    padding: .65rem .85rem !important;
    border-radius: .6rem !important;
    line-height: 1.2 !important;
    background: transparent !important;   /* ✅ جلوگیری از اون هایلایت بد */
}

/* hover like other items */
#mobileSidebar .nav-item-submenu > .mobile-sub-toggle:hover{
    background: rgba(255,255,255,.08) !important;
}

/* when expanded, highlight exactly like FA */
#mobileSidebar .nav-item-submenu > .mobile-sub-toggle[aria-expanded="true"]{
    background: rgba(255,255,255,.08) !important;
}

/* ✅ caret alignment (prevents bar “shift” in LTR) */
#mobileSidebar .mobile-sub-toggle{
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}
#mobileSidebar .mobile-sub-toggle .caret{
    flex: 0 0 auto !important;
}
/* ---------------- Desktop menu icon hover effect ---------------- */
@media (min-width: 1200px){
    /* فقط آیکون‌ها: i و svg */
    .navbar .navbar-nav-link i,
    .navbar .navbar-nav-link svg{
        transition: transform .18s ease, filter .18s ease, opacity .18s ease;
        transform-origin: center;
        will-change: transform, filter;
    }

    /* وقتی روی لینک منو هاور شد */
    .navbar .navbar-nav-link:hover i,
    .navbar .navbar-nav-link:hover svg{
        animation: navIconWiggle .6s ease-in-out infinite;
        transform: translateZ(0) scale(1.08);
        filter: drop-shadow(0 6px 12px rgba(0,0,0,.35));
        opacity: 1;
    }

    /* اگر آیتم active بود هم یکم افکت ثابت داشته باشه (اختیاری) */
    .navbar .navbar-nav-link.active i,
    .navbar .navbar-nav-link.active svg{
        filter: drop-shadow(0 6px 14px rgba(0,0,0,.35));
    }
}

/* Wiggle animation */
@keyframes navIconWiggle{
    0%   { transform: translateX(0) rotate(0) scale(1.08); }
    20%  { transform: translateX(-1px) rotate(-6deg) scale(1.08); }
    40%  { transform: translateX(1px) rotate(6deg) scale(1.08); }
    60%  { transform: translateX(-1px) rotate(-4deg) scale(1.08); }
    80%  { transform: translateX(1px) rotate(4deg) scale(1.08); }
    100% { transform: translateX(0) rotate(0) scale(1.08); }
}

/* احترام به کاربرانی که motion رو غیرفعال کردن */
@media (prefers-reduced-motion: reduce){
    .navbar .navbar-nav-link:hover i,
    .navbar .navbar-nav-link:hover svg{
        animation: none !important;
        transform: none !important;
    }
}
/* ---------------- Club logo hover effect (desktop) ---------------- */
@media (min-width: 992px){
    /* لوگوی تیم‌ها */
    .list-group-item img{
        transition: transform .2s ease, filter .2s ease;
        transform-origin: center;
        will-change: transform;
    }

    /* هاور روی کل ردیف → فقط لوگو بلرزه */
    .list-group-item:hover img{
        animation: clubLogoWiggle .45s ease-in-out 1;
        transform: scale(1.1);
        filter: drop-shadow(0 8px 18px rgba(0,0,0,.4));
    }
}

/* Wiggle animation مخصوص لوگو */
@keyframes clubLogoWiggle{
    0%   { transform: scale(1.1) rotate(0); }
    20%  { transform: scale(1.1) rotate(-8deg); }
    40%  { transform: scale(1.1) rotate(8deg); }
    60%  { transform: scale(1.1) rotate(-6deg); }
    80%  { transform: scale(1.1) rotate(6deg); }
    100% { transform: scale(1.1) rotate(0); }
}

/* احترام به prefers-reduced-motion */
@media (prefers-reduced-motion: reduce){
    .list-group-item:hover img{
        animation: none !important;
        transform: none !important;
        filter: none !important;
    }
}
/* ---------------- Lists: max height + inner scroll ---------------- */
:root{
    --lists-max-h: 570px;   /* ✅ مقدار دلخواه */
}

/* کانتینر تب‌ها */
#liveList, #upcomingList{
    max-height: var(--lists-max-h);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px; /* برای اینکه اسکرول روی محتوا نیفته */
}

/* اگر در موبایل قبلاً با calc ست کردی، همون رو override نکنیم */
@media (max-width: 991.98px){
    #liveList, #upcomingList{
        max-height: none; /* موبایل همون calc فعلی خودت */
    }
}
.site-footer{
    width: 100%;
    display: flex;
    justify-content: center;   /* مرکز افقی کل محتوا */
    align-items: center;
    padding: 20px 0;
}

.footer-center{
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
    text-align: center;
}

/* ستون‌ها فقط به اندازه محتوا */
.footer-col{
    flex: 0 0 auto;
}

.footer-title{
    font-weight: 700;
    margin-bottom: 10px;
}

.footer-list{
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-list a{
    white-space: nowrap;
    text-decoration: none;
}

/* موبایل */
@media (max-width: 576px){
    .footer-center{
        gap: 24px;
    }

    .footer-list a{
        white-space: normal; /* متن کامل دیده شود */
    }
}
