/**
 * KVideo - 主样式表
 * KVideo - Main Stylesheet
 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #475569;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-hover);
}

/* 导航栏 */
.navbar {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.navbar-menu {
    display: flex;
    gap: 1.5rem;
}

.navbar-menu a {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: var(--text-color);
    background: var(--bg-card);
}

.btn-login,
.btn-logout {
    background: var(--primary-color);
    color: white !important;
}

.btn-login:hover,
.btn-logout:hover {
    background: var(--primary-hover);
}

/* 搜索框 */
.search-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-btn {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.search-btn:hover {
    background: var(--primary-hover);
}

.source-selector {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.source-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.source-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.source-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.source-checkbox input[type="checkbox"] {
    cursor: pointer;
}

/* 主内容区 */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 300px);
}

/* 视频网格 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.video-card {
    background: var(--bg-card);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.video-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.video-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.video-card .video-info {
    padding: 1rem;
}

.video-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card .video-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.video-card .video-rate {
    font-size: 0.85rem;
    color: var(--warning-color);
    font-weight: bold;
}

/* 合并后的视频卡片 */
.merged-card {
    background: var(--bg-card);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.merged-card .video-info {
    padding: 1rem;
}

.merged-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.merged-card .video-remarks {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* 源标签 */
.source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.source-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    transition: all 0.3s;
}

.source-tag:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.video-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: var(--danger-color);
}

/* 热门推荐 */
.featured-section {
    margin-bottom: 3rem;
}

.featured-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.featured-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.featured-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1.5rem;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

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

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

.loading-more {
    text-align: center;
    padding: 2rem;
}

/* 页面标题 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-clear {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
}

.btn-clear:hover {
    background: #dc2626;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    padding: 0.75rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    display: inline-block;
}

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

/* 加载中 */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 无结果 */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 页脚 */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 3rem;
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    /* 导航栏优化 */
    .navbar {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .navbar-brand {
        width: 100%;
        text-align: center;
    }
    
    .navbar-brand a {
        font-size: 1.25rem;
    }
    
    .navbar-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }
    
    .navbar-menu a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    /* 搜索框优化 */
    .search-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    .search-box {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-box input {
        width: 100%;
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
    
    .search-btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .source-selector {
        padding: 0.75rem;
    }
    
    .source-checkboxes {
        gap: 0.5rem;
    }
    
    .source-checkbox {
        font-size: 0.9rem;
    }
    
    /* 主内容区优化 */
    .main-content {
        padding: 1rem;
    }
    
    /* 视频网格优化 */
    .video-grid {
        grid-template-columns: repeat(2, 1fr); /* 两列布局 */
        gap: 1rem;
    }
    
    .video-card {
        border-radius: 0.5rem;
    }
    
    .video-card img {
        height: 225px; /* 适应小屏幕 */
    }
    
    .video-card .video-info {
        padding: 0.75rem;
    }
    
    .video-card h3 {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .video-card .video-date,
    .video-card .video-rate {
        font-size: 0.75rem;
    }
    
    /* 合并卡片优化 */
    .merged-card .video-info {
        padding: 0.75rem;
    }
    
    .merged-card h3 {
        font-size: 0.85rem;
    }
    
    .merged-card .video-remarks {
        font-size: 0.75rem;
    }
    
    /* 源标签优化 */
    .source-tags {
        gap: 0.375rem;
    }
    
    .source-tag {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* 删除按钮优化 */
    .btn-delete {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 1rem;
    }
    
    /* 特色区块优化 */
    .featured-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .featured-header h2 {
        font-size: 1.25rem;
    }
    
    .featured-tabs {
        flex-wrap: wrap;
        gap: 0.375rem;
    }
    
    .tab-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }
    
    /* 页面头部优化 */
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .btn-clear {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* 空状态优化 */
    .empty-state {
        padding: 3rem 1rem;
    }
    
    .empty-state p {
        font-size: 1rem;
    }
    
    .btn-primary {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* 加载更多优化 */
    .loading-more {
        padding: 1.5rem;
    }
    
    /* 页脚优化 */
    .footer {
        padding: 1.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* 超小屏幕优化（小于 480px） */
@media (max-width: 480px) {
    .navbar-brand a {
        font-size: 1.1rem;
    }
    
    .navbar-menu a {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
    }
    
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .video-card img {
        height: 180px;
    }
    
    .video-card .video-info {
        padding: 0.5rem;
    }
    
    .video-card h3 {
        font-size: 0.8rem;
    }
}

/* 平板优化（481px - 768px） */
@media (min-width: 481px) and (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    .video-card img {
        height: 240px;
    }
}
