/**
 * 影视资源页面样式
 */

/* ===== 页面容器 ===== */
.video-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    /* 覆盖主样式中的 grid 布局 */
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
}

/* ===== 页面头部 ===== */
.video-page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.video-page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.video-page-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== 搜索栏 ===== */
.video-search-box {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.video-search-form {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.video-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.video-search-input::placeholder {
    color: var(--text-secondary);
}

.video-search-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.video-search-btn:hover {
    transform: scale(1.05);
}

/* ===== 分类筛选 ===== */
.video-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.video-category-btn {
    padding: 0.6rem 1.5rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.video-category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.video-category-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    color: white;
}

/* ===== 影视列表 ===== */
.video-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    min-height: 400px;
}

/* 响应式：平板显示2列 */
@media (max-width: 992px) {
    .video-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 影视卡片 */
.video-card {
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.video-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.video-card-poster {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

.video-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-card:hover .video-card-poster img {
    transform: scale(1.15);
}

/* 播放按钮遮罩 */
.video-card-poster::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.video-card:hover .video-card-poster::before {
    opacity: 1;
}

/* 播放图标 */
.video-card-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.video-card-play-icon::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 16px solid var(--primary-color);
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    margin-left: 4px;
}

.video-card:hover .video-card-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.video-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 0.35rem 0.9rem;
    border-radius: 18px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
}

.video-card-info {
    padding: 1.1rem;
}

.video-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.video-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.video-card-type {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.7rem;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 500;
}

.video-card-year {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
}

.video-card-year svg {
    width: 14px;
    height: 14px;
}

/* 观看进度条（可选） */
.video-card-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
    z-index: 2;
}

/* 加载状态 */
.video-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: var(--text-secondary);
}

.video-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: video-spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes video-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.video-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 0;
    color: var(--text-secondary);
}

.video-empty svg {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    opacity: 0.2;
    animation: video-pulse 3s ease-in-out infinite;
}

@keyframes video-pulse {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.05); }
}

.video-empty p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0 1rem;
}

/* 错误状态 */
.video-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 0;
    color: var(--text-secondary);
}

.video-error svg {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    color: #e74c3c;
    opacity: 0.3;
}

.video-error p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0 0 1rem 0;
}

.video-error button {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-error button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* ===== 分页 ===== */
.video-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.video-pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.video-pagination button {
    padding: 0.6rem 1.2rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 40px;
}

.video-pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.video-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.video-pagination button.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.video-pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 0.5rem;
}

/* 跳转输入框 */
.video-pagination-jump {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.video-pagination-input {
    width: 60px;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: center;
    transition: var(--transition);
}

.video-pagination-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.video-pagination-go {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.video-pagination-go:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-primary);
}

/* ===== 弹窗 ===== */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: video-fadeIn 0.3s ease;
}

.video-modal.active {
    display: flex;
}

@keyframes video-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.video-modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: video-slideUp 0.3s ease;
}

@keyframes video-slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.video-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: var(--transition);
}

.video-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.video-modal-body {
    padding: 2rem;
}

/* 详情页内容包装器 - 左右布局 */
.video-detail-content-wrapper {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* 播放器侧 */
.video-player-side {
    flex: 0 0 auto;
    min-width: 480px;
    max-width: 640px;
}

/* 信息侧 */
.video-info-side {
    flex: 1;
    min-width: 0;
}

/* 详情页样式 */
.video-detail-poster {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.video-detail-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.video-detail-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.video-detail-info span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.85rem;
}

.video-detail-desc {
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary-color);
    max-height: 200px;
    overflow-y: auto;
}

/* 播放列表 */
.video-playlist {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.video-playlist-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.video-playlist-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.video-playlist-tab {
    padding: 0.6rem 1.2rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.video-playlist-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.video-playlist-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.video-episodes {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.6rem;
}

.video-episodes.active {
    display: grid;
}

.video-episode-btn {
    padding: 0.6rem 0.8rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.video-episode-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

/* 播放器 */
.video-player-wrapper {
    margin-top: 2rem;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}

.video-player-wrapper iframe,
.video-player-wrapper video {
    width: 100%;
    height: 450px;
    display: block;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .video-container {
        padding: 1rem;
    }

    .video-page-title {
        font-size: 1.8rem;
    }

    .video-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .video-card-poster {
        height: 200px;
    }

    .video-modal-content {
        margin: 1rem;
    }

    .video-modal-body {
        padding: 1rem;
    }

    /* 移动端详情页垂直布局 */
    .video-detail-content-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .video-player-side {
        min-width: 100%;
        max-width: 100%;
    }

    .video-info-side {
        min-width: 100%;
    }

    .video-detail-poster {
        max-height: 150px;
    }

    .video-detail-title {
        font-size: 1.2rem;
    }

    .video-detail-desc {
        max-height: 120px;
    }

    .video-player-wrapper iframe,
    .video-player-wrapper video {
        height: 250px;
    }

    .video-episodes {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
}

/* 确保视频页面在所有设备上都是单列布局 */
.video-container .sidebar {
    display: none !important;
}

.video-container {
    grid-template-columns: 1fr !important;
}

/* 隐藏悬浮搜索按钮 */
.video-container ~ .floating-search,
.video-container + .floating-search,
.video-page-header + .floating-search {
    display: none !important;
}

/* ===== API 未配置提示框 ===== */
.video-setup-tip {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--primary-light);
    border: 2px dashed rgba(245, 158, 11, 0.4);
    border-radius: var(--radius-xl);
    margin-bottom: 2rem;
}

.video-setup-tip h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.video-setup-tip p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.7;
}

.video-setup-tip strong {
    color: var(--primary-color);
}

/* ===== 暗色模式适配 ===== */
[data-theme="dark"] .video-search-form {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .video-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .video-card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .video-playlist-tab {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .video-playlist-tab:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .video-episode-btn {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .video-episode-btn:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .video-setup-tip {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .video-setup-tip h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .video-setup-tip p {
    color: var(--text-secondary);
}

[data-theme="dark"] .video-setup-tip strong {
    color: var(--primary-color);
}

[data-theme="dark"] .video-modal {
    background: rgba(0, 0, 0, 0.92);
}

[data-theme="dark"] .video-modal-close {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .video-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .video-detail-desc {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .video-playlist {
    background: var(--bg-tertiary);
}
