/* CSS全局重置和变量定义 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #e74c3c;
    --secondary-color: #3498db;
    --accent-color: #2ecc71;
    --text-primary: #333;
    --text-secondary: #666;
    --text-light: #999;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* 容器和布局系统 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    padding: 5px 10px;
    border-radius: var(--border-radius);
}

.main-nav a:hover {
    color: var(--primary-color);
    background-color: rgba(231, 76, 60, 0.1);
}

.user-actions {
    display: flex;
    gap: 15px;
}

.login-btn, .register-btn {
    padding: 8px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.login-btn {
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.login-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.register-btn {
    background-color: var(--primary-color);
    color: white;
}

.register-btn:hover {
    background-color: #c0392b;
}

/* 主内容区域 */
.main-content {
    padding: 20px 0;
}

/* 搜索区域 */
.hero-section {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    padding: 40px 0;
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 15px 25px;
    font-size: 16px;
    outline: none;
}

.search-box button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.search-box button:hover {
    background-color: #c0392b;
}

/* 区块标题 */
h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-primary);
    position: relative;
    padding-left: 15px;
}

h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background-color: var(--primary-color);
}

/* 轮播区域 */
.carousel-section {
    margin-bottom: 40px;
}

.video-featured {
    display: flex;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.video-thumbnail {
    position: relative;
    flex: 2;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-info h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.video-info p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.video-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--text-light);
}

/* 轮播容器样式 */
.carousel-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.carousel {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-item {
    min-width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-item.active {
    opacity: 1;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
}

.video-thumbnail:hover .play-overlay {
    opacity: 1;
}

.carousel-controls {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
    pointer-events: none;
}

.carousel-btn {
    background-color: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    pointer-events: all;
}

.carousel-btn:hover {
    background-color: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: var(--transition);
}

.indicator.active {
    background-color: white;
    width: 25px;
    border-radius: 5px;
}

/* 视频网格布局 */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.video-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    cursor: pointer;
}

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

.video-thumbnail {
    position: relative;
    padding-top: 56.25%; /* 16:9 比例 */
    overflow: hidden;
}

.video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.05);
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.video-info {
    padding: 15px;
}

.video-info h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-light);
}

/* 视频卡片增强样式 */
.video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.video-badge.hot {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
}

.video-badge.premium {
    background: linear-gradient(45deg, #f39c12, #e67e22);
}

.video-badge.new {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
}

.video-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.video-author img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.video-author span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.video-card:hover .video-author span {
    color: var(--primary-color);
}

/* 分类标签 */
.category-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-primary);
}

.category-tab:hover,
.category-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 分类控件样式 */
.category-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-select {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: white;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.sort-select:hover {
    border-color: var(--primary-color);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

/* 加载更多按钮 */
.load-more {
    text-align: center;
    margin-top: 30px;
}

.load-more-btn {
    background-color: var(--bg-primary);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.load-more-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .category-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .category-tabs {
        justify-content: center;
    }

    .sort-controls {
        justify-content: center;
    }

    .sort-select {
        width: 100%;
        max-width: 200px;
    }
}

/* 底部样式 */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 15px;
    color: white;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: inline-block;
    padding: 8px 15px;
    background-color: rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #95a5a6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .user-actions {
        width: 100%;
        justify-content: center;
    }

    .search-box {
        flex-direction: column;
        border-radius: var(--border-radius);
    }

    .search-box input,
    .search-box button {
        border-radius: 0;
    }

    .video-featured {
        flex-direction: column;
    }

    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .category-tabs {
        justify-content: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .videos-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        padding: 30px 0;
    }

    .logo h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 20px;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card {
    animation: fadeInUp 0.5s ease-out;
}

.video-card:nth-child(1) { animation-delay: 0.1s; }
.video-card:nth-child(2) { animation-delay: 0.2s; }
.video-card:nth-child(3) { animation-delay: 0.3s; }
.video-card:nth-child(4) { animation-delay: 0.4s; }

/* 加载状态和占位符 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 20px;
    width: 80%;
    margin-bottom: 10px;
}

.skeleton-image {
    width: 100%;
    height: 180px;
    border-radius: var(--border-radius);
}

/* 图片懒加载效果 */
.lazy-image {
    filter: blur(5px);
    transition: filter 0.3s;
}

.lazy-image.loaded {
    filter: blur(0);
}

/* 文本省略和多行截断 */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-ellipsis-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-ellipsis-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-medium);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #c0392b;
    transform: translateY(-3px);
}

/* 图片优化 */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

/* 性能优化 */
.will-change-transform {
    will-change: transform;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c0392b;
}

/* 焦点样式优化 */
button:focus,
select:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .header,
    .footer,
    .carousel-controls,
    .category-controls,
    .back-to-top {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .video-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}