/* ============================================================
   🎨 فیلمیار — استایل اختصاصی روی Bootstrap 5 RTL
   پالت: جنگل سبز + کرم گرم + طلایی (همان پالت نسخهٔ Next.js)
   ============================================================ */

:root {
    --forest-950: #081711;
    --forest-900: #0f2b20;
    --forest-800: #15382a;
    --forest-700: #1d4a37;
    --forest-600: #2a5e48;
    --forest-500: #3a755c;
    --forest-100: #dcebe2;
    --cream-50: #faf8f1;
    --cream-100: #f3efe3;
    --cream-200: #eae4d2;
    --cream-300: #ded6bf;
    --ink-900: #1d2b24;
    --ink-700: #33443a;
    --ink-500: #5b6b60;
    --gold-400: #e3b558;
    --gold-500: #d9a441;
}

body {
    font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    background: var(--cream-100);
    color: var(--ink-900);
    min-height: 100vh;
}

/* ارقام فارسی با فاصلهٔ یکنواخت */
.nums { font-variant-numeric: tabular-nums; unicode-bidi: plaintext; }
.min-w-0 { min-width: 0; }

/* ─── اسکرول‌بار نازک ─── */
.scrollbar-thin { scrollbar-width: thin; scrollbar-color: #b9c4ba transparent; }
.scrollbar-thin::-webkit-scrollbar { height: 6px; width: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #c8d2c8; border-radius: 9999px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: #a8b6aa; }

/* ═══════════════ سایدبار ═══════════════ */
.side-nav {
    position: fixed;
    inset-block: 0;
    right: 0;
    width: 260px;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem 1rem;
    background: linear-gradient(180deg, var(--forest-900) 0%, var(--forest-950) 100%);
    color: var(--cream-50);
}
.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--cream-50);
    text-decoration: none;
    padding: .25rem .5rem;
}
.brand:hover { color: #fff; }
.brand-sm { font-size: 1rem; color: var(--ink-900); }
.nav-list { display: flex; flex-direction: column; gap: .25rem; }
.side-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .9rem;
    border-radius: .9rem;
    color: rgba(250, 248, 241, .72);
    text-decoration: none;
    font-weight: 600;
    font-size: .92rem;
    border-right: 3px solid transparent;
    transition: background .2s, color .2s;
    position: relative;
}
.side-link:hover { background: rgba(250, 248, 241, .08); color: #fff; }
.side-link.active {
    background: rgba(250, 248, 241, .12);
    color: #fff;
    border-right-color: var(--gold-500);
}
.side-link .badge-nums {
    position: absolute;
    left: .75rem;
    background: var(--gold-500);
    color: var(--forest-950);
    font-size: .68rem;
    font-weight: 800;
    min-width: 1.35rem;
    text-align: center;
    border-radius: 999px;
    padding: .1rem .35rem;
}
.side-note {
    font-size: .72rem;
    line-height: 1.9;
    color: rgba(250, 248, 241, .55);
    background: rgba(250, 248, 241, .06);
    border-radius: 1rem;
    padding: .8rem;
    margin: 0;
}
.fy-offcanvas { background: linear-gradient(180deg, var(--forest-900), var(--forest-950)); color: var(--cream-50); width: 280px; }
.fy-offcanvas .offcanvas-header { border-bottom: 1px solid rgba(250,248,241,.1); }

/* فاصلهٔ محتوای اصلی از سایدبار */
@media (min-width: 992px) {
    .app-main { margin-right: 260px; }
}
.app-main { min-height: 100vh; display: flex; flex-direction: column; }

/* ═══════════════ نوار بالا ═══════════════ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(243, 239, 227, .88);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--cream-300);
    padding: .65rem 1rem;
}
.btn-forest {
    background: var(--forest-800);
    color: var(--cream-50);
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: .8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.btn-forest:hover { background: var(--forest-700); color: #fff; }
.search-wrap { position: relative; max-width: 560px; }
.search-icon {
    position: absolute;
    right: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-500);
    pointer-events: none;
}
.search-input {
    border-radius: .8rem;
    border: 1px solid var(--cream-300);
    background: var(--cream-50);
    padding-right: 2.4rem;
    height: 40px;
    font-size: .88rem;
}
.search-input:focus {
    border-color: var(--forest-500);
    box-shadow: 0 0 0 .2rem rgba(58, 117, 92, .15);
    background: #fff;
}
.search-drop {
    position: absolute;
    top: calc(100% + .4rem);
    right: 0;
    width: min(420px, 90vw);
    background: #fff;
    border: 1px solid var(--cream-300);
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(8, 23, 17, .18);
    overflow: hidden;
    z-index: 1050;
    max-height: 330px;
    overflow-y: auto;
}
.search-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .8rem;
    cursor: pointer;
    border-bottom: 1px solid var(--cream-100);
}
.search-item:last-child { border-bottom: 0; }
.search-item:hover, .search-item.active { background: var(--cream-100); }
.search-item img { width: 42px; height: 60px; object-fit: cover; border-radius: .5rem; }
.search-item .t { font-weight: 700; font-size: .88rem; margin: 0; }
.search-item .s { font-size: .74rem; color: var(--ink-500); margin: 0; }
.search-empty { padding: .9rem; text-align: center; color: var(--ink-500); font-size: .84rem; margin: 0; }

/* ═══════════════ کاروسل هیرو ═══════════════ */
.hero { box-shadow: 0 10px 30px rgba(8, 23, 17, .12); }
.hero-img { aspect-ratio: 16/7; min-height: 300px; max-height: 430px; width: 100%; object-fit: cover; }
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to left, rgba(8, 23, 17, .92) 0%, rgba(8, 23, 17, .45) 50%, rgba(8, 23, 17, .05) 100%);
}
.hero-caption {
    right: 4%;
    left: auto;
    bottom: 9%;
    max-width: min(560px, 80%);
    text-align: right !important;
}
.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--gold-500);
    color: var(--forest-950);
    font-size: .72rem;
    font-weight: 800;
    border-radius: 999px;
    padding: .25rem .7rem;
    margin-bottom: .6rem;
}
.hero-title { font-size: clamp(1.5rem, 3.4vw, 2.6rem); font-weight: 900; color: #fff; margin-bottom: .3rem; }
.hero-tagline { color: rgba(250, 248, 241, .85); font-size: clamp(.8rem, 1.4vw, 1rem); margin-bottom: .7rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.hero-meta .chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: rgba(250, 248, 241, .14);
    border: 1px solid rgba(250, 248, 241, .22);
    color: #fff;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    padding: .22rem .65rem;
    backdrop-filter: blur(4px);
}
.hero-meta .star { color: var(--gold-400); }
.hero-meta .trophy { color: var(--gold-400); }
.btn-gold {
    background: var(--gold-500);
    border: 0;
    color: var(--forest-950);
    font-weight: 800;
    font-size: .88rem;
    border-radius: 999px;
    padding: .5rem 1.25rem;
}
.btn-gold:hover { background: var(--gold-400); color: var(--forest-950); }
.btn-outline-cream {
    border: 1px solid rgba(250, 248, 241, .45);
    color: #fff;
    border-radius: 999px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-outline-cream:hover { background: rgba(250, 248, 241, .15); color: #fff; }
.hero-arrow {
    width: 42px;
    opacity: .85;
    filter: none;
}
.hero-arrow .bi { font-size: 1.4rem; color: #fff; }
.hero-dots { margin-bottom: .4rem; }
.hero-dots [data-bs-target] {
    width: 9px; height: 9px;
    border-radius: 999px;
    border: 0;
    background: rgba(250, 248, 241, .45);
    transition: all .3s;
}
.hero-dots [data-bs-target].active { width: 26px; background: var(--gold-500); }

/* ═══════════════ ردیف فیلم‌ها ═══════════════ */
.row-title { font-size: 1.05rem; font-weight: 900; color: var(--ink-900); }
.see-all {
    color: var(--forest-600);
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
}
.see-all:hover { color: var(--forest-800); text-decoration: underline; }
.filmyar-row { display: flex; gap: 1rem; overflow-x: auto; padding: .25rem .1rem .6rem; }

.card-movie {
    position: relative;
    min-width: 168px;
    max-width: 168px;
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    background: var(--forest-900);
    transition: transform .25s, box-shadow .25s;
    border: 0;
    padding: 0;
    text-align: start;
}
.card-movie:hover { transform: translateY(-6px); box-shadow: 0 12px 24px rgba(8, 23, 17, .25); }
.card-movie.is-selected { outline: 3px solid var(--gold-500); outline-offset: 2px; }
.card-movie:focus-visible { outline: 3px solid var(--forest-500); outline-offset: 2px; }
.card-movie img { aspect-ratio: 2/3; width: 100%; object-fit: cover; display: block; }
.card-movie .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8,23,17,0) 40%, rgba(8,23,17,.94) 100%);
}
.rate-chip {
    position: absolute;
    top: .55rem;
    right: .55rem;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: rgba(8, 23, 17, .72);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: .2rem .5rem;
}
.rate-chip .bi { color: var(--gold-400); font-size: .68rem; }
.bk-btn {
    position: absolute;
    top: .5rem;
    left: .5rem;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: rgba(8, 23, 17, .72);
    color: rgba(250, 248, 241, .85);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    transition: background .2s, color .2s, transform .2s;
}
.bk-btn:hover { background: var(--gold-500); color: var(--forest-950); transform: scale(1.1); }
.bk-btn.active { background: var(--gold-500); color: var(--forest-950); }
.card-info { position: absolute; inset-inline: 0; bottom: 0; padding: .65rem .75rem; color: #fff; }
.card-title { font-size: .86rem; font-weight: 800; margin: 0 0 .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { font-size: .7rem; color: rgba(250, 248, 241, .75); margin: 0; display: flex; gap: .35rem; align-items: center; }

/* ═══════════════ دسته‌بندی‌ها ═══════════════ */
.cat-card {
    position: relative;
    min-width: 190px;
    height: 110px;
    border: 0;
    border-radius: 1.1rem;
    overflow: hidden;
    padding: 0;
    background: var(--forest-900);
    transition: transform .25s, box-shadow .25s;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 10px 22px rgba(8, 23, 17, .22); }
.cat-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(8,23,17,.85), rgba(8,23,17,.15)); }
.cat-label {
    position: absolute;
    inset-inline: 0;
    bottom: .6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    color: #fff;
    font-weight: 800;
    font-size: .9rem;
}
.cat-label .bi { color: var(--gold-400); }

/* ═══════════════ پنل جزئیات ═══════════════ */
.panel-sticky { position: sticky; top: 84px; }
@media (max-width: 991.98px) { .panel-sticky { position: static; } }
.detail-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(222, 214, 191, .8);
    background: rgba(250, 248, 241, .88);
    backdrop-filter: blur(4px);
    border-radius: 1.5rem;
    padding: 1.25rem;
    box-shadow: 0 6px 24px rgba(8, 23, 17, .07);
}
.wm { position: absolute; color: rgba(42, 94, 72, .10); pointer-events: none; }
.wm-tower { bottom: -1rem; left: .5rem; height: 75%; width: auto; }
.wm-reel { top: 46%; left: 1.5rem; width: 96px; height: 96px; transform: rotate(-12deg); }
.panel-poster {
    width: 104px;
    height: 140px;
    object-fit: cover;
    border-radius: .8rem;
    box-shadow: 0 6px 14px rgba(8, 23, 17, .25);
    flex-shrink: 0;
}
.panel-title { font-size: 1.15rem; font-weight: 900; color: var(--ink-900); margin: 0; }
.panel-star { display: flex; align-items: center; gap: .4rem; font-weight: 800; font-size: .95rem; color: var(--ink-700); }
.panel-star .bi { color: var(--gold-500); }
.panel-genres { font-size: .78rem; color: var(--ink-500); }
.panel-awards { display: flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; color: var(--forest-700); }
.panel-awards .bi { color: var(--gold-500); }
.art-badge {
    align-self: flex-start;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--forest-700);
    color: var(--forest-700);
    border-radius: 999px;
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .08em;
    flex-shrink: 0;
}

/* 🎯 باکس درصد تطابق */
.match-box {
    border: 1px solid var(--forest-100);
    background: rgba(220, 235, 226, .4);
    border-radius: 1rem;
    padding: .75rem .9rem;
}
.match-label { display: flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 800; color: var(--forest-800); }
.match-label .bi { color: var(--forest-600); }
.match-value { font-size: 1rem; font-weight: 900; color: var(--forest-700); }
.match-bar {
    height: .5rem;
    border-radius: 999px;
    background: rgba(15, 43, 32, .10);
    overflow: hidden;
}
.match-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(to left, var(--forest-600), var(--gold-500));
    transition: width .9s ease;
}

/* 💬 باکس «چرا این پیشنهاد شد؟» */
.reason-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: .75rem;
    padding: .45rem .35rem;
    font-size: .9rem;
    font-weight: 900;
    color: var(--ink-900);
    text-align: right;
    transition: background .2s;
}
.reason-toggle:hover { background: var(--cream-100); }
.reason-toggle .bi-stars { color: var(--forest-600); }
.reason-toggle .chev { color: var(--ink-500); transition: transform .3s; }
.reason-toggle[aria-expanded="false"] .chev { transform: rotate(180deg); }
.reason-box { background: rgba(220, 235, 226, .6); border-radius: 1rem; padding: .9rem 1rem; }
.reason-text { font-size: .8rem; line-height: 2; color: var(--ink-700); transition: opacity .25s; }
.reason-text.fading { opacity: 0; }
.match-loading { display: inline-flex; align-items: center; gap: .5rem; font-size: .76rem; color: var(--forest-700); }
.match-loading .spinner-border { color: var(--forest-600); }

/* 📖 درباره + 🎞 جزئیات */
.section-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    font-weight: 900;
    color: var(--ink-900);
    margin-bottom: .6rem;
}
.section-title .bi { color: var(--forest-600); }
.section-title .gold { color: var(--gold-500); }
.about-text { font-size: .8rem; line-height: 2.1; color: var(--ink-700); }
.detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    border-bottom: 1px solid var(--cream-200);
    padding: .5rem 0;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row dt { flex-shrink: 0; font-size: .74rem; font-weight: 700; color: var(--ink-500); }
.detail-row dd { margin: 0; text-align: left; font-size: .74rem; font-weight: 600; line-height: 1.9; color: var(--ink-900); }

/* ═══════════════ حالت‌های خاص ═══════════════ */
.notice-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: rgba(220, 235, 226, .7);
    color: var(--forest-800);
    font-size: .84rem;
    font-weight: 700;
    border-radius: 1rem;
    padding: .7rem 1rem;
    margin-bottom: 1.25rem;
}
.empty-state {
    text-align: center;
    border: 2px dashed var(--cream-300);
    border-radius: 1.5rem;
    background: rgba(250, 248, 241, .6);
    padding: 3.5rem 1.5rem;
}
.empty-state .bi { font-size: 2.2rem; color: var(--forest-500); margin-bottom: .6rem; display: block; }

/* فوتر */
.fy-footer {
    background: var(--forest-900);
    color: var(--cream-50);
    padding: 1.1rem 1.5rem calc(1.1rem + env(safe-area-inset-bottom));
    font-size: .78rem;
}
.fy-note { color: rgba(250, 248, 241, .55); }

/* توست */
.fy-toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1080;
    background: var(--forest-900);
    color: var(--cream-50);
    padding: .7rem 1.1rem;
    border-radius: .9rem;
    font-size: .82rem;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(8, 23, 17, .35);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
    max-width: min(320px, 85vw);
}
.fy-toast.show { opacity: 1; transform: none; }
