/* 深色主题全局样式 */
:root {
    --bg-primary: #0f0f13;
    --bg-secondary: #1a1a24;
    --bg-card: #22222e;
    --bg-hover: #2a2a3a;
    --text-primary: #e8e8ed;
    --text-secondary: #9898a8;
    --accent: #6c5ce7;
    --accent-hover: #7f70f0;
    --border: #2e2e3e;
    --error: #ff6b6b;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* 顶部导航 */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 主容器 */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* 工具栏：搜索 + 排序 */
.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    opacity: 0.5;
}

.sort-select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    outline: none;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* 视频网格 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.video-card a {
    color: inherit;
    text-decoration: none;
}

.thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-secondary);
    overflow: hidden;
}

.thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.3;
}

.play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.video-card:hover .play-icon {
    opacity: 1;
}

.play-icon span {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}

.card-info {
    padding: 14px 16px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: center;
}

.pagination a {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.pagination a:hover {
    background: var(--bg-hover);
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* 播放页 */
.player-page .container {
    max-width: 960px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--text-primary);
}

.player-wrap {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.player-wrap video {
    width: 100%;
    display: block;
    max-height: 70vh;
}

.video-info {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    border: 1px solid var(--border);
}

.video-info h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.info-row {
    display: flex;
    gap: 24px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.resume-hint {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(108, 92, 231, 0.15);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--accent-hover);
    display: none;
}

/* 登录页 */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1030 100%);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 16px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
}

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(255, 107, 107, 0.15);
    color: var(--error);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

/* 响应式 */
@media (max-width: 640px) {
    .container {
        padding: 16px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
    }
}
