/* ==========================================================================
   سالنیار نگار 3.0 - مانیتور هوشمند اعلام نوبت (Zero-Scroll Desktop & Mobile)
   ۶ تم اختصاصی حرفه‌ای - قفل‌شده روی تنظیمات مدیریت
   ========================================================================== */

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
}

/* ---------- تم ۱: مشکی و طلایی لوکس (obsidian-gold) ---------- */
[data-tv-theme="obsidian-gold"] {
    --tv-bg: radial-gradient(circle at top right, #231e2b 0%, #0d0b11 70%);
    --tv-surface: rgba(28, 24, 36, 0.92);
    --tv-item: rgba(45, 39, 56, 0.85);
    --tv-border: rgba(212, 175, 55, 0.28);
    --tv-accent: #d4af37;
    --tv-accent-2: #f5d77f;
    --tv-text: #f9f6ee;
    --tv-muted: #aba3b5;
}

/* ---------- تم ۲: زمردی کلینیکی شیشه‌ای (emerald-glass) ---------- */
[data-tv-theme="emerald-glass"] {
    --tv-bg: linear-gradient(135deg, #062825 0%, #0b3b36 55%, #041c1a 100%);
    --tv-surface: rgba(12, 54, 49, 0.78);
    --tv-item: rgba(20, 78, 71, 0.65);
    --tv-border: rgba(45, 212, 191, 0.28);
    --tv-accent: #2dd4bf;
    --tv-accent-2: #99f6e4;
    --tv-text: #f0fdfa;
    --tv-muted: #99c4be;
}

/* ---------- تم ۳: رزگلد سالن زیبایی (rose-editorial) ---------- */
[data-tv-theme="rose-editorial"] {
    --tv-bg: linear-gradient(135deg, #2b1820 0%, #1a0f14 100%);
    --tv-surface: rgba(46, 26, 35, 0.88);
    --tv-item: rgba(68, 39, 51, 0.78);
    --tv-border: rgba(232, 165, 178, 0.3);
    --tv-accent: #e598a6;
    --tv-accent-2: #fbd3dc;
    --tv-text: #fff7f9;
    --tv-muted: #c9a7b0;
}

/* ---------- تم ۴: عاجی مینیمال روشن (ivory-minimal) ---------- */
[data-tv-theme="ivory-minimal"] {
    --tv-bg: linear-gradient(180deg, #faf7f5 0%, #f1eae6 100%);
    --tv-surface: #ffffff;
    --tv-item: #f7f2ef;
    --tv-border: #e5d8d1;
    --tv-accent: #a65d6a;
    --tv-accent-2: #7d3e49;
    --tv-text: #23191d;
    --tv-muted: #706066;
}

/* ---------- تم ۵: بنفش اسپا (royal-violet) ---------- */
[data-tv-theme="royal-violet"] {
    --tv-bg: radial-gradient(circle at bottom left, #2c1654 0%, #110824 75%);
    --tv-surface: rgba(38, 20, 71, 0.85);
    --tv-item: rgba(59, 32, 107, 0.72);
    --tv-border: rgba(192, 132, 252, 0.3);
    --tv-accent: #c084fc;
    --tv-accent-2: #e9d5ff;
    --tv-text: #faf5ff;
    --tv-muted: #bda8d6;
}

/* ---------- تم ۶: سرمه‌ای کلینیک پرکنتراست (midnight-neon) ---------- */
[data-tv-theme="midnight-neon"] {
    --tv-bg: linear-gradient(145deg, #071326 0%, #0d2142 60%, #050d1c 100%);
    --tv-surface: rgba(13, 33, 66, 0.86);
    --tv-item: rgba(22, 50, 96, 0.78);
    --tv-border: rgba(56, 189, 248, 0.32);
    --tv-accent: #38bdf8;
    --tv-accent-2: #7dd3fc;
    --tv-text: #f0f9ff;
    --tv-muted: #93b4d4;
}

.tv-viewport {
    width: 100%;
    height: 100dvh;
    background: var(--tv-bg);
    color: var(--tv-text);
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: clamp(.6rem, 1.5vw, 1.35rem);
    gap: clamp(.55rem, 1.2vw, 1rem);
    overflow: hidden;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(.55rem, 1vw, .9rem) clamp(.8rem, 1.5vw, 1.3rem);
    background: var(--tv-surface);
    border: 1px solid var(--tv-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
}

.tv-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.tv-brand h1 {
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.75rem);
    line-height: 1.2;
}
.tv-live-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: clamp(.68rem, .9vw, .85rem);
    padding: .22rem .65rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    font-weight: 700;
}
[data-tv-theme="ivory-minimal"] .tv-live-pill { color: #15803d; }

.tv-pulse {
    width: 8px; height: 8px; border-radius: 50%; background: currentColor;
    animation: tvPulse 1.4s infinite;
}
@keyframes tvPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(1.4); }
}

.tv-clock-box { text-align: left; }
.tv-clock {
    font-size: clamp(1.35rem, 2.8vw, 2.4rem);
    font-weight: 900;
    color: var(--tv-accent);
    line-height: 1;
}
.tv-date {
    font-size: clamp(.72rem, 1vw, .95rem);
    color: var(--tv-muted);
    margin-top: .2rem;
}

/* Stage Grid - Fit 100% of remaining viewport without scrolling */
.tv-stage {
    min-height: 0;
    display: grid;
    gap: clamp(.6rem, 1.2vw, 1.1rem);
    overflow: hidden;
}
.tv-stage.cols-2 { grid-template-columns: 1.15fr 1fr; }
.tv-stage.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tv-panel {
    background: var(--tv-surface);
    border: 1px solid var(--tv-border);
    border-radius: 18px;
    padding: clamp(.65rem, 1.2vw, 1.15rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    backdrop-filter: blur(10px);
}
.tv-panel.highlight {
    border-color: var(--tv-accent);
    box-shadow: 0 0 0 1px var(--tv-accent), 0 14px 36px rgba(0,0,0,.22);
}

.tv-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: .55rem;
    margin-bottom: .6rem;
    border-bottom: 1px solid var(--tv-border);
    flex-shrink: 0;
}
.tv-panel-head h2 {
    margin: 0;
    font-size: clamp(.92rem, 1.45vw, 1.32rem);
    color: var(--tv-accent);
}
.tv-count {
    font-size: clamp(.72rem, .95vw, .88rem);
    padding: .18rem .6rem;
    border-radius: 999px;
    background: var(--tv-item);
    color: var(--tv-text);
    font-weight: 700;
}

.tv-list {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(.4rem, .8vw, .7rem);
    overflow: hidden;
}

.tv-item {
    background: var(--tv-item);
    border: 1px solid var(--tv-border);
    border-radius: 14px;
    padding: clamp(.45rem, .9vw, .85rem) clamp(.65rem, 1.2vw, 1.1rem);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .6rem;
    min-height: 0;
    overflow: hidden;
}
.tv-item-client {
    font-size: clamp(.92rem, 1.55vw, 1.42rem);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-item-sub {
    font-size: clamp(.72rem, 1vw, .96rem);
    color: var(--tv-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-item-time {
    font-size: clamp(1rem, 1.75vw, 1.65rem);
    font-weight: 900;
    color: var(--tv-accent);
    flex-shrink: 0;
    background: rgba(0,0,0,.15);
    padding: .25rem .65rem;
    border-radius: 10px;
}
[data-tv-theme="ivory-minimal"] .tv-item-time { background: rgba(166, 93, 106, .12); }

.tv-banner-panel {
    position: relative;
    padding: 0;
    overflow: hidden;
}
.tv-banner-panel img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.tv-banner-caption {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.82) 0%, transparent 65%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.4rem;
    color: #fff;
}

.tv-footer-ticker {
    background: var(--tv-accent);
    color: #111;
    border-radius: 12px;
    padding: .48rem .9rem;
    font-weight: 800;
    font-size: clamp(.78rem, 1.05vw, 1rem);
    overflow: hidden;
    white-space: nowrap;
}
[data-tv-theme="ivory-minimal"] .tv-footer-ticker,
[data-tv-theme="rose-editorial"] .tv-footer-ticker { color: #fff; }
.tv-ticker-track {
    display: inline-block;
    padding-left: 100%;
    animation: tvScroll 28s linear infinite;
}
@keyframes tvScroll {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Mobile Zero-Scroll Optimization: Stack neatly inside 100dvh */
@media (max-width: 820px) {
    .tv-stage.cols-2,
    .tv-stage.cols-3 {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
    .tv-banner-panel { display: none; }
    .tv-stage.cols-2.with-banner {
        grid-template-rows: 1fr;
    }
}
