/* 基础样式重置 */
* {
    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-color: #f4f4f4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #00a1d6, #fb7299);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: bold;
}

.search-bar {
    display: flex;
    gap: 10px;
}

.search-bar input {
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    width: 300px;
    font-size: 14px;
}

.search-bar button {
    padding: 8px 16px;
    background: #fff;
    color: #00a1d6;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.search-bar button:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 15px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.2);
}

/* 分类胶囊导航 */
.categories-container {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.categories-scroll-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 8px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.categories-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.category-capsule {
    flex: 0 0 auto;
    padding: 8px 20px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

.category-capsule:hover {
    background: linear-gradient(135deg, #ff5252, #ff7b7b);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.category-capsule.active {
    background: linear-gradient(135deg, #00a1d6, #fb7299);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 161, 214, 0.4);
    transform: translateY(-2px);
}

.scroll-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e0e0e0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.scroll-btn:hover {
    background: linear-gradient(135deg, #00a1d6, #fb7299);
    border-color: transparent;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 161, 214, 0.3);
}

.scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: white;
    border-color: #ddd;
    color: #666;
    box-shadow: none;
}

.scroll-btn:disabled:hover {
    background: white;
    border-color: #ddd;
    color: #666;
    transform: none;
    box-shadow: none;
}

/* 主内容区域 */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* 视频网格 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.video-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.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);
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-weight: bold;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.video-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fff;
    margin: 2% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
    z-index: 1001;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ff4757;
}

#videoPlayer {
    width: 100%;
    height: 450px;
    border-radius: 8px;
    background: #000;
}

.video-info {
    margin-top: 20px;
    padding: 0 10px;
}

.video-info h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.4rem;
    line-height: 1.3;
}

.video-info p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.video-stats {
    display: flex;
    gap: 20px;
    color: #888;
    font-size: 14px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}


/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 页脚样式 */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { color: rgba(0,0,0,0); text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); }
    40% { color: #666; text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); }
    60% { text-shadow: .25em 0 0 #666, .5em 0 0 rgba(0,0,0,0); }
    80%, 100% { text-shadow: .25em 0 0 #666, .5em 0 0 #666; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-bar input {
        width: 200px;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    #videoPlayer {
        height: 300px;
    }
    
    /* 分类胶囊导航响应式 */
    .categories-scroll-wrapper {
        gap: 6px;
    }
    
    .category-capsule {
        padding: 6px 16px;
        font-size: 13px;
        border-radius: 20px;
    }
    
    .scroll-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    /* 手机端分类胶囊导航优化 */
    .categories-scroll-wrapper {
        gap: 4px;
    }
    
    .category-capsule {
        padding: 5px 12px;
        font-size: 12px;
        border-radius: 16px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .scroll-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .scroll-btn svg {
        width: 12px;
        height: 12px;
    }
    
    /* 手机端头部优化 */
    .header .container {
        padding: 0 12px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
        text-align: center;
    }
    
    .nav {
        justify-content: center;
        width: 100%;
    }
    
    /* 手机端视频卡片优化 */
    .video-thumbnail {
        height: 140px;
    }
    
    .video-info {
        padding: 10px;
    }
    
    .video-title {
        font-size: 14px;
    }
    
    /* 手机端模态框优化 */
    .modal-content {
        width: 98%;
        margin: 2% auto;
        padding: 15px;
    }
    
    #videoPlayer {
        height: 200px;
    }
    
    /* 手机端分页优化 */
    .pagination-container {
        padding: 0.75rem;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .page-input-container {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .pagination-btn {
        min-width: 70px;
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* 分页控件样式 */
.pagination-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 14px;
    color: #666;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #00a1d6, #fb7299);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 80px;
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 161, 214, 0.3);
}

.pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.page-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-input {
    width: 60px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    text-align: center;
    font-size: 14px;
}

.page-input:focus {
    outline: none;
    border-color: #00a1d6;
    box-shadow: 0 0 0 2px rgba(0, 161, 214, 0.2);
}

/* 响应式分页样式 */
@media (max-width: 768px) {
    .pagination-container {
        padding: 1rem;
    }
    
    .pagination-info {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .page-input-container {
        order: -1;
    }
}
