/* assets/css/custom.css */

:root{
    --page-bg: none;
    --page-bg-url: ""; /* ✅ اگر نمیخوای بک‌گراند: "" */
    --controls-h: 56px;
    --lists-max-h: 570px;

    /* ✅ Watermark sizing/spacing */
    --wm-size: 55px;     /* height of watermark image */
    --wm-pad: 12px;      /* distance from edges */
    --wm-opacity: .85;   /* overall opacity */

    /* ✅ Watermark "glass blur" (ONLY behind watermark) */
    --wm-glass-bg: rgba(10, 12, 16, .16);     /* خیلی کم */
    --wm-glass-border: rgba(255,255,255,.08);
    --wm-glass-blur: 12px;
    --wm-glass-bg: rgba(10, 12, 16, .22);  
    --wm-glass-radius: 14px;
    --wm-glass-padding: 8px;                  /* فضای اطراف لوگو */
}

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;
}

/* --------- Layout (no header/footer, only list + player) ---------- */
.page-content{ min-height: 100vh; }
.content.container{ padding-top: 18px; padding-bottom: 18px; }
@media (max-width: 991.98px){
    .content.container{ padding-top: 12px; padding-bottom: 12px; }
}

/* ---------------- Sport selector (dropdown) ---------------- */
.sport-select{
    min-width: 160px;
    max-width: 220px;
}
@media (max-width: 575.98px){
    .sport-select{ min-width: 140px; max-width: 170px; }
}

/* ---------------- 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;
    }
}

/* ---------------- Lists: max height + inner scroll ---------------- */
#liveList, #upcomingList{
    max-height: var(--lists-max-h);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
}
@media (max-width: 991.98px){
    #liveList, #upcomingList{ max-height: none; }
}

/* ----- 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; }

/* ✅ keep controls visible in fullscreen */
.player-wrap:fullscreen .player-controls,
.player-wrap:-webkit-full-screen .player-controls{
    display: flex !important;
    position: absolute;
    left: 0; right: 0; bottom: 0;
    border-radius: 0;
    z-index: 9999;
}

/* 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; } }

/* ---------------- ✅ Watermark overlay (glass blur ONLY behind watermark) ---------------- */
.player-watermark{
    position: absolute;
    z-index: 9998; /* below controls(9999), above iframe */
    pointer-events: none;
    user-select: none;
    opacity: var(--wm-opacity);
}

/* ✅ blur layer behind watermark ONLY */
.player-watermark::before{
    content: "";
    position: absolute;
    inset: calc(-1 * var(--wm-glass-padding));
    background: var(--wm-glass-bg);
    border: 1px solid var(--wm-glass-border);
    border-radius: var(--wm-glass-radius);
    backdrop-filter: blur(var(--wm-glass-blur));
    -webkit-backdrop-filter: blur(var(--wm-glass-blur));
    box-shadow: 0 10px 28px rgba(0,0,0,.25);
}

/* watermark image on top of blur layer */
.player-watermark img{
    position: relative;
    z-index: 1;
    height: var(--wm-size);
    width: auto;
    display: block;
    transform: translateZ(0);
    filter: drop-shadow(0 6px 16px rgba(0,0,0,.55));
}

/* always LTR -> bottom-right (above controls) */
.player-watermark.wm-right{
    right: var(--wm-pad);
    bottom: calc(var(--controls-h) + var(--wm-pad));
}

/* optional */
.player-watermark.wm-left{
    left: var(--wm-pad);
    bottom: calc(var(--controls-h) + var(--wm-pad));
}

/* In fullscreen keep watermark position correct too */
.player-wrap:fullscreen .player-watermark,
.player-wrap:-webkit-full-screen .player-watermark{
    z-index: 9998;
}

/* ✅ watermark animation: every few seconds */
.player-watermark img{
    animation: wmPulse 8s ease-in-out infinite;
    transform-origin: 85% 85%;
    will-change: transform, opacity, filter;
}

/* 8s loop: mostly idle, short pulse near the end */
@keyframes wmPulse{
    0%, 78%{
        transform: translateZ(0) scale(1) rotate(0deg);
        opacity: 1;
    }
    82%{
        transform: translateZ(0) scale(1.08) rotate(-2deg);
    }
    86%{
        transform: translateZ(0) scale(1.06) rotate(2deg);
    }
    90%{
        transform: translateZ(0) scale(1.03) rotate(-1deg);
    }
    92%, 100%{
        transform: translateZ(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce){
    .player-watermark img{ animation: none !important; }
}

/* ---------------- Player controls (footer under video) ---------------- */
.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(74 78 78);
    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;
}
#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;
        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-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;
        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;
    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; } }

/* 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));
    }
}
@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); }
}
@media (prefers-reduced-motion: reduce){
    .list-group-item:hover img{
        animation: none !important;
        transform: none !important;
        filter: none !important;
    }
}

/* ✅ Pseudo fullscreen (works inside iframe even if real fullscreen is blocked) */
.pseudo-fs-active{
    overflow: hidden !important;
}

.player-wrap.pseudo-fullscreen{
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 2147483647 !important;
}

.player-wrap.pseudo-fullscreen .player-frame{
    height: calc(100vh - var(--controls-h)) !important;
}

.player-wrap.pseudo-fullscreen .player-controls{
    display: flex !important;
    position: absolute !important;
    left: 0; right: 0; bottom: 0;
    border-radius: 0 !important;
    z-index: 9999 !important;
}

/* watermark stays correct */
.player-wrap.pseudo-fullscreen .player-watermark{
    z-index: 9998 !important;
}

:root{
    --accent: rgb(168 131 51);
    --accent-rgb: 168, 131, 51;
}

/* size like your old select */
.sport-ui{ min-width: 160px; max-width: 220px; }
@media (max-width: 575.98px){
    .sport-ui{ min-width: 140px; max-width: 170px; }
}

.sport-ui-btn{
    background: #2a2a2a;
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
}
.sport-ui-btn:focus{
    box-shadow: 0 0 0 .20rem rgba(var(--accent-rgb), .25) !important;
    border-color: var(--accent) !important;
}

/* dropdown menu */
.sport-ui-menu{
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,.10);
    padding: 6px;
}

/* items */
.sport-ui-menu .dropdown-item{
    color: #ddd;
    border-radius: 10px;
    padding: 8px 10px;
}

/* ✅ this is the "blue background" replacement */
.sport-ui-menu .dropdown-item:hover,
.sport-ui-menu .dropdown-item:focus{
    background: var(--accent) !important;
    color: #000 !important;
}

/* selected item */
.sport-ui-menu .dropdown-item.active{
    background: var(--accent) !important;
    color: #000 !important;
}

/* ---- Fix dropdown being clipped under iframe / inside cards (mobile) ---- */
@media (max-width: 991.98px){

  /* اجازه بده dropdown از کارت بیرون بزنه */
  .matches-card{
    overflow: visible !important;     /* ✅ مهم */
    position: relative;
    z-index: 10050;                   /* بالاتر از iframe */
  }

  /* همچنان اسکرول داخل بدنه کارت حفظ بشه */
  .matches-card .card-body{
    overflow: hidden;                 /* همون چیزی که قبلاً داشتی */
  }

  /* خود dropdown و منو بالاتر باشن */
  .sport-ui{
    position: relative;
    z-index: 10060;
  }
  .sport-ui .dropdown-menu{
    z-index: 10070;
  }
}
