/* ==========================================================================
   LiveTV Stylesheet - CSS/liveTV-style.css
   ========================================================================== */

:root {
    --bg-dark: #0f1015;
    --bg-surface: #181920;
    --bg-card: #20222b;
    --accent: #ff385c;
    --accent-glow: rgba(255, 56, 92, 0.4);
    --gold: #ffb703;
    --text-main: #f8f9fa;
    --text-muted: #8d93a5;
    --border-line: #2a2d39;
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition: all 0.25s ease;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.livetv-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
    transition: var(--transition);
}

.livetv-grid.theatre-mode {
    grid-template-columns: 1fr;
}

.livetv-grid.theatre-mode .channels-sidebar {
    display: none;
}

/* پلیر ویدیو */
.player-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.video-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-line);
}

.video-box video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* وضعیت‌های لودینگ و خطا */
.player-overlay-state {
    position: absolute;
    inset: 0;
    background: rgba(15, 16, 21, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    text-align: center;
    padding: 20px;
}

.player-overlay-state.active {
    display: flex;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border-line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* قفل VIP */
.vip-lock {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(20,15,10,0.95), rgba(10,10,15,0.95));
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    text-align: center;
    padding: 30px;
}

.vip-lock.active {
    display: flex;
}

.vip-lock i.fa-crown {
    font-size: 54px;
    color: var(--gold);
    margin-bottom: 16px;
    filter: drop-shadow(0 0 15px rgba(255, 183, 3, 0.5));
}

.vip-lock h2 {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.vip-lock p {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 400px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-gold {
    background: linear-gradient(45deg, #ffb703, #fb8500);
    color: #000;
    font-weight: 800;
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-gold:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(251, 133, 0, 0.4);
}

/* پنل اطلاعات و ابزار پلیر */
.player-info-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.channel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.channel-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.channel-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-line);
    overflow: hidden;
    font-weight: 800;
}

.channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-tag {
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-tb {
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-tb:hover {
    background: #2a2d3d;
    border-color: #3b3f54;
}

.btn-tb.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.select-quality {
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    outline: none;
    font-size: 12px;
    cursor: pointer;
}

/* جدول پخش EPG */
.epg-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    border: 1px solid rgba(255,255,255,0.03);
}

.epg-sub {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.epg-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-timeline {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.epg-bar-inner {
    width: 60%;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
}

.epg-next-box {
    border-right: 1px solid var(--border-line);
    padding-right: 16px;
}

/* سایدبار لیست کانال‌ها */
.channels-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    max-height: 850px;
    position: sticky;
    top: 90px;
}

.search-wrapper {
    padding: 16px 16px 12px;
    position: relative;
}

.search-wrapper input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-md);
    padding: 10px 38px 10px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.search-wrapper input:focus {
    border-color: var(--accent);
}

.search-wrapper i {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.cat-bar {
    display: flex;
    gap: 6px;
    padding: 0 16px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-line);
}

.cat-bar::-webkit-scrollbar {
    display: none;
}

.cat-chip {
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.cat-chip:hover, .cat-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.channel-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.channel-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.channel-list-scroll::-webkit-scrollbar-thumb {
    background: var(--border-line);
    border-radius: 3px;
}

.ch-card {
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    border-radius: var(--radius-md);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition);
}

.ch-card:hover {
    background: #252834;
    border-color: #3b3f54;
    transform: translateX(-3px);
}

.ch-card.active {
    background: rgba(255, 56, 92, 0.12);
    border-color: var(--accent);
}

.ch-left-side {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ch-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-line);
}

.ch-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ch-title-main {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.ch-tags {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tag-category {
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.tag-vip-badge {
    font-size: 10px;
    font-weight: 800;
    color: #000;
    background: var(--gold);
    padding: 1px 5px;
    border-radius: 3px;
}

.btn-star-fav {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
    transition: var(--transition);
}

.btn-star-fav:hover, .btn-star-fav.active {
    color: var(--gold);
}

/* اعلان‌ها (Toast) */
.toast-msg {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(15px);
    transition: var(--transition);
    pointer-events: none;
    z-index: 999;
}

.toast-msg.show {
    opacity: 1;
    transform: translateY(0);
}

/* ریسپانسیو */
@media (max-width: 1024px) {
    .livetv-grid {
        grid-template-columns: 1fr;
    }
    .channels-sidebar {
        height: 500px;
        position: static;
    }
}
