/* ============================================
   TV TUBE - Стили для онлайн-телевидения
   Версия 2.0
   ============================================ */

/* ---------- Базовые сбросы ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- Основной контейнер ---------- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0c12;
    color: #eef2ff;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Главная сетка ---------- */
.tv-layout {
    display: grid;
    grid-template-columns: 300px 340px 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at 20% 30%, #131725, #080b12);
}

/* ---------- Карточки секций ---------- */
.tv-card {
    background: rgba(18, 22, 35, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    border: 1px solid rgba(79, 91, 147, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 45px -12px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.tv-card:hover {
    box-shadow: 0 30px 50px -15px rgba(0, 0, 0, 0.5);
    border-color: rgba(99, 102, 241, 0.4);
}

/* ---------- Левая колонка: каталог каналов ---------- */
.tv-catalog {
    grid-column: 1 / 2;
}

/* ---------- Центральная колонка: гид передач ---------- */
.tv-guide {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ---------- Правая колонка: экран просмотра ---------- */
.tv-viewer {
    grid-column: 3 / 4;
    background: #000000;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ---------- Шапка каталога ---------- */
.tv-catalog__header {
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    background: linear-gradient(135deg, rgba(30, 35, 55, 0.95), rgba(20, 24, 42, 0.95));
    border-bottom: 1px solid rgba(79, 91, 147, 0.3);
    flex-shrink: 0;
}

.tv-emblem {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.tv-emblem__link {
    display: inline-block;
}

.tv-emblem__image {
    width: 130px;
    height: auto;
    transition: opacity 0.2s;
}

.tv-emblem__image:hover {
    opacity: 0.85;
}

/* ---------- Поиск и фильтры ---------- */
.tv-search {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.tv-search__field,
.tv-search__dropdown {
    padding: 0.75rem 1rem;
    background: rgba(10, 12, 20, 0.8);
    border: 1px solid rgba(79, 91, 147, 0.4);
    border-radius: 16px;
    font-size: 0.85rem;
    color: #eef2ff;
    transition: all 0.2s;
}

.tv-search__field:focus,
.tv-search__dropdown:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(15, 18, 30, 0.95);
}

.tv-search__field::placeholder {
    color: #6b7280;
}

.tv-search__dropdown option {
    background: #0a0c12;
}

.tv-search__counter {
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.25rem;
    background: rgba(79, 91, 147, 0.2);
    border-radius: 20px;
    display: none;
}

/* ---------- Список каналов ---------- */
.tv-catalog__list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 0;
}

.tv-station {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 20px;
    text-decoration: none;
    color: #eef2ff;
    transition: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    margin-bottom: 6px;
    background: rgba(15, 18, 30, 0.4);
    border: 1px solid transparent;
}

.tv-station:hover {
    background: rgba(35, 40, 60, 0.7);
    border-color: rgba(99, 102, 241, 0.3);
}

.tv-station--live {
    background: linear-gradient(95deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.08));
    border-left: 3px solid #6366f1;
}

.tv-station__avatar {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(145deg, #1e1f2e, #131520);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tv-station__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv-station__info {
    flex: 1;
    overflow: hidden;
}

.tv-station__title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.tv-station__current {
    font-size: 0.7rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 5px;
}

.tv-station--live .tv-station__current {
    color: #818cf8;
}

/* ---------- Подвал каталога ---------- */
.tv-catalog__footer {
    padding: 1rem;
    background: rgba(10, 12, 20, 0.7);
    border-top: 1px solid rgba(79, 91, 147, 0.25);
    text-align: center;
    flex-shrink: 0;
}

.tv-contact p {
    margin: 0.3rem 0;
    font-size: 0.7rem;
    color: #9ca3af;
}

.tv-contact a {
    color: #818cf8;
    text-decoration: none;
}

.tv-contact a:hover {
    text-decoration: underline;
    color: #a5b4fc;
}

/* ---------- Шапка гида передач ---------- */
.tv-guide__head {
    padding: 1.25rem;
    background: linear-gradient(115deg, rgba(30, 35, 55, 0.95), rgba(20, 24, 42, 0.95));
    text-align: center;
    border-bottom: 1px solid rgba(79, 91, 147, 0.3);
    flex-shrink: 0;
}

.tv-guide__title {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #eef2ff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---------- Список передач ---------- */
.tv-guide__list {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
    min-height: 0;
}

.tv-guide__list--compact {
    flex: 1;
    overflow-y: auto;
}

.tv-guide__list--compact .tv-guide__empty {
    padding: 2rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

.tv-schedule {
    padding: 12px;
    border-bottom: 1px solid rgba(79, 91, 147, 0.2);
    transition: all 0.2s;
    cursor: default;
    border-radius: 16px;
    margin-bottom: 2px;
}

.tv-schedule:hover {
    background: rgba(35, 40, 60, 0.5);
}

.tv-schedule--now {
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid #6366f1;
    margin-left: -3px;
}

.tv-schedule--past {
    opacity: 0.5;
}

.tv-schedule__time {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-bottom: 5px;
}

.tv-schedule--now .tv-schedule__time::before {
    content: "● ";
    color: #22c55e;
    font-size: 0.7rem;
}

.tv-schedule--past .tv-schedule__time::before {
    content: "✓ ";
    color: #22c55e;
    font-size: 0.7rem;
}

.tv-schedule__name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.tv-schedule__description {
    font-size: 0.7rem;
    color: #9ca3af;
    line-height: 1.4;
}

.tv-guide__empty {
    padding: 2rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

.tv-guide__empty--info {
    padding: 1rem;
}

/* ---------- Копирайт в гиде ---------- */
.tv-copyright {
    padding: 0.8rem;
    border-top: 1px solid rgba(79, 91, 147, 0.25);
    background: rgba(10, 12, 20, 0.6);
    text-align: center;
    flex-shrink: 0;
}

.tv-copyright p {
    margin: 0.2rem 0;
    font-size: 0.65rem;
    color: #6b7280;
}

.tv-copyright p:first-child {
    color: #9ca3af;
    font-weight: 500;
}

.tv-copyright--mobile {
    display: none;
}

/* ---------- Экран просмотра ---------- */
.tv-viewer {
    display: flex;
    flex-direction: column;
}

.tv-viewer__stage {
    background: #000000;
    position: relative;
    padding-top: 56.25%;
    flex-shrink: 0;
}

.tv-viewer__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

.tv-viewer__info {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.tv-viewer__heading {
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
    background: linear-gradient(115deg, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tv-viewer__description {
    font-size: 0.85rem;
    color: #b9c3d4;
    line-height: 1.55;
}

/* ---------- Приветственная страница ---------- */
.tv-welcome {
    padding: 2rem;
    color: #ffffff;
    overflow-y: auto;
    height: 100%;
}

.tv-welcome__title {
    font-size: 1.7rem;
    margin-bottom: 1rem;
    font-weight: 700;
    background: linear-gradient(115deg, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tv-welcome__text {
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0.85;
    margin-bottom: 2rem;
}

.tv-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.tv-feature {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    padding: 1rem;
    border-radius: 20px;
    text-align: center;
    transition: all 0.2s;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.tv-feature:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: #6366f1;
}

.tv-feature__icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.tv-feature__title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: #fff;
}

.tv-feature__text {
    font-size: 0.7rem;
    opacity: 0.75;
}

.tv-start {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 1rem;
    text-align: center;
    margin-top: 1rem;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.tv-start p {
    font-size: 0.85rem;
    margin: 0;
}

/* ---------- Скроллбары ---------- */
.tv-catalog__list::-webkit-scrollbar,
.tv-guide__list::-webkit-scrollbar {
    width: 5px;
}

.tv-catalog__list::-webkit-scrollbar-track,
.tv-guide__list::-webkit-scrollbar-track {
    background: rgba(30, 35, 55, 0.5);
    border-radius: 4px;
}

.tv-catalog__list::-webkit-scrollbar-thumb,
.tv-guide__list::-webkit-scrollbar-thumb {
    background: #4f5b93;
    border-radius: 4px;
}

.tv-catalog__list::-webkit-scrollbar-thumb:hover,
.tv-guide__list::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

/* ---------- Адаптивность ---------- */
@media (max-width: 1100px) {
    .tv-layout {
        grid-template-columns: 270px 300px 1fr;
        gap: 1rem;
    }
}

@media (max-width: 880px) {
    body {
        height: auto;
        overflow: auto;
    }
    
    .tv-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
        height: auto;
        overflow: visible;
    }
    
    .tv-card {
        height: auto;
    }
    
    .tv-viewer {
        grid-column: 1;
        order: 1;
        min-height: 500px;
    }
    
    .tv-guide {
        grid-column: 1;
        order: 2;
        max-height: 60vh;
    }
    
    .tv-catalog {
        grid-column: 1;
        order: 3;
        max-height: 75vh;
    }
    
    .tv-guide__list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .tv-guide__list--compact {
        flex: 0 0 auto;
    }
    
    .tv-catalog__list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }
    
    .tv-copyright--desktop {
        display: none;
    }
    
    .tv-copyright--mobile {
        display: block;
        margin-top: 0.8rem;
        padding-top: 0.8rem;
        border-top: 1px solid rgba(79, 91, 147, 0.3);
    }
    
    .tv-station__avatar {
        width: 52px;
        height: 52px;
        border-radius: 16px;
    }
    
    .tv-welcome__title {
        font-size: 1.4rem;
    }
    
    .tv-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
}

@media (max-width: 520px) {
    .tv-layout {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .tv-viewer {
        min-height: 380px;
    }
    
    .tv-guide,
    .tv-catalog {
        max-height: 75vh;
    }
    
    .tv-station__avatar {
        width: 45px;
        height: 45px;
        border-radius: 14px;
    }
    
    .tv-station__title {
        font-size: 0.8rem;
    }
    
    .tv-station__current {
        font-size: 0.6rem;
    }
    
    .tv-schedule__name {
        font-size: 0.8rem;
    }
    
    .tv-welcome {
        padding: 1rem;
    }
    
    .tv-welcome__title {
        font-size: 1.2rem;
    }
    
    .tv-features {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .tv-feature {
        padding: 0.75rem;
    }
    
    .tv-feature__icon {
        font-size: 1.4rem;
    }
}