/* ═══════════════════════════════════════════════════
   movie.css — Movie page enhanced styles
   电影页面专属样式：封面卡、筛选栏、弹窗动画、分组标题
   ═══════════════════════════════════════════════════ */

/* ─── Stats bar ─── */
.movie-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}
.movie-stats .stat-item { display: inline-flex; align-items: center; }
.movie-stats .stat-item strong { color: var(--text-heading); margin: 0 2px; }
.movie-stats .stat-divider { margin: 0 8px; color: var(--border); }

/* ─── Filter bar ─── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.filter-btn {
    padding: 8px 20px;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    background: var(--bg-card);
    color: var(--text-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    white-space: nowrap;
}
.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(59,130,246,0.3);
}

/* ─── Movie Grid — CSS Grid with responsive columns ─── */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
@media (max-width: 992px) {
    .movie-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (max-width: 576px) {
    .movie-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* ─── Season Header ─── */
.season-header {
    grid-column: 1 / -1;
    margin: 8px 0 4px;
}
.season-header:first-of-type { margin-top: 0; }
.season-bar {
    border-radius: 12px;
    padding: 14px 24px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.season-bar-content {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}
.season-ep-count {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.85;
    background: rgba(255,255,255,0.18);
    padding: 3px 14px;
    border-radius: 20px;
}

/* ─── Movie Card (new) ─── */
.movie-card-new {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--shadow-sm);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.movie-card-new:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

/* ─── Cover area ─── */
.movie-cover {
    position: relative;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}
.movie-cover-icon {
    font-size: 3.5rem;
    color: rgba(255,255,255,0.3);
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.movie-card-new:hover .movie-cover-icon {
    transform: scale(1.15);
    opacity: 0;
}
.movie-cover-ep {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.25);
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 1px;
}

/* ─── Hover overlay ─── */
.movie-cover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.movie-card-new:hover .movie-cover-overlay {
    opacity: 1;
}
.play-btn-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}
.play-btn-circle:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
    color: #fff;
}

/* ─── Info area ─── */
.movie-info {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.movie-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.movie-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-heading);
    margin: 0;
    line-height: 1.4;
}
.movie-intro {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Video badge (new, larger) ─── */
.video-badge-new {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
}
.badge-local-new {
    background: rgba(34,197,94,0.1);
    color: #16a34a;
    border: 1px solid rgba(34,197,94,0.25);
}
.badge-online-new {
    background: rgba(59,130,246,0.1);
    color: #2563eb;
    border: 1px solid rgba(59,130,246,0.25);
}

/* ─── Play button ─── */
.btn-play-movie {
    width: 100%;
    padding: 10px 0;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-top: auto;
}
.btn-play-movie:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}

/* ─── Watch tips (replaces old "观看说明") ─── */
.watch-tips { }
.tip-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s ease;
}
.tip-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}
.tip-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.tip-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tip-text strong {
    font-size: 0.9rem;
    color: var(--text-heading);
}
.tip-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════
   VIDEO MODAL (enhanced)
   ═══════════════════════════════════════════════════ */
.video-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.88);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.video-modal-overlay.active {
    display: flex;
}
.video-modal-box {
    position: relative;
    width: 90%;
    max-width: 960px;
    background: #111;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.video-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.video-modal-header h5 {
    color: #fff;
    margin: 0;
    font-size: 1rem;
}
.video-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.video-modal-close:hover { opacity: 1; }
.video-modal-box video {
    width: 100%;
    max-height: 70vh;
    display: block;
    background: #000;
}

/* ─── Loading spinner ─── */
.video-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: #111;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 2;
    color: #94a3b8;
    font-size: 0.9rem;
}
.video-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Dark mode overrides ─── */
[data-theme="dark"] .movie-card-new {
    background: #1e293b;
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .filter-btn {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
    color: #e2e8f0;
}
[data-theme="dark"] .filter-btn.active {
    background: var(--primary);
    color: #fff;
}
[data-theme="dark"] .season-bar {
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
[data-theme="dark"] .tip-card {
    background: #1e293b;
    border-color: rgba(255,255,255,0.06);
}

/* ═══════════════════════════════════════════════════
   SIDEBAR TREE — 左侧目录树
   ═══════════════════════════════════════════════════ */

.sidebar-tree-wrapper {
    width: 260px;
    min-width: 260px;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    position: sticky;
    top: 76px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
}

.sidebar-tree {
    padding: 12px 0;
    font-size: 0.88rem;
}

.sidebar-tree-header {
    padding: 8px 16px;
    font-weight: 700;
    color: var(--text-heading);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

/* 搜索框 */
.sidebar-search {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    margin: 0 10px 8px;
    background: var(--bg-body);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}
.sidebar-search:focus-within { border-color: var(--primary); }
.sidebar-search i { color: var(--text-muted); font-size: 0.85rem; margin-right: 8px; }
.sidebar-search input {
    border: none; background: transparent;
    outline: none; color: var(--text-body);
    font-size: 0.85rem; width: 100%;
}

/* 目录项 */
.tree-item {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-body);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.tree-item:hover { background: var(--chat-hover); color: var(--primary); }
.tree-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.tree-item i { width: 18px; text-align: center; font-size: 0.9rem; }
.tree-badge {
    margin-left: auto;
    font-size: 0.75rem;
    background: var(--chat-hover);
    padding: 1px 8px;
    border-radius: 10px;
    color: var(--text-muted);
}
.tree-item.active .tree-badge { background: var(--primary); color: #fff; }

/* 电视剧分组 */
.tree-series-group { margin: 2px 0; }
.tree-series-header {
    padding: 8px 16px 8px 24px;
    cursor: pointer;
    color: var(--text-body);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    user-select: none;
    font-weight: 500;
}
.tree-series-header:hover { background: var(--chat-hover); color: var(--primary); }
.tree-arrow { font-size: 0.7rem; transition: transform 0.2s ease; width: 12px; }
.tree-series-header.collapsed .tree-arrow { transform: rotate(90deg); }
.tree-folder-icon { color: var(--primary); font-size: 0.9rem; }

.tree-series-body { padding-left: 42px; }

.tree-season-header {
    padding: 4px 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.tree-episode {
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-body);
    font-size: 0.82rem;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tree-episode:hover { background: var(--chat-hover); color: var(--primary); }
.tree-episode.active { background: var(--primary-light); color: var(--primary); }
.tree-episode i { font-size: 0.75rem; color: var(--text-muted); }

/* 右侧内容区 */
.main-content {
    padding: 20px 24px;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
}

.category-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.season-label {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
    margin-top: 8px;
}

/* 响应式 - 小屏隐藏侧栏 */
@media (max-width: 768px) {
    .sidebar-tree-wrapper { display: none; }
    .main-content { padding: 12px; }
}

/* 暗色模式 */
[data-theme="dark"] .sidebar-tree-wrapper {
    background: #1e293b;
    border-right-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .tree-item:hover,
[data-theme="dark"] .tree-series-header:hover,
[data-theme="dark"] .tree-episode:hover { background: rgba(255,255,255,0.05); }


/* ── 2026-08-19 三阶：电影卡片航海化 ── */
.movie-card-new { transition: transform .25s var(--transition), box-shadow .25s; }
.movie-card-new:hover { transform: translateY(-3px); }
.movie-cover { position: relative; }
.movie-cover::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .25s; pointer-events: none; }
.movie-card-new:hover .movie-cover::after { box-shadow: inset 0 0 0 2px var(--primary); }
.movie-title { color: var(--text-heading); transition: color .2s; }
.movie-card-new:hover .movie-title { color: var(--primary); }
