/* ========================================
   魔库现代影视模板 - 主样式表
   版本：1.0.0
   特点：现代化深色主题、响应式布局、CSS变量
   ======================================== */

/* ---------- CSS变量 ---------- */
:root {
    --primary: #e94560;
    --primary-hover: #c73650;
    --primary-light: rgba(233, 69, 96, 0.1);
    --bg: #0f0f1a;
    --bg-secondary: #16162a;
    --card-bg: #1a1a2e;
    --card-hover: #22223a;
    --border: #2a2a4a;
    --border-light: #333355;
    --text: #eeeeee;
    --text-secondary: #aaaaaa;
    --text-muted: #777777;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s ease;
    --header-height: 64px;
    --max-width: 1400px;
}

/* ---------- 重置 ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

img {
    max-width: 100%;
    height: auto;
    display: block;
    border: 0;
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
    background: none;
    color: inherit;
}

/* ---------- 工具类 ---------- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.text-overflow {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.hidden-xs { display: block; }
.visible-xs { display: none; }

/* ---------- 顶部导航 ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 15, 26, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.logo img {
    height: 36px;
    width: auto;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav a:hover, .nav a.active {
    color: var(--primary);
    background: var(--primary-light);
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px;
    width: 240px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search input {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
}

.header-search input::placeholder {
    color: var(--text-muted);
}

.header-search button {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.header-search button:hover {
    color: var(--primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

/* ---------- 移动端导航 ---------- */
.mobile-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 999;
    padding: 20px;
    overflow-y: auto;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav a {
    display: block;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}

/* ---------- 主内容区 ---------- */
.main {
    padding: 24px 0;
    min-height: calc(100vh - var(--header-height) - 200px);
}

/* ---------- 栏目区块 ---------- */
.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 600;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

.section-more {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-more:hover {
    color: var(--primary);
}

/* ---------- 影视卡片网格 ---------- */
.vod-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.vod-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.vod-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    background: var(--card-hover);
}

.vod-thumb {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--bg-secondary);
}

.vod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.vod-card:hover .vod-thumb img {
    transform: scale(1.05);
}

.vod-thumb .play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(233, 69, 96, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.vod-card:hover .play-btn {
    opacity: 1;
}

.vod-thumb .badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.vod-thumb .remarks {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.vod-info {
    padding: 10px 12px;
}

.vod-title {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.vod-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.vod-score {
    color: var(--primary);
    font-weight: 600;
}

/* ---------- 排行榜 ---------- */
.rank-list {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 8px 0;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: var(--transition);
    cursor: pointer;
}

.rank-item:hover {
    background: var(--card-hover);
}

.rank-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-muted);
    flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-num { background: var(--primary); color: #fff; }
.rank-item:nth-child(2) .rank-num { background: #ff9800; color: #fff; }
.rank-item:nth-child(3) .rank-num { background: #ffc107; color: #fff; }

.rank-title {
    flex: 1;
    font-size: 0.9rem;
}

.rank-score {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

/* ---------- 详情页 ---------- */
.detail-header {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.detail-poster {
    width: 240px;
    flex-shrink: 0;
}

.detail-poster img {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: var(--radius);
}

.detail-info {
    flex: 1;
}

.detail-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-score {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 700;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-meta .label {
    color: var(--text-muted);
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.detail-tag {
    padding: 4px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 16px;
    font-size: 0.8rem;
}

.detail-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 20px;
}

.detail-actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------- 播放列表 ---------- */
.playlist-section {
    margin-bottom: 32px;
}

.playlist-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.playlist-source {
    padding: 6px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.playlist-source.active, .playlist-source:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.playlist-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.playlist-item {
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.playlist-item:hover, .playlist-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---------- 播放页 ---------- */
.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.player-wrapper iframe, .player-wrapper video {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ---------- 筛选器 ---------- */
.filter-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.filter-row:last-child {
    border-bottom: none;
}

.filter-label {
    width: 60px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-top: 4px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.filter-option {
    padding: 4px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-option:hover, .filter-option.active {
    background: var(--primary);
    color: #fff;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover, .pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-secondary);
}

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

.breadcrumb .separator {
    color: var(--text-muted);
}

/* ---------- 搜索页 ---------- */
.search-header {
    text-align: center;
    margin-bottom: 32px;
}

.search-keyword {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.search-keyword span {
    color: var(--primary);
}

.search-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box {
    max-width: 600px;
    margin: 0 auto 32px;
    display: flex;
    gap: 0;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 1rem;
}

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

.search-box button {
    padding: 12px 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state .text {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-state .subtext {
    font-size: 0.9rem;
}

/* ---------- 页脚 ---------- */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 40px 0 24px;
    margin-top: 40px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
}

.footer-links a {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.footer-copyright {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ---------- 回到顶部 ---------- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    box-shadow: var(--shadow);
}

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

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ---------- 加载动画 ---------- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
    .vod-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 992px) {
    .vod-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .nav { display: none; }
    .header-search { width: 180px; }
    .mobile-menu-btn { display: block; }
    .detail-header { flex-direction: column; align-items: center; text-align: center; }
    .detail-poster { width: 200px; }
    .detail-meta { justify-content: center; }
    .detail-tags { justify-content: center; }
    .detail-actions { justify-content: center; }
}

@media (max-width: 768px) {
    :root { --header-height: 56px; }
    .vod-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    .header-search { display: none; }
    .detail-title { font-size: 1.4rem; }
    .section-title { font-size: 1.1rem; }
    .playlist-items { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .filter-label { width: 50px; font-size: 0.8rem; }
    .filter-option { font-size: 0.8rem; padding: 3px 10px; }
    .hidden-xs { display: none !important; }
    .visible-xs { display: block; }
    .vod-title { font-size: 0.8rem; }
    .vod-meta { font-size: 0.7rem; }
}

@media (max-width: 480px) {
    .vod-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .container { padding: 0 12px; }
    .detail-poster { width: 160px; }
    .btn { padding: 8px 16px; font-size: 0.85rem; }
}

/* ---------- 浅色主题（可选） ---------- */
@media (prefers-color-scheme: light) {
    /* 可在此添加浅色主题样式 */
}

/* ---------- 打印样式 ---------- */
@media print {
    .header, .footer, .back-to-top, .nav { display: none; }
    body { background: #fff; color: #000; }
}
