/* 前端主要样式 */

/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff0000;
    --secondary-color: #282828;
    --background-color: #0f0f0f;
    --text-color: #ffffff;
    --text-secondary: #aaa;
    --accent-color: #3ea6ff;
    --success-color: #00d26a;
    --warning-color: #ffa500;
    --error-color: #ff4757;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Roboto', 'Noto Sans', Arial, sans-serif;
    line-height: 1.6;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-color);
}

/* 布局样式 */
.main-container {
    display: flex;
    min-height: calc(100vh - 56px);
}

.sidebar {
    width: 240px;
    background: var(--secondary-color);
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px);
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.3s ease;
}

.content-area {
    margin-left: 240px;
    padding: 20px;
    width: calc(100% - 240px);
    min-height: calc(100vh - 56px);
}

/* 侧边栏样式 */
.sidebar-menu {
    list-style: none;
    padding: 12px 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.3s;
    font-size: 14px;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: #383838;
}

.sidebar-link .icon {
    margin-right: 16px;
    font-size: 18px;
}

.sidebar-divider {
    height: 1px;
    background: #383838;
    margin: 12px 0;
}

.sidebar-title {
    padding: 8px 24px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 视频网格样式 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.video-card {
    background: var(--secondary-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    display: block;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.no-thumbnail {
    width: 100%;
    height: 100%;
    background: #383838;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-weight: 500;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.4;
}

.video-title a {
    color: var(--text-color);
}

.video-title a:hover {
    color: var(--accent-color);
}

.video-meta {
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    height: 3px;
    background: #383838;
    position: absolute;
    bottom: 0;
    left: 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.progress-text,
.progress-indicator {
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 500;
}

/* 收藏按钮样式 */
.favorite-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.favorite-btn.favorited {
    background: rgba(255, 59, 92, 0.2);
    border-color: #ff3b5c;
    color: #ff3b5c;
}

.favorite-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #ff3b5c;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* 页面头部样式 */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* 学习统计样式 */
.learning-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--secondary-color);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    font-size: 32px;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
    display: block;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 分类网格样式 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--secondary-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.category-link {
    color: var(--text-color);
    text-decoration: none;
}

.category-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.category-name {
    font-size: 18px;
    margin-bottom: 8px;
}

.category-count {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.category-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-percent {
    color: var(--accent-color);
    font-weight: 500;
    font-size: 14px;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* 按钮样式 */
.btn-primary {
    background: var(--accent-color);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: #2d8cdf;
    color: white;
}

.btn-secondary {
    background: transparent;
    color: var(--text-color);
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 筛选栏样式 */
.filters-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--secondary-color);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    color: var(--text-secondary);
    font-size: 14px;
}

.filter-group select {
    background: #383838;
    border: 1px solid #555;
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
}

/* 消息提示 */
.message-alert {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
}

.message-alert.message-error {
    background: var(--error-color);
}

/* 视频播放器页面样式 */
.video-player-container {
    max-width: 1200px;
    margin: 0 auto;
}

.video-player-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.video-embed {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 比例 */
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-info-section {
    background: var(--secondary-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.video-meta-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.video-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.video-stats {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.video-description {
    line-height: 1.6;
}

.video-meta {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #383838;
    display: flex;
    gap: 24px;
    font-size: 14px;
}

.meta-item {
    color: var(--text-secondary);
}

.meta-item strong {
    color: var(--text-color);
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    background: var(--secondary-color);
    transition: background 0.3s ease;
}

.pagination a:hover {
    background: #383838;
}

.pagination .current {
    background: var(--accent-color);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .content-area {
        margin-left: 0;
        width: 100%;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .learning-stats {
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .video-meta-header {
        flex-direction: column;
        gap: 12px;
    }

    .video-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 10px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .stat-card {
        padding: 16px;
    }

    .video-info {
        padding: 10px;
    }
}
