/* css/style.css - 空气感终极版 (15% 透明度 + 强模糊) */

:root {
    /* === 默认深色模式 (Dark Mode) === */
    --primary-color: #5c7cfa; 
    --secondary-color: #ff9dbf;
    
    /* 深色背景 */
    --bg-gradient: radial-gradient(circle at top left, #2d3748 0%, #1a202c 100%);
    --bg-header: rgba(26, 32, 44, 0.85);
    --bg-categories: rgba(26, 32, 44, 0.95);
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(0, 0, 0, 0.2);
    --bg-dock: rgba(0, 0, 0, 0.75);
    --bg-modal: rgba(5, 7, 10, 0.96);
    
    /* 🟢 极限调整：透明度降至 0.15 (15%) */
    --bg-floating: rgba(20, 20, 25, 0.45);
    
    --text-main: #f8fafc;
    --text-sub: rgba(255,255,255,0.9); /* 再次提亮文字，弥补背景过透 */
    
    --border-light: rgba(255, 255, 255, 0.12);
    --border-hover: rgba(255, 255, 255, 0.25);
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --footer-height: 100px; 
}

/* === 浅色模式 (Light Mode) === */
[data-theme="light"] {
    --primary-color: #4c6ef5;
    --secondary-color: #f06595;
    
    /* 浅色背景 */
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-header: rgba(255, 255, 255, 0.85);
    --bg-categories: rgba(255, 255, 255, 0.95);
    --bg-card: rgba(255, 255, 255, 0.6);
    --bg-input: rgba(0, 0, 0, 0.05);
    --bg-dock: rgba(255, 255, 255, 0.85);
    --bg-modal: rgba(240, 242, 245, 0.98);
    
    /* 🟢 极限调整：透明度降至 0.15 */
    --bg-floating: rgba(255, 255, 255, 0.25);
    
    --text-main: #1e293b;
    --text-sub: #334155; /* 加深文字 */
    
    --border-light: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    user-select: none; 
}

html { width: 100%; margin: 0; padding: 0; }

body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    width: 100%;
    display: flex; flex-direction: column;
    position: relative;
    padding-bottom: var(--footer-height); 
}

body::before {
    content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-gradient);
    z-index: -1; pointer-events: none;
}

header {
    flex: 0 0 auto; position: -webkit-sticky; position: sticky; top: 0;
    background: var(--bg-header);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 0.8rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    z-index: 100;
    border-bottom: 1px solid var(--border-light);
}

header > * { margin-right: 1.5rem; }
header > *:last-child { margin-right: 0; }

h1 {
    font-size: 1.4rem;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text; background-clip: text;
    color: transparent; -webkit-text-fill-color: transparent;
    margin: 0; white-space: nowrap; font-weight: 700; letter-spacing: 0.5px;
}

.header-mid-search { flex: 0 1 450px; position: relative; height: 44px; }

.search-input {
    width: 100%; height: 100%; padding: 0 1rem 0 2.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 12px; color: var(--text-main);
    font-size: 1rem; outline: none; transition: var(--transition);
}
.search-input:focus {
    background: var(--bg-card); border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(92, 124, 250, 0.2);
}
.search-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-sub); width: 18px; height: 18px; pointer-events: none;
}

/* Theme Button */
.theme-btn {
    background: var(--bg-input); border: none;
    width: 40px; height: 40px; border-radius: 50%;
    color: var(--text-main); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.theme-btn:active { transform: scale(0.9); }

.categories {
    flex: 0 0 auto; position: -webkit-sticky; position: sticky; top: 70px; z-index: 90;
    display: flex; justify-content: flex-start; align-items: center;
    overflow-x: auto; padding: 0.8rem 1.5rem;
    background: var(--bg-categories);
    width: 100%; scrollbar-width: none; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.categories::-webkit-scrollbar { display: none; }

.category-btn {
    flex: 0 0 auto; padding: 0 1.2rem; height: 36px; line-height: 34px;
    background: transparent; border: 1px solid transparent;
    color: var(--text-sub); border-radius: 8px; cursor: pointer;
    font-size: 0.95rem; font-weight: 500; white-space: nowrap;
    margin-right: 0.5rem; transition: all 0.2s;
}
.category-btn:hover { background: var(--bg-input); color: var(--text-main); }
.category-btn.active { 
    background: var(--primary-color); color: white; 
    box-shadow: 0 4px 12px rgba(92, 124, 250, 0.4);
}

.sort-container {
    margin-left: auto; display: flex; align-items: center;
    background: var(--bg-input); padding: 4px; border-radius: 8px;
}
.sort-container span { font-size: 0.85rem; padding: 0 0.5rem; color: var(--text-sub); margin-right: 0; }
.sort-btn {
    padding: 0 1rem; height: 32px; line-height: 30px;
    background: transparent; border: none; 
    color: var(--text-sub); border-radius: 6px; cursor: pointer;
}
.sort-btn.active { background: var(--bg-card); color: var(--text-main); font-weight: 600; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

.gallery {
    flex: 1; height: auto; min-height: 200px; width: 100%;
    display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: auto;
    grid-gap: 1rem; gap: 1rem; padding: 1rem 1.5rem;
}

.wallpaper-card {
    background: var(--bg-card);
    border-radius: 16px; overflow: hidden; position: relative; width: 100%;
    /* 删掉 aspect-ratio: 16/10; */
    height: 200px; /* 你自己调这个值，比如 180、220、250 */
    border: 1px solid var(--border-light);
    box-shadow: var(--card-shadow); transition: var(--transition);
}

.wallpaper-card:active { transform: scale(0.96); }
.wallpaper-card:hover {
    transform: translateY(-4px); border-color: var(--border-hover);
    box-shadow: var(--card-hover-shadow);
}
.wallpaper-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    padding: 3rem 1rem 0.8rem;
    opacity: 0; transition: opacity 0.2s;
}
.wallpaper-card:hover .overlay { opacity: 1; }

.wallpaper-title { font-size: 1rem; font-weight: 600; color: white; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallpaper-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: rgba(255,255,255,0.9); margin-top: 0.4rem; }

.pagination {
    position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%);
    width: auto; min-width: 320px; height: 60px; padding: 0 2rem;
    background: var(--bg-dock);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 100px; border: 1px solid var(--border-light);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex; justify-content: center; align-items: center; z-index: 200;
}

.pagination-btn {
    padding: 0 1.5rem; height: 36px; font-weight: 600; font-size: 0.95rem;
    background: var(--bg-input); border: none;
    color: var(--text-main); border-radius: 20px; cursor: pointer; margin: 0 1rem;
    transition: all 0.2s;
}
.pagination-btn:active { background: var(--primary-color); color: white; transform: scale(0.95); }
.pagination-btn.disabled { opacity: 0.3; background: transparent; pointer-events: none; }
.page-indicator { 
    font-size: 1.1rem; font-weight: 700; margin: 0 1rem; color: var(--text-main); letter-spacing: 1px;
}

footer { display: none; }

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-modal);
    z-index: 2000; opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
    display: flex; flex-direction: column; overflow: hidden; 
}
.modal.active { opacity: 1; pointer-events: all; }

.modal-content { flex: 1; position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; }
.modal-img-container {
    flex: 1; position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding-bottom: 0;
}
.modal-img { 
    /* 🔴 删除 max-width/max-height */
    /* max-width: 100%; max-height: 100%; */
    
    /* 🟢 新增：强制占满容器 */
    width: 100%; 
    height: 100%; 
    
    /* 🟢 核心：保持比例缩放 */
    /* contain: 保持比例放大，直到宽或高的一边抵住边缘，内容完整显示 */
    object-fit: contain; 
    
    box-shadow: 0 0 100px rgba(0,0,0,0.2); 
}

/* 悬浮面板 */
.floating-info {
    position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%);
    width: 85%; max-width: 1100px;
    
    /* 引用变量 (已调至 0.15) */
    background: var(--bg-floating);
    
    border: 1px solid var(--border-light);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1); /* 阴影稍微减淡，配合通透感 */
    
    /* 🟢 增强模糊：从 20px 提升到 40px，弥补低不透明度带来的可读性问题 */
    @supports (backdrop-filter: blur(10px)) {
        backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(40px);
    }
    
    padding: 1.5rem; border-radius: 28px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 100;
}
.floating-info > * { margin-bottom: 1rem; }
.floating-info > *:last-child { margin-bottom: 0; }

.modal.active .floating-info { transform: translateX(-50%) translateY(0); }

.modal-title { 
    font-size: 1.8rem; color: var(--text-main); margin: 0; font-weight: 700; margin-bottom: 0.5rem; 
    text-shadow: 0 2px 15px rgba(0,0,0,0.6); /* 增强文字阴影 */
}
.modal-details { 
    display: flex; justify-content: center; margin-bottom: 1rem; color: var(--text-sub); font-size: 0.9rem; 
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.modal-details span { 
    background: var(--bg-input); padding: 0.3rem 0.8rem; border-radius: 6px; 
    margin: 0 0.5rem; border: 1px solid var(--border-light);
}

.modal-actions { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; margin-top: 0.5rem; }
.modal-actions .btn { margin: 0.5rem; }

.btn {
    height: 48px; padding: 0 1.8rem; font-size: 1rem; font-weight: 600;
    border: none; border-radius: 100px; 
    display: inline-flex; align-items: center; justify-content: center;
    color: white; background: var(--primary-color);
    box-shadow: 0 4px 15px rgba(92, 124, 250, 0.3);
    transition: all 0.2s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; margin-right: 0.6rem; }
.btn:active { transform: scale(0.96); }

.btn-welcome-screen { background: #8b5cf6; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-night-wallpaper, .btn-night-app-wallpaper {
    background: #334155; border: 1px solid rgba(255,255,255,0.1); box-shadow: none;
}
.btn-night-wallpaper:hover, .btn-night-app-wallpaper:hover { background: #475569; }

.btn-close {
    position: absolute; top: 30px; right: 30px; width: 56px; height: 56px;
    background: var(--bg-input); border-radius: 50%;
    color: var(--text-main); border: none; font-size: 2rem;
    display: flex; align-items: center; justify-content: center; z-index: 50;
    backdrop-filter: blur(10px); transition: all 0.2s;
}
.btn-close:active { background: var(--bg-card); transform: rotate(90deg) scale(0.9); }

.nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.2); color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1); width: 80px; height: 160px; 
    border-radius: 16px; font-size: 3rem; z-index: 20;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); transition: all 0.2s;
}
.nav-btn:active { background: rgba(255, 255, 255, 0.2); color: white; transform: translateY(-50%) scale(0.95); }
.prev-btn-nav { left: 20px; }
.next-btn-nav { right: 20px; }

/* Loader */
.loader {
    position: absolute; top: 50%; left: 50%; 
    margin-left: -30px; margin-top: -30px;
    width: 60px; height: 60px;
    border: 5px solid var(--border-light);
    border-top-color: var(--primary-color); border-radius: 50%;
    animation: spin 0.8s infinite linear; z-index: 15;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.placeholder {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-sub);
}

/* Page Loading Overlay */
.page-loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--dark-color);
    z-index: 9999; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.5s;
}
.page-loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.page-spinner {
    width: 60px; height: 60px; border: 4px solid var(--border-light);
    border-top-color: var(--primary-color); border-radius: 50%;
    animation: spin 0.8s infinite linear; margin-bottom: 20px;
}
.page-loading-text { color: var(--text-sub); font-size: 1rem; letter-spacing: 2px; }

@media (max-width: 600px) {
    .header-mid-search { flex: 1; }
    .gallery { grid-template-columns: repeat(3, 1fr); }
    .modal-actions { justify-content: center; }
    .btn { width: 100%; }
    .pagination { min-width: 90%; }
}










/* --- 类型切换按钮 (Type Switch) --- */
.type-switch {
    display: flex;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 8px;
    margin-right: 1.5rem;
}

.type-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: var(--text-sub);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.type-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- 视频角标 (Video Badge) --- */
.video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
    pointer-events: none; /* 让点击穿透到卡片 */
}

/* 手机端适配类型切换 */
@media (max-width: 600px) {
    header {
        flex-wrap: wrap;
        gap: 10px;
    }
    .type-switch {
        order: 2; /* 放在第二行 */
        width: 100%;
        margin-right: 0;
        justify-content: center;
    }
    .header-mid-search {
        order: 1;
        flex: 1 1 70%;
    }
    .header-controls {
        order: 1;
    }
}



/* 🟢 补充：动态壁纸专属按钮样式 */
/* 为了不破坏原有样式，我们新增两个类，保持和原有按钮一致的设计语言 */

/* 1. 日间动态壁纸 (日出橙金色) */
.btn-video-day {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-video-day:active {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* 2. 夜间动态壁纸 (深邃极光紫) */
.btn-video-night {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-video-night:active {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
}