/* ===== YouTube Watch Page Style - С полной поддержкой тем ===== */

/* Основная структура */
.main-container {
    margin-left: var(--yt-sidebar-width);
    margin-top: var(--yt-header-height);
    transition: margin-left 0.2s, background-color 0.3s ease;
    background: var(--yt-bg-primary);
    min-height: calc(100vh - var(--yt-header-height));
}

.main-container.expanded {
    margin-left: var(--yt-sidebar-collapsed);
}

/* Контейнер для страницы просмотра */
.watch-container {
    display: flex;
    max-width: 100%;
    padding: 24px;
    gap: 24px;
}

/* Основная колонка (плеер + информация) */
.watch-primary {
    flex: 1;
    min-width: 0;
    max-width: 1280px;
}

/* Вторичная колонка (рекомендации) */
.watch-secondary {
    width: 402px;
    flex-shrink: 0;
}

/* Плеер */
.player-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}

.player-frame {
    width: 100%;
    min-height: 480px;
    border: none;
    display: block;
}

/* Информация о видео */
.video-info-container {
    background: var(--yt-bg-primary);
    padding: 16px 0;
    transition: background-color 0.3s ease;
}

.video-title h1 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--yt-text-primary);
    margin: 0 0 8px 0;
    transition: color 0.3s ease;
}

.original-title {
    color: var(--yt-text-secondary);
    font-weight: 400;
    transition: color 0.3s ease;
}

/* Статистика видео */
.video-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    color: var(--yt-text-secondary);
    font-size: 14px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-icon {
    font-size: 16px;
}

/* Действия с видео */
.video-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--yt-border);
    transition: border-color 0.3s ease;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--yt-bg-secondary);
    border: none;
    border-radius: 18px;
    color: var(--yt-text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--yt-bg-hover);
}

.action-icon {
    font-size: 16px;
}

/* Описание */
.description-container {
    margin-bottom: 24px;
    line-height: 1.6;
    font-size: 14px;
}

.description-preview {
    color: var(--yt-text-primary);
    display: block;
    transition: color 0.3s ease;
}

.description-full {
    color: var(--yt-text-primary);
    transition: color 0.3s ease;
}

.show-more-btn {
    background: none;
    border: none;
    color: var(--yt-text-secondary);
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-top: 8px;
    font-size: 14px;
    transition: color 0.2s;
}

.show-more-btn:hover {
    color: var(--yt-text-primary);
}

/* Сетка информации */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 12px;
    color: var(--yt-text-secondary);
    transition: color 0.3s ease;
}

.info-value {
    font-size: 14px;
    color: var(--yt-text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Секции (озвучка, торренты) */
.section-container {
    background: var(--yt-bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    transition: background-color 0.3s ease;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--yt-text-primary);
    margin: 0 0 16px 0;
    transition: color 0.3s ease;
}

/* Переключатель озвучки */
.voice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.voice-btn {
    padding: 8px 16px;
    border: 2px solid var(--yt-border);
    background: var(--yt-bg-primary);
    color: var(--yt-text-primary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.voice-btn.active,
.voice-btn:hover {
    border-color: var(--yt-accent);
    background: var(--yt-accent);
    color: white;
}

.voice-info {
    display: none;
}

.voice-info.active {
    display: block;
}

/* Торренты */
.torrent-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--yt-border);
    padding-bottom: 8px;
    transition: border-color 0.3s ease;
}

.torrent-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--yt-text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
}

.torrent-tab.active,
.torrent-tab:hover {
    color: var(--yt-text-primary);
    background: var(--yt-bg-hover);
}

.torrent-content {
    display: none;
}

.torrent-content.active {
    display: block;
}

.torrent-quality-section {
    margin-bottom: 24px;
}

.quality-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--yt-text-primary);
    margin: 0 0 12px 0;
    transition: color 0.3s ease;
}

.torrent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.torrent-card {
    background: var(--yt-bg-primary);
    border: 1px solid var(--yt-border);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.torrent-card:hover {
    border-color: var(--yt-accent);
}

.torrent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.torrent-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--yt-text-primary);
    flex: 1;
    margin-right: 12px;
    transition: color 0.3s ease;
}

.torrent-size {
    font-size: 12px;
    color: var(--yt-text-secondary);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.torrent-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--yt-text-secondary);
}

.torrent-type {
    display: flex;
    align-items: center;
    gap: 4px;
}

.torrent-type.public {
    color: #4CAF50;
}

.torrent-type.private {
    color: #FF9800;
}

.torrent-stats {
    display: flex;
    gap: 8px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tech-info {
    font-size: 11px;
    color: var(--yt-text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
    background: var(--yt-bg-secondary);
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.torrent-actions {
    display: flex;
    gap: 8px;
}

.magnet-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.download-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
}

.no-torrents {
    color: var(--yt-text-secondary);
    font-style: italic;
    text-align: center;
    padding: 24px;
    transition: color 0.3s ease;
}

/* Рекомендации */
.recommendations-container {
    background: var(--yt-bg-primary);
    transition: background-color 0.3s ease;
}

.recommendations-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--yt-text-primary);
    margin: 0 0 16px 0;
    transition: color 0.3s ease;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommendation-item {
    display: flex;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}

.recommendation-item:hover {
    background: var(--yt-bg-secondary);
}

.recommendation-link {
    display: flex;
    gap: 8px;
    text-decoration: none;
    width: 100%;
}

.recommendation-thumbnail {
    width: 168px;
    height: 94px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: var(--yt-spec-10-percent-layer);
    transition: background-color 0.3s ease;
}

.recommendation-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recommendation-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.recommendation-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 4px 0;
    color: var(--yt-spec-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 40px;
    transition: color 0.3s ease;
}

.recommendation-channel {
    font-size: 12px;
    color: var(--yt-spec-text-secondary);
    transition: color 0.3s ease;
}

.recommendation-views {
    font-size: 12px;
    color: var(--yt-spec-text-secondary);
    transition: color 0.3s ease;
}

.recommendation-episodes {
    font-size: 12px;
    color: var(--yt-spec-text-secondary);
    margin-top: 4px;
    transition: color 0.3s ease;
}

.recommendation-score {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    padding: 4px;
    text-align: center;
    font-weight: bold;
}

/* Voice активная секция */
.voice-section {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    background: var(--yt-bg-secondary);
    transition: background-color 0.3s ease;
}

.voice-main-info {
    display: flex;
    gap: 16px;
    padding: 16px;
}

.voice-poster-container {
    flex-shrink: 0;
    width: 150px;
    height: 225px;
    border-radius: 8px;
    overflow: hidden;
}

.voice-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voice-title-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voice-anime-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--yt-text-primary);
    margin: 0;
    transition: color 0.3s ease;
}

.voice-anime-original {
    font-size: 14px;
    color: var(--yt-text-secondary);
    margin: 0;
    transition: color 0.3s ease;
}

.voice-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.voice-detail-item {
    display: flex;
    font-size: 13px;
}

.voice-detail-label {
    color: var(--yt-text-secondary);
    min-width: 100px;
    transition: color 0.3s ease;
}

.voice-detail-value {
    color: var(--yt-text-primary);
    flex: 1;
    transition: color 0.3s ease;
}

/* Эпизоды */
.episodes-section {
    padding: 16px;
    border-top: 1px solid var(--yt-border);
    transition: border-color 0.3s ease;
}

.episodes-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--yt-text-primary);
    margin: 0 0 12px 0;
    transition: color 0.3s ease;
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.episode-btn {
    padding: 10px;
    background: var(--yt-bg-primary);
    border: 1px solid var(--yt-border);
    border-radius: 8px;
    color: var(--yt-text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.episode-btn:hover {
    background: var(--yt-bg-hover);
}

.episode-btn.active {
    background: var(--yt-accent);
    border-color: var(--yt-accent);
    color: white;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .watch-container {
        flex-direction: column;
    }
    
    .watch-secondary {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .watch-container {
        padding: 16px;
    }
    
    .player-frame {
        min-height: 200px;
    }
    
    .video-actions {
        flex-wrap: wrap;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .voice-main-info {
        flex-direction: column;
    }
    
    .voice-poster-container {
        width: 100%;
        height: 200px;
    }
}

@media (max-width: 640px) {
    .recommendation-thumbnail {
        width: 120px;
        height: 180px;
    }
    
    .voice-title-container {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .voice-main-info {
        flex-direction: column;
    }
    
    .voice-poster-container {
        width: 100%;
        height: 200px;
    }
}

/* Кастомный селект */
.custom-select-container {
    position: relative;
    display: inline-block;
}

.watch-status-select {
    display: none;
}

.select-selected {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--yt-bg-secondary);
    transition: all 0.2s ease;
}

.select-selected:hover {
    background: var(--yt-bg-hover);
}

.select-selected::after {
    content: '▼';
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

.select-selected.select-arrow-active::after {
    transform: rotate(180deg);
}

.select-items {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--yt-bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 99;
    min-width: 180px;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

body.light-theme .select-items {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.select-items div {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.select-items div:hover {
    background: var(--yt-bg-hover);
}

/* Активные кнопки лайк/дизлайк */
.action-btn.like-btn.active {
    background: #4caf50;
    color: white;
}

.action-btn.dislike-btn.active {
    background: #f44336;
    color: white;
}

/* Анимации для уведомлений */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Стили для рекомендаций */
.loading-recommendations {
    text-align: center;
    padding: 40px 20px;
    color: var(--yt-text-secondary);
    transition: color 0.3s ease;
}

.loading-spinner-small {
    width: 30px;
    height: 30px;
    border: 3px solid var(--yt-spec-10-percent-layer);
    border-top: 3px solid var(--yt-spec-brand-background-solid);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.no-recommendations {
    text-align: center;
    padding: 40px 20px;
    color: var(--yt-text-secondary);
    transition: color 0.3s ease;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Модальное окно для скачивания видео */
.download-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-out;
}

.download-modal-content {
    position: relative;
    background-color: var(--yt-bg-primary);
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
    transition: background-color 0.3s ease;
}

body.light-theme .download-modal-content {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.download-modal-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--yt-border);
    transition: border-color 0.3s ease;
}

.download-modal-icon {
    font-size: 32px;
    margin-right: 15px;
}

.download-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--yt-text-primary);
    margin: 0;
    transition: color 0.3s ease;
}

.download-modal-body {
    margin-bottom: 25px;
}

.download-modal-text {
    color: var(--yt-text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.download-steps {
    background: var(--yt-bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    transition: background-color 0.3s ease;
}

.download-step {
    display: flex;
    align-items: start;
    margin-bottom: 15px;
}

.download-step:last-child {
    margin-bottom: 0;
}

.step-number {
    background: #007bff;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

body.dark-theme .step-number {
    background: #0056b3;
}

.step-text {
    color: var(--yt-text-primary);
    line-height: 1.5;
    transition: color 0.3s ease;
}

.download-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.modal-btn-primary {
    background: #007bff;
    color: white;
}

.modal-btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: var(--yt-bg-secondary);
    color: var(--yt-text-primary);
    transition: all 0.2s;
}

.modal-btn-secondary:hover {
    background: var(--yt-bg-hover);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: var(--yt-text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--yt-bg-hover);
    color: var(--yt-text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .download-modal-content {
        margin: 20% auto;
        padding: 20px;
    }
    
    .download-modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        justify-content: center;
    }
}