/* =====================
   JavBus Clone - 全局样式
   ===================== */

/* CSS Variables */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2a4a;
    --bg-hover: #243b60;
    --accent: #e50914;
    --accent-hover: #ff1a25;
    --highlight: #f0a500;
    --highlight-dim: #c48700;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #606060;
    --border-color: #2a3a5e;
    --border-light: #1a2a4e;
    --shadow: rgba(0, 0, 0, 0.4);
    --radius: 4px;
    --transition: 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =====================
   顶部导航栏
   ===================== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px var(--shadow);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo:hover { color: var(--accent-hover); }

.nav-item {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background var(--transition);
    white-space: nowrap;
}

.nav-item:hover, .nav-item.active {
    background: var(--bg-hover);
    color: var(--highlight);
}

/* =====================
   顶部导航分类标签
   ===================== */
.nav-category-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.nav-tab-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all var(--transition);
    white-space: nowrap;
    font-weight: 500;
}

.nav-tab-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-tab-item.active {
    background: var(--accent);
    color: #fff;
    font-weight: bold;
}

.search-box {
    display: flex;
    align-items: center;
    margin-left: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color var(--transition);
    flex-shrink: 0;
}

.search-box:focus-within {
    border-color: var(--highlight);
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    padding: 8px 14px;
    font-size: 13px;
    width: 220px;
}

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

.search-box button {
    background: none;
    border: none;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition);
    display: flex;
    align-items: center;
}

.search-box button:hover { color: var(--highlight); }

/* =====================
   主体布局
   ===================== */
.main-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    gap: 24px;
    flex: 1;
    width: 100%;
}

/* =====================
   左侧边栏
   ===================== */
.sidebar {
    width: 180px;
    flex-shrink: 0;
}

.sidebar-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 13px;
    font-weight: bold;
    color: var(--highlight);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.genre-list {
    list-style: none;
    max-height: 500px;
    overflow-y: auto;
}

.genre-list::-webkit-scrollbar { width: 4px; }
.genre-list::-webkit-scrollbar-track { background: var(--bg-secondary); }
.genre-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.genre-list li a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 5px 8px;
    border-radius: var(--radius);
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.genre-list li a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.genre-list li a.active {
    background: var(--accent);
    color: #fff;
}

/* =====================
   分类筛选侧边栏（新）
   ===================== */
.filter-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid var(--border-color);
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.filter-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--highlight);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-clear-btn {
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.filter-clear-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.filter-group {
    margin-bottom: 4px;
    border-radius: var(--radius);
    overflow: hidden;
}

.filter-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background var(--transition);
    user-select: none;
}

.filter-group-header:hover {
    background: var(--bg-hover);
}

.filter-group-header.has-active {
    background: rgba(229, 9, 20, 0.15);
}

.filter-group-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-group-header.has-active .filter-group-label {
    color: var(--accent);
}

.filter-group-toggle {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: transform var(--transition);
}

.toggle-icon {
    transition: transform 0.2s ease;
}

.filter-items-list {
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0 6px;
}

.filter-items-list::-webkit-scrollbar { width: 3px; }
.filter-items-list::-webkit-scrollbar-track { background: transparent; }
.filter-items-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    text-decoration: none;
    border-radius: var(--radius);
    transition: background var(--transition);
    cursor: pointer;
}

.filter-item:hover {
    background: var(--bg-hover);
}

.filter-item.active {
    background: var(--accent);
}

.filter-item.active .filter-item-name,
.filter-item.active .filter-item-count {
    color: #fff;
}

.filter-item-name {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.filter-item:hover .filter-item-name {
    color: var(--text-primary);
}

.filter-item-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    flex-shrink: 0;
}

.filter-empty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 10px;
    text-align: center;
}

.filter-more-hint {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 10px;
    text-align: center;
    font-style: italic;
}

/* =====================
   主内容区
   ===================== */
.content {
    flex: 1;
    min-width: 0;
}

.search-result-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-result-info strong { color: var(--highlight); }

.clear-search {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    margin-left: auto;
}
.clear-search:hover { color: var(--accent); }

/* =====================
   影片卡片网格
   ===================== */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 20px;
}

.movie-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--border-light);
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-color: var(--highlight-dim);
}

.cover-wrap {
    position: relative;
    padding-top: 130%;
    overflow: hidden;
    background: var(--bg-secondary);
}

.cover-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.movie-card:hover .cover-wrap img { transform: scale(1.05); }

.no-cover {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
}

.magnet-badge {
    position: absolute;
    top: 6px; right: 6px;
    background: var(--highlight);
    color: #000;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 3px;
    z-index: 2;
}

.info {
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* 列表卡片：标题 + 底部 番号/日期（参考 JavBus） */
.movie-title-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.movie-meta-line {
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-top: auto;
    line-height: 1.35;
}

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

.empty-state p { font-size: 18px; margin-bottom: 8px; }
.empty-state small { font-size: 13px; }

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

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all var(--transition);
}

.pagination a:hover {
    background: var(--bg-hover);
    border-color: var(--highlight-dim);
    color: var(--highlight);
}

.pagination a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: bold;
}

.pagination .ellipsis {
    background: none;
    border-color: transparent;
    color: var(--text-muted);
    cursor: default;
}

.pagination .prev, .pagination .next {
    font-size: 16px;
    letter-spacing: -1px;
}

/* =====================
   详情页
   ===================== */
.detail-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.detail-breadcrumb {
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-muted);
}

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

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

.detail-main {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

/* 左侧媒体区 */
.detail-media { flex-shrink: 0; width: 380px; }

.big-cover {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: zoom-in;
}

.big-cover img {
    width: 100%;
    display: block;
    transition: transform 0.3s ease;
}

.big-cover img:hover { transform: scale(1.02); }

.no-cover-large {
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 16px;
}

.sample-thumb { margin-top: 16px; }

.section-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
}

.thumb-item {
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition);
    aspect-ratio: 3/4;
}

.thumb-item:hover, .thumb-item.active { border-color: var(--highlight); }

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 右侧信息区 */
.detail-info {
    flex: 1;
    min-width: 0;
}

.movie-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 20px;
    line-height: 1.4;
    word-break: break-all;
}

.movie-code {
    color: var(--highlight);
    margin-right: 10px;
}

.movie-full-title { color: var(--text-primary); }

.info-table {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 24px;
}

.info-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
}

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

.info-label {
    width: 90px;
    color: var(--text-muted);
    font-size: 13px;
    flex-shrink: 0;
}

.info-value { color: var(--text-primary); font-size: 13px; }
.magnet-count { color: var(--highlight); font-weight: bold; }

.tags-value {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-item {
    display: inline-block;
    padding: 2px 8px;
    background: var(--highlight);
    color: #1a1a2e;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 500;
}

/* 磁力链接 */
.magnet-section h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.magnet-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.magnet-hash {
    flex: 1;
    font-family: "Courier New", monospace;
    font-size: 11px;
    color: var(--text-secondary);
    word-break: break-all;
    min-width: 200px;
}

.magnet-size {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--highlight);
    font-size: 12px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: var(--radius);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.magnet-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.copy-btn, .dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.copy-btn {
    background: var(--highlight);
    color: #000;
    font-weight: bold;
}

.copy-btn:hover { background: var(--highlight-dim); }

.dl-btn {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.dl-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* =====================
   灯箱
   ===================== */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active { opacity: 1; }

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

.lightbox-close {
    position: fixed;
    top: 20px; right: 24px;
    font-size: 36px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    transition: color var(--transition);
}

.lightbox-close:hover { color: #fff; }

/* =====================
   Toast 提示
   ===================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--highlight);
    color: #000;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =====================
   底部
   ===================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 16px;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 12px;
}

/* =====================
   响应式
   ===================== */
@media (max-width: 900px) {
    .main-layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .genre-list { max-height: 200px; }
    .detail-main { flex-direction: column; }
    .detail-media { width: 100%; }
    .movie-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 500px) {
    .movie-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
    .nav-inner { gap: 8px; }
    .search-box input { width: 100px; }
    .movie-title { font-size: 18px; }
    .nav-category-tabs { gap: 2px; }
    .nav-tab-item { padding: 4px 8px; font-size: 12px; }
}

/* =====================
   滚动条美化
   ===================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--highlight-dim); }

/* =====================
   工具类
   ===================== */
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
