/* ============================================
   AV1Kino Public Styles
   Видеобалансер — публичная часть
   ============================================ */

/* === Сброс и базовые стили === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === CSS-переменные === */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --dark: #111827;
    --dark-light: #1f2937;
    --light: #f9fafb;
    --light-dark: #f3f4f6;
    
    --text: #374151;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    
    --border: #e5e7eb;
    --border-dark: #d1d5db;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

/* === Базовые стили === */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--light);
    min-height: 100vh;
}

/* === Типографика === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark);
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

code {
    background: var(--light-dark);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
    color: var(--dark);
}

/* === Header === */
header {
    background: #fff;
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
}

header h1 a {
    color: var(--dark);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header h1 a:hover {
    color: var(--primary);
}

header nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

header nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
    position: relative;
}

header nav a:hover {
    color: var(--primary);
}

header nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

header nav a:hover::after {
    width: 100%;
}

/* === Main контейнер === */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============================================
   Видеотека (Главная страница)
   ============================================ */
.video-library {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.video-library h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* === Сетка видео (YouTube/Rutube стиль) === */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* === Карточка видео === */
.video-card {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-slow);
    display: block;
}

.video-card:hover {
    transform: translateY(-4px);
}

.video-card__thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--dark-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.video-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.video-card:hover .video-card__thumbnail img {
    transform: scale(1.05);
}

.video-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(4px);
}

.video-card__info {
    padding: 0 0.25rem;
}

.video-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card__meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================
   Страница фильма/сериала
   ============================================ */
.movie-page {
    position: relative;
    min-height: 100vh;
    padding: 2rem;
}

/* Backdrop (фон) */
.movie-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 500px;
    background-size: cover;
    background-position: center top;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.movie-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, var(--light) 100%);
}

/* Контейнер фильма */
.movie-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* Постер */
.movie-poster {
    position: relative;
}

.movie-poster img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    aspect-ratio: 2/3;
    object-fit: cover;
    background: var(--dark-light);
}

/* Информация о фильме */
.movie-info {
    min-width: 0; /* Для корректной работы text-overflow */
}

.movie-info h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    line-height: 1.2;
}

.movie-info .original-title {
    color: var(--text-light);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Метаданные */
.movie-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
}

.meta-item.rating {
    color: #f59e0b;
    font-weight: 700;
}

/* Жанры */
.movie-genres {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.genre-badge {
    background: var(--light-dark);
    color: var(--text);
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.genre-badge:hover {
    background: var(--primary);
    color: #fff;
}

/* Кнопка "Смотреть" */
.movie-actions {
    margin: 2rem 0;
}

.btn-watch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 600;
    transition: var(--transition-slow);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    border: none;
    cursor: pointer;
}

.btn-watch:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    color: #fff;
}

.btn-watch:active {
    transform: translateY(0);
}

/* Бейджи качества */
.quality-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.quality-badge {
    background: var(--success);
    color: #fff;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ограничение доступа */
.movie-restricted {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    color: #991b1b;
    font-weight: 500;
}

/* Описание */
.movie-description {
    margin: 2rem 0;
    line-height: 1.8;
    color: var(--text);
}

.movie-description h3,
.movie-actors h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--dark);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Актёры */
.actors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.actor-card {
    text-align: center;
    transition: var(--transition);
}

.actor-card:hover {
    transform: translateY(-2px);
}

.actor-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    background: var(--dark-light);
}

.actor-placeholder {
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--light-dark);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.actor-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
    margin-bottom: 2px;
}

.actor-role {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
}

/* ============================================
   Плейлист сериала (Сезоны и Серии)
   ============================================ */
.series-playlist {
    margin-top: 2rem;
}

.series-playlist h3 {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.season-accordion {
    margin-bottom: 0.75rem;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.season-accordion:hover {
    box-shadow: var(--shadow);
}

.season-accordion summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    user-select: none;
}

.season-accordion summary::-webkit-details-marker {
    display: none;
}

.season-accordion summary:hover {
    background: var(--light-dark);
}

.season-accordion[open] summary {
    background: var(--light-dark);
    border-bottom: 1px solid var(--border);
}

/* Эпизод */
.episode-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    gap: 1rem;
    transition: var(--transition);
}

.episode-item:first-child {
    border-top: none;
}

.episode-item:hover {
    background: var(--light);
}

.episode-number {
    font-weight: 700;
    color: var(--primary);
    min-width: 30px;
    font-size: 1.1rem;
}

.episode-info {
    flex: 1;
    min-width: 0;
}

.episode-title {
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 2px;
}

.episode-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.episode-meta .hd-badge {
    color: var(--success);
    font-weight: 600;
}

/* ============================================
   Страница просмотра
   ============================================ */
.watch-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Обёртка плеера */
.player-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 2rem;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

/* Информация о контенте */
.content-info {
    max-width: 1200px;
    margin: 0 auto 2rem;
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

.content-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.content-info .original-title {
    color: var(--text-light);
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.content-info .meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.content-info .description {
    line-height: 1.8;
    color: var(--text);
}

/* Горячие клавиши */
.shortcuts-help {
    max-width: 1200px;
    margin: 2rem auto;
    background: #fff;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.shortcuts-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--dark);
    padding: 0.5rem 0;
    outline: none;
    list-style: none;
}

.shortcuts-help summary::-webkit-details-marker {
    display: none;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.shortcuts-grid kbd {
    display: inline-block;
    padding: 2px 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 0 var(--border);
    color: var(--dark);
    margin: 0 2px;
}

/* ============================================
   Каталог
   ============================================ */
.catalog-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.catalog-page h1 {
    margin-bottom: 1.5rem;
}

/* Фильтры */
.filters {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: end;
}

.filters input,
.filters select {
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    background: #fff;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filters input {
    flex: 1;
    min-width: 200px;
}

.filters button {
    padding: 0.625rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    font-family: inherit;
}

.filters button:hover {
    background: var(--primary-dark);
}

/* ============================================
   Кнопки
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    line-height: 1.4;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    color: #fff;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--text-light);
}

.btn-secondary:hover {
    background: var(--dark);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

/* ============================================
   Формы
   ============================================ */
form {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.625rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    transition: var(--transition);
    font-family: inherit;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    accent-color: var(--primary);
}

/* ============================================
   Таблицы
   ============================================ */
.table {
    width: 100%;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.table thead {
    background: var(--dark);
    color: #fff;
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
}

.table td {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.table tbody tr:hover {
    background: var(--light);
}

.table code {
    background: var(--light);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

/* ============================================
   Карточки
   ============================================ */
.card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition-slow);
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card img {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.card .title {
    padding: 1rem;
    font-weight: 600;
    color: var(--dark);
}

.card .year {
    padding: 0 1rem 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ============================================
   Статистика
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat span {
    display: block;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat strong {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
}

/* ============================================
   Уведомления (Alerts)
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-error {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #166534;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: var(--info);
    color: #1e40af;
}

/* ============================================
   Пагинация
   ============================================ */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.pagination a {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    font-weight: 500;
}

.pagination a:hover {
    background: var(--light);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================
   Определение списка (dl, dt, dd)
   ============================================ */
dl {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

dt {
    font-weight: 600;
    color: var(--dark);
    margin-top: 1rem;
}

dt:first-child {
    margin-top: 0;
}

dd {
    color: var(--text);
    margin-left: 0;
    margin-top: 0.25rem;
}

/* ============================================
   Предустановленные стили
   ============================================ */
pre {
    background: var(--dark);
    color: #e5e7eb;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.5;
    font-family: 'Courier New', monospace;
}

/* ============================================
   Утилитарные классы
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ============================================
   Заглушка для отсутствующих изображений
   ============================================ */
img[src=""],
img[src*="placeholder"] {
    background: linear-gradient(135deg, var(--dark-light) 0%, var(--dark) 100%);
}

/* Скрываем иконку "битой картинки" браузера */
img {
    image-rendering: auto;
}

/* ============================================
   Скроллбар
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark);
}

/* ============================================
   Адаптивность
   ============================================ */

/* Планшеты */
@media (max-width: 1024px) {
    .movie-container {
        grid-template-columns: 250px 1fr;
        gap: 2rem;
    }
    
    .movie-info h1 {
        font-size: 2rem;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.25rem;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    header nav {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    main {
        padding: 1rem;
    }
    
    .movie-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .movie-poster {
        max-width: 300px;
        margin: 0 auto;
    }
    
    .movie-info h1 {
        font-size: 1.75rem;
    }
    
    .movie-meta {
        gap: 1rem;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .video-card__title {
        font-size: 14px;
    }
    
    .video-card__meta {
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filters input {
        min-width: 100%;
    }
    
    .actors-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .content-info {
        padding: 1.5rem;
    }
    
    .content-info h1 {
        font-size: 1.5rem;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }
    
    .movie-info h1 {
        font-size: 1.5rem;
    }
    
    .btn-watch {
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat strong {
        font-size: 1.5rem;
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* Уменьшенное движение */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Фокус для клавиатурной навигации */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Высокая контрастность */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text: #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* ============================================
   Печать
   ============================================ */
@media print {
    header,
    .player-wrapper,
    .shortcuts-help,
    .btn,
    .pagination {
        display: none !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
    
    .movie-container {
        box-shadow: none;
        page-break-inside: avoid;
    }
}


/* ============================================
   Страница просмотра с плейлистом (ИСПРАВЛЕНО)
   ============================================ */
.watch-page-container {
    padding: 1.5rem;
}

/* По умолчанию: одна колонка на всю доступную ширину (для фильмов) */
.watch-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 1.5rem;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

/* 🆕 Если есть плейлист (добавлен класс has-playlist), делаем две колонки */
.watch-grid.has-playlist {
    grid-template-columns: 1fr 380px;
}

.watch-main {
    min-width: 0;
    width: 100%;
}

/* Центрирование контента, если это фильм (нет плейлиста) */
.watch-grid.single-column .watch-main {
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Стили плейлиста (без изменений) --- */
.watch-playlist {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.watch-playlist::-webkit-scrollbar { width: 6px; }
.watch-playlist::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.season-accordion {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: #fff;
}

.season-accordion[open] { border-color: var(--primary-light); }

.season-accordion summary {
    padding: 0.875rem 1rem;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    transition: background 0.2s;
}

.season-accordion summary::-webkit-details-marker { display: none; }
.season-accordion summary:hover { background: #f3f4f6; }

.season-accordion[open] summary {
    background: #eff6ff;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}

.ep-count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-light);
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 12px;
}

.season-accordion[open] .ep-count {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.episode-list { display: flex; flex-direction: column; }

.episode-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    gap: 0.75rem;
}

.episode-item:last-child { border-bottom: none; }
.episode-item:hover { background: #f9fafb; }

.episode-item.active {
    background: #eff6ff;
    border-left: 3px solid var(--primary);
}

.ep-number {
    font-weight: 700;
    color: var(--primary);
    min-width: 24px;
    font-size: 0.95rem;
}

.ep-info { flex: 1; min-width: 0; }

.ep-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.episode-item.active .ep-title {
    color: var(--primary);
    font-weight: 600;
}

.ep-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.hd-badge {
    background: #059669;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

.playing-indicator {
    color: var(--primary);
    font-size: 1.2rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Адаптивность для мобильных устройств --- */
@media (max-width: 900px) {
    .watch-grid.has-playlist {
        grid-template-columns: 1fr; /* На мобильных всегда одна колонка */
    }
    
    .watch-playlist {
        max-height: none;
        position: static;
        margin-top: 1rem;
    }
    
    .watch-page-container {
        padding: 1rem;
    }
}