/* =========================================
   文娱志 (Media Log) · 独立配色版
   颜色值基于 config.json 固化，不再依赖 PHP 动态生成
   支持 data-color-mode 属性切换深浅模式
   2025-03-30 更新：Hero 模式黑色渐变 + 白色标题
========================================= */

/* ---------- 基础变量定义：浅色模式（默认） ---------- */
:root,
:root[data-color-mode='light'] {
    --bg-page: #f5f5f7;
    --text-main: #1d1d1f;
    --text-secondary: #6e6e73;
    --card-bg: rgba(255, 255, 255, 0.7);
    --border-subtle: rgba(128, 128, 128, 0.2);
    --border-light: rgba(128, 128, 128, 0.1);
}

/* ---------- 深色模式变量覆盖 ---------- */
:root[data-color-mode='dark'] {
    --bg-page: #000000;
    --text-main: #f5f5f7;
    --text-secondary: #86868b;
    --card-bg: rgba(28, 28, 30, 0.7);
    --border-subtle: rgba(128, 128, 128, 0.25);
    --border-light: rgba(128, 128, 128, 0.12);
}

/* ---------- 页面主容器 ---------- */
.media-page-wrapper {
    margin-top: calc(var(--nav-height, 60px) + 40px);
}

.media-main-tabs {
    margin-bottom: 30px;
    justify-content: flex-start;
}

/* 控制栏 */
.media-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 5px 12px;
}

.media-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.media-filter-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 40px;
    padding: 4px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-filter-btn:hover {
    background: rgba(128, 128, 128, 0.05);
}

.media-filter-btn.active {
    background: var(--text-main);
    color: var(--bg-page);
    border-color: var(--text-main);
    font-weight: 500;
}

.media-counter {
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ---------- 列表容器（卡片白底） ---------- */
.media-list {
    background: var(--card-bg);
    border-radius: 18px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.media-list-item {
    display: flex;
    gap: 20px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
}

.media-list-item:hover {
    background: rgba(128, 128, 128, 0.05);
}

.media-list-item:last-child {
    border-bottom: none;
}

/* 封面图 (3:4 比例) */
.media-list-cover {
    width: 72px;
    height: 96px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(128, 128, 128, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.media-list-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 24px;
}

.media-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 4px;
}

.media-list-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-list-meta {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 状态胶囊 */
.media-status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    width: fit-content;
}

.media-list-status {
    margin-top: 4px;
}

.status-default {
    color: var(--text-secondary);
    background: rgba(128, 128, 128, 0.1);
}

.status-done {
    color: #007aff;
    background: rgba(0, 122, 255, 0.1);
}

.status-doing {
    color: #34c759;
    background: rgba(52, 199, 89, 0.1);
}

.status-todo {
    color: #af52de;
    background: rgba(175, 82, 222, 0.1);
}

.status-none {
    color: #555555;
    background: rgba(0, 0, 0, 0.08);
}

html[data-color-mode="dark"] .status-done {
    color: #0a84ff;
    background: rgba(10, 132, 255, 0.15);
}

html[data-color-mode="dark"] .status-doing {
    color: #30d158;
    background: rgba(48, 209, 88, 0.15);
}

html[data-color-mode="dark"] .status-todo {
    color: #bf5af2;
    background: rgba(191, 90, 242, 0.15);
}

html[data-color-mode="dark"] .status-none {
    color: #aaaaaa;
    background: rgba(255, 255, 255, 0.12);
}

/* ---------- 详情弹窗 (环境光吸附特效) ---------- */
.media-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.media-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.media-ambient-bg {
    position: absolute;
    inset: -50px;
    background-size: cover;
    background-position: center;
    filter: blur(60px) saturate(150%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
}

html[data-color-mode="light"] .media-ambient-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
}

html[data-color-mode="dark"] .media-ambient-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.media-modal-content {
    width: 90%;
    max-width: 450px;
    height: 80vh;
    max-height: 650px;
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.media-modal-overlay.active .media-modal-content {
    transform: translateY(0) scale(1);
}

/* ========== Hero 模式 - 黑色渐变遮罩 + 强制白色标题 ========== */
.media-hero-header {
    position: relative;
    height: 280px;
    flex-shrink: 0;
}

.media-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.media-hero-mask {
    position: absolute;
    inset: 0;
    /* 黑色渐变：顶部透明 → 中部半透明黑 → 底部深黑 */
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0) 0%, 
        rgba(0, 0, 0, 0.6) 50%, 
        rgba(0, 0, 0, 0.85) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 10%, black 80%);
    mask-image: linear-gradient(to bottom, transparent 10%, black 80%);
}

.media-hero-title-box {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.media-hero-title-box h3 {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    color: #ffffff !important;      /* 强制白色 */
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.media-hero-title-box span {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff !important;      /* 强制白色 */
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* 标准头部（无背景图）样式不变 */
.media-std-header {
    padding: 40px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
}

.media-std-cover {
    width: 120px;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 16px;
}

.media-std-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-std-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
}

.media-std-header span {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 关闭按钮 */
.modal-close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(128, 128, 128, 0.3);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(128, 128, 128, 0.5);
}

.media-modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.media-modal-body::-webkit-scrollbar {
    width: 6px;
}

.media-modal-body::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.25);
    border-radius: 4px;
}

/* 元信息网格 */
.media-meta-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meta-block span {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.meta-block strong {
    font-size: 15px;
    color: var(--text-main);
    font-weight: 600;
}

.meta-pill-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* SVG 图标属性行 */
.media-attr-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.attr-icon-wrapper {
    display: inline-flex;
    align-items: center;
}

.attr-icon-wrapper img {
    height: 1.2rem;
    width: auto;
    object-fit: contain;
}

/* 深浅色图标自动切换（由 CSS 类控制） */
html[data-color-mode="light"] .icon-dark {
    display: none;
}
html[data-color-mode="light"] .icon-light {
    display: inline-block;
}
html[data-color-mode="dark"] .icon-light {
    display: none;
}
html[data-color-mode="dark"] .icon-dark {
    display: inline-block;
}

/* 标签胶囊 */
.media-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.media-pill {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(128, 128, 128, 0.08);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* 描述文本 */
.media-modal-desc {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    margin: 0;
}

/* 药丸 Tab */
.device-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 24px;
    border-radius: 50px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.tab-btn:hover {
    background: rgba(128, 128, 128, 0.1);
}

.tab-btn.active {
    background: var(--text-main);
    color: var(--bg-page);
    border-color: var(--text-main);
}

.tab-pane {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

.tab-pane.active {
    display: block;
    animation: tabFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes tabFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}