/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: #1a73e8;
}

a:hover {
    text-decoration: underline;
}

/* ===== 头部 ===== */
.site-header {
    background: #1a73e8;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo a {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.main-nav a {
    color: white;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.main-nav a:hover {
    border-bottom-color: white;
    text-decoration: none;
}

.main-nav a.active {
    border-bottom-color: white;
}

/* ===== 页脚 ===== */
.site-footer {
    background: #333;
    color: #aaa;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* ===== 表单容器（登录/注册/上传） ===== */
.auth-container,
.upload-container {
    max-width: 500px;
    margin: 3rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.auth-container h2,
.upload-container h2 {
    margin-bottom: 1.5rem;
    color: #1a73e8;
    text-align: center;
}

/* ===== 选项卡 ===== */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.75rem;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #1a73e8;
    border-bottom: 2px solid #1a73e8;
    font-weight: 600;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* ===== 表单组 ===== */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #1a73e8;
}

/* ===== 验证码输入组 ===== */
.code-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.code-input-wrapper input {
    flex: 1;
}

/* ===== 按钮 ===== */
.btn-secondary {
    padding: 0.75rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-secondary:disabled {
    background: #aaa;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-primary:disabled {
    background: #aaa;
    cursor: not-allowed;
}

/* ===== 链接 ===== */
.auth-links {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-links a {
    color: #1a73e8;
}

/* ===== 提示框 ===== */
.alert {
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===== 帮助文本 ===== */
.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

/* ===== 单选组 ===== */
.radio-group {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: normal;
    cursor: pointer;
}

/* ===== 视频网格（首页/个人主页） ===== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.video-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-cover {
    position: relative;
    aspect-ratio: 16/9;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-cover {
    color: #999;
    font-size: 0.9rem;
}

.series-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.video-title {
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-meta {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.85rem;
    color: #666;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
}

.pagination a.active {
    background: #1a73e8;
    color: white;
    border-color: #1a73e8;
}

/* ===== 上传页面分集配置 ===== */
.episode-item {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.episode-item label {
    min-width: 60px;
}

.episode-item input {
    flex: 1;
    min-width: 150px;
}

.episode-item .file-name {
    color: #666;
    font-size: 0.9rem;
    word-break: break-all;
}

.remove-episode {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
}

/* ===== 个人主页 ===== */
.profile-container {
    max-width: 1000px;
    margin: 2rem auto;
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.profile-avatar {
    text-align: center;
}

.profile-avatar img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1a73e8;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    margin: 0 0 1rem 0;
    font-size: 28px;
}

.profile-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    font-size: 16px;
    color: #555;
}

.profile-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== 视频播放页 ===== */
.video-player-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.video-main {
    flex: 3;
    min-width: 300px;
}

.dplayer {
    width: 100%;
    aspect-ratio: 16/9;
}

.episode-sidebar {
    flex: 1;
    min-width: 200px;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.episode-sidebar h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
}

.episode-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.episode-list li {
    margin-bottom: 8px;
}

.episode-list a {
    display: block;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.episode-list a:hover {
    background: #e9ecef;
    text-decoration: none;
}

.episode-list a.active {
    background: #1a73e8;
    color: white;
}

.video-info {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
}

.video-info .video-title {
    font-size: 24px;
    margin: 0 0 10px 0;
    padding: 0;
}

.video-meta {
    display: flex;
    gap: 20px;
    color: #666;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.video-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    color: #555;
    flex-wrap: wrap;
}

.video-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== 后台管理 ===== */
.admin-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 2rem;
    color: #1a73e8;
    margin-bottom: 0.5rem;
}

.admin-nav {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.admin-nav a {
    padding: 0.75rem 1.5rem;
    background: #1a73e8;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.admin-nav a:hover {
    background: #1557b0;
    text-decoration: none;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background: #f8f9fa;
}

.action-btn {
    padding: 0.25rem 0.5rem;
    margin-right: 0.25rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: black;
}

.btn-success {
    background: #28a745;
    color: white;
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
}

.status-1 {
    background: #d4edda;
    color: #155724;
}

.status-0 {
    background: #f8d7da;
    color: #721c24;
}

.role-badge {
    background: #cce5ff;
    color: #004085;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    .main-nav ul {
        justify-content: center;
    }
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-stats {
        justify-content: center;
    }
    .video-player-container {
        flex-direction: column;
    }
    .episode-sidebar {
        max-height: 300px;
    }
    .admin-table {
        display: block;
        overflow-x: auto;
    }
}