/* Demo页面专用样式 */

/* 主容器 */
.demo-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 200px);
}

/* 页面头部 */
.demo-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.demo-title {
    font-size: 3rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #53ff8a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.demo-subtitle {
    font-size: 1.2rem;
    color: #9ca3af;
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* 加载占位符 */
.loading-placeholder {
    text-align: center;
    padding: 4rem 0;
    color: #9ca3af;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(83, 255, 138, 0.3);
    border-top: 3px solid #53ff8a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 视频网格 - 强制4列布局 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    /* 确保CSS优先级 */
    width: 100% !important;
}

/* 视频卡片 */
.video-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(83, 255, 138, 0.3);
}

/* 视频缩略图容器 */
.video-thumbnail-container {
    position: relative;
    width: 100%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 横屏视频缩略图 */
.video-thumbnail-container.landscape {
    aspect-ratio: 16/9;
}

/* 竖屏视频缩略图 */
.video-thumbnail-container.portrait {
    aspect-ratio: 9/16;
    max-height: 400px;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

/* 针对video标签的缩略图样式 - 隐藏控制条 */
.video-thumbnail::-webkit-media-controls {
    display: none !important;
}

.video-thumbnail::-webkit-media-controls-enclosure {
    display: none !important;
}

.video-thumbnail::-webkit-media-controls-panel {
    display: none !important;
}

/* 缩略图加载动画 */
.thumbnail-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    z-index: 5;
}

.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.video-card:hover .video-thumbnail {
    transform: scale(1.05);
}

/* 播放按钮覆盖层 */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-card:hover .video-overlay {
    opacity: 1;
}

.play-button {
    width: 60px;
    height: 60px;
    background: rgba(83, 255, 138, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 20px;
    transition: all 0.3s ease;
}

.play-button:hover {
    background: #53ff8a;
    transform: scale(1.1);
}

/* 视频信息 */
.video-info {
    padding: 1.5rem;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-description {
    font-size: 0.9rem;
    color: #9ca3af;
    line-height: 1.5;
    margin-bottom: 1rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    white-space: pre-line; /* 支持换行符显示 */
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #6b7280;
}

.video-category {
    background: rgba(83, 255, 138, 0.2);
    color: #53ff8a;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.video-author {
    color: #9ca3af;
    font-size: 0.8rem;
}

.video-views {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #6b7280;
    font-size: 0.8rem;
}

/* 分页控件 */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
}

.pagination-info {
    color: #9ca3af;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: center;
}

.pagination-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(83, 255, 138, 0.3);
}

.pagination-btn.active {
    background: #53ff8a;
    color: #000000;
    border-color: #53ff8a;
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 视频模态框 */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.video-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 16px;
    overflow: hidden;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #ffffff;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 0, 0, 0.7);
    transform: scale(1.1);
}

.modal-video-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#modalVideo {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
}

.modal-info {
    padding: 2rem;
    background: rgba(0, 0, 0, 0.8);
}

.modal-info h3 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.modal-info p {
    color: #d1d5db;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-meta {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

/* 强制网格布局 - 桌面端至少4列 */
@media (min-width: 1200px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
        gap: 2rem !important;
    }
}

@media (min-width: 1600px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
        gap: 2rem !important;
    }
}

/* 中等屏幕 - 确保至少3列 */
@media (min-width: 900px) and (max-width: 1199px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
        gap: 1.5rem !important;
    }
}

/* 小屏幕平板 - 2列 */
@media (min-width: 600px) and (max-width: 899px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}

/* 默认布局强制设置 */
@media (min-width: 1000px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 1.5rem !important;
        display: grid !important;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .demo-container {
        padding: 1rem;
    }
    
    .demo-title {
        font-size: 2rem;
    }
    
    .demo-subtitle {
        font-size: 1rem;
    }
    
    .video-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        display: grid !important;
    }
    
    .video-thumbnail-container.portrait {
        max-height: 300px;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 2rem);
    }
    
    #modalVideo {
        max-height: 50vh;
    }
    
    .modal-info {
        padding: 1.5rem;
    }
    
    .pagination {
        gap: 0.5rem;
    }
    
    .pagination-info {
        font-size: 0.8rem;
    }
    
    .pagination-buttons {
        gap: 0.25rem;
    }
    
    .pagination-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* 移动端访问数量样式调整 */
    .video-views {
        font-size: 0.75rem;
    }
    
    .video-author {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .demo-header {
        margin-bottom: 2rem;
        padding: 1rem 0;
    }
    
    .demo-title {
        font-size: 1.75rem;
    }
    
    .video-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        display: grid !important;
    }
    
    .video-card {
        margin: 0 -0.5rem;
    }
    
    .pagination-info {
        font-size: 0.75rem;
        line-height: 1.5;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 35px;
    }
    
    .modal-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* 小屏幕访问数量样式调整 */
    .video-views {
        font-size: 0.7rem;
    }
    
    .video-author {
        font-size: 0.7rem;
    }
}