/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

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

.logo i {
    font-size: 2rem;
    color: #667eea;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: transparent;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.filter-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 主要内容区域 */
.main {
    flex: 1;
    padding: 2rem 0;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-note i {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* 视频网格 */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.video-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

/* 加载指示器样式 */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 4px;
    backdrop-filter: blur(5px);
    z-index: 2;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* 缩略图淡入效果 */
.thumbnail-img {
    transition: opacity 0.3s ease;
}

.thumbnail-img.loading {
    opacity: 0.7;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #667eea;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.play-button:hover {
    background: white;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-content {
    padding: 1.5rem;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
    line-height: 1.4;
}

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1rem;
}

.tag {
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
}

.video-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #e9ecef;
    color: #333;
}

.modal-body {
    padding: 2rem;
}

.modal-body video {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.modal .video-tags {
    margin-bottom: 1.5rem;
}

.modal .video-description {
    color: #666;
    line-height: 1.6;
    -webkit-line-clamp: none;
    line-clamp: none;
}

/* 底部样式 */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* 响应式设计 */
/* 大屏幕和桌面设备 (1200px+) */
@media (min-width: 1200px) {
    .videos-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 中等屏幕和平板横屏 (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 平板竖屏 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .filter-btn {
        font-size: 0.9rem;
        padding: 8px 16px;
    }
}

/* 手机横屏和小平板 (576px - 767px) */
@media (max-width: 767px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .filter-btn {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .hero {
        padding: 2rem 0;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .video-card {
        padding: 1rem;
    }

    .video-card h3 {
        font-size: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }
}

/* 手机竖屏 (最大575px) */
@media (max-width: 575px) {
    .container {
        padding: 0 1rem;
    }

    .header .container {
        padding: 0.5rem 1rem;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .nav {
        justify-content: space-around;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
        white-space: nowrap;
        min-width: auto;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .videos-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .video-card {
        padding: 0.8rem;
    }

    .video-card h3 {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .video-card .tags {
        gap: 0.3rem;
    }

    .tag {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .play-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .modal-content {
        width: 98%;
        margin: 1%;
        border-radius: 8px;
    }

    .modal-header {
        padding: 0.8rem;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 0.8rem;
    }

    .close-btn {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .video-card:hover {
        transform: none;
    }
    
    .video-card:active {
        transform: scale(0.98);
    }
    
    .filter-btn:hover {
        background: var(--primary-color);
    }
    
    .play-button {
        opacity: 1;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .video-thumbnail {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 移动设备特殊优化 */
.mobile-device .video-card {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-device .filter-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 可滚动导航样式 */
.nav.scrollable {
    padding-bottom: 5px;
}

.nav.scrollable::after {
    content: '→';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(to right, transparent, var(--bg-dark));
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

/* iOS Safari 特殊优化 */
@supports (-webkit-touch-callout: none) {
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    .video-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* 横屏手机特殊处理 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 0.5rem 0;
    }
    
    .hero {
        padding: 1rem 0;
    }
    
    .hero h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .hero p {
        margin-bottom: 1rem;
    }
    
    .modal-content {
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .modal-header {
        padding: 0.5rem 1rem;
    }
    
    .modal-body {
        padding: 0.5rem 1rem 1rem;
    }
}

/* 可访问性优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .video-card:hover {
        transform: none;
    }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-dark: #0a0a0a;
        --bg-card: #1a1a1a;
        --text-primary: #ffffff;
        --text-muted: #b0b0b0;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: white;
    font-size: 1.2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 淡入动画 */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
