/* css/liquid.css */

/* =========================================
   1. Design Tokens (HEU Campus Blur Edition)
   ========================================= */
:root {
    /* --- 背景设置 --- */
    /* ⚠️ 请将此处替换为你本地的 HEU 图片路径，例如: url('../images/heu_bg.jpg') */
    /* 这里暂时使用一张类似学院风格的在线图作为演示 */
    --bg-image-url: url('../images/bg.jpg');
    
    --bg-blur: 10px;               /* 模糊程度，越大越抽象 */
    --bg-scale: 1.1;               /* 默认放大一点，防止模糊边缘露白 */
    
    /* --- 遮罩层 (Overlay) --- */
    /* 浅色模式：叠加白色半透明，让背景清透 */
    --overlay-color: rgba(255, 255, 255, 0.65);
    --noise-opacity: 0.008;         /* 噪点浓度 */

    /* --- UI 组件配色 (保持不变) --- */
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    --text-main: #0f172a;
    --text-sub: #64748b;
    
    --input-bg: rgba(255, 255, 255, 0.3);
    --input-bg-hover: rgba(255, 255, 255, 0.5);
    --input-border: rgba(255, 255, 255, 0.4);
    --btn-bg: rgba(255, 255, 255, 0.5);
    --btn-bg-hover: rgba(255, 255, 255, 0.8);
    
    --primary: #007AFF;
    --danger: #ff3b30;
    --radius-panel: 32px;
    --radius-elem: 14px;
}

/* --- 深色模式适配 --- */
@media (prefers-color-scheme: dark) {
    :root {
        /* 深色模式：叠加黑色半透明，让背景深邃 */
        --overlay-color: rgba(0, 0, 0, 0.75);
        --noise-opacity: 0.008;

        /* UI 适配 */
        --glass-bg: rgba(30, 30, 30, 0.5);
        --glass-border: rgba(255, 255, 255, 0.1);
        --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
        
        --text-main: #f1f5f9;
        --text-sub: #94a3b8;
        
        --input-bg: rgba(255, 255, 255, 0.08);
        --input-bg-hover: rgba(255, 255, 255, 0.15);
        --input-border: rgba(255, 255, 255, 0.08);
        --btn-bg: rgba(255, 255, 255, 0.1);
        --btn-bg-hover: rgba(255, 255, 255, 0.2);
    }
}

/* =========================================
   2. Global Reset & HEU Blur Background
   ========================================= */
* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* 移除纯色背景，让位于图片 */
    background-color: #333;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    transition: color 0.3s ease;
}

@font-face { font-family: 'keeprun'; src: url(../DINCond-Bold.otf); }

/* --- 核心：全屏背景容器 --- */
.ambient-background {
    position: fixed;
    inset: 0;
    z-index: -10;
    overflow: hidden;
    background-color: #000; /* 图片加载前的底色 */
}

/* 1. 图片层 (负责显示 HEU 校园) */
.bg-image {
    position: absolute;
    /* 扩大范围以避免模糊带来的边缘白边 */
    inset: -50px;
    background-image: var(--bg-image-url);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    
    /* 核心效果：模糊 + 缓慢缩放呼吸 */
    filter: blur(var(--bg-blur));
    
    /* 硬件加速 */
    will-change: transform;
}

/* 2. 遮罩层 (负责深浅模式变暗/变亮) */
.bg-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--overlay-color);
    transition: background-color 0.5s ease;
}

/* 3. 噪点纹理层 (提升质感) */
.noise-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: var(--noise-opacity);
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- 极慢的呼吸动画 (Ken Burns Effect) --- */
@keyframes slow-breathe {
    0% {
        transform: scale(1.1) translate(0, 0);
    }
    100% {
        /* 缓慢放大并微调位置 */
        transform: scale(1.25) translate(-2%, -1%);
    }
}


/* =========================================
   3. Layout & Components (保持原有布局逻辑)
   ========================================= */

#main-div {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start;
    gap: 50px; padding: 60px 20px; max-width: 1280px; margin: 0 auto;
}

/* 左侧预览 */
.new-img {
    position: relative; width: 360px; height: 719px; background: #fff;
    border-radius: 50px;
    box-shadow: 0 0 0 12px #1a1a1a, 0 50px 100px -20px rgba(0,0,0,0.4);
    overflow: hidden; flex-shrink: 0; user-select: none;
    contain: content;
}
@media (prefers-color-scheme: dark) {
    .new-img { box-shadow: 0 0 0 12px #000, 0 50px 100px -20px rgba(0,0,0,0.6); }
}

/* 内部元素 */
.new-img img { display: block; }
.new-img #gui-img, .new-img .bgimgwrap, .new-img .innerbgimg { position: absolute; top: 0; left: 0; width: 360px; height: 719px; }
.new-img .bgimgwrap { display: flex; justify-content: center; align-items: center; background: #333; }
.new-img .portrait-wrap { width: 40px; height: 40px; position: absolute; top: 335px; left: 284px; border-radius: 50%; overflow: hidden; z-index: 2; }
.new-img .portrait { width: 100%; height: 100%; object-fit: cover; }
.new-img .weather-imgwrap { position: absolute; top: 426.5px; left: 238px; width: 14px; height: 14px; z-index: 2; }
.new-img .weather { width: 100%; height: 100%; }

/* 预览区文字 */
.username { position: absolute; top: 385px; right: 34px; font-size: 13px; color: #333; font-family: "Microsoft YaHei", sans-serif; font-weight: bold; }
.keep-title { position: absolute; top: 361px; left: 30px; font-size: 12px; color: #a2a2a2; font-family: sans-serif; }
.mile { position: absolute; top: 387px; left: 32px; font-family: 'keeprun', sans-serif !important; color: #57525d; }
.mile-data { font-size: 50px; display: inline-block; transform: scale(1, 0.85); transform-origin: top left; letter-spacing: -1px; }
.gongli { font-size: 12px; margin-left: 5px; position: relative; top: -5px; }
.datetime, .env { position: absolute; font-size: 13px; color: #a2a2a2; font-family: sans-serif; transform: scale(0.9); }
.date { top: 407px; left: 222px; } .time { top: 407px; left: 296px; }
.temperature { top: 424px; left: 252px; } .humidity { top: 424px; left: 303px; }
.speed-time { position: absolute; font-family: 'keeprun', sans-serif !important; font-size: 28px; color: #58505b; transform: scale(1, 0.85); transform-origin: top left; top: 480px; }
.speed { left: 32px; letter-spacing: -0.5px; } .cost-time { left: 140px; letter-spacing: -0.5px; } .calorie { right: 32px; }

/* 右侧控制面板 */
.set-data { flex: 1; min-width: 320px; max-width: 500px; display: flex; flex-direction: column; gap: 24px; }

.glass-card, .export-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-panel);
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease;
    contain: content;
}
.glass-card { padding: 28px; }
.export-panel { padding: 20px; margin-bottom: 20px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }

/* 按钮 */
button {
    cursor: pointer; border: none; padding: 0 16px;
    border-radius: var(--radius-elem);
    font-weight: 600; transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    height: 44px; white-space: nowrap; flex-shrink: 0;
}
.main-save { background: var(--text-main); color: #fff; height: 50px; font-size: 15px; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
@media (prefers-color-scheme: dark) { .main-save { color: #000; } }
.main-save:hover { transform: scale(1.02); opacity: 0.95; }

.main-preview { background: var(--btn-bg); border: 1px solid var(--input-border); color: var(--text-main); height: 50px; font-size: 15px; }
.main-preview:hover { background: var(--btn-bg-hover); }

.backup-btn { background: rgba(255,255,255,0.15); border: 1px solid var(--input-border); color: var(--text-sub); height: 36px; font-size: 12px; }
.backup-btn:hover { background: var(--btn-bg-hover); color: var(--text-main); }

/* 表单 */
.divider { height: 1px; background: var(--input-border); margin: 24px -28px; opacity: 0.3; }
.input-group { margin-bottom: 24px; }
.group-title { font-size: 12px; letter-spacing: 1px; color: var(--text-sub); margin-bottom: 12px; font-weight: 700; opacity: 0.8; }

input[type="text"], select {
    height: 38px; padding: 0 12px;
    border-radius: var(--radius-elem);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    transition: all 0.2s;
    width: auto; min-width: 60px; max-width: 100%;
    will-change: width;
}
.font-mono { font-family: inherit; font-weight: 500; letter-spacing: 0; }
input[type="text"]:focus, select:focus {
    background: var(--input-bg-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.input-with-prefix {
    display: inline-flex; align-items: center;
    background: var(--input-bg); border: 1px solid var(--input-border);
    border-radius: var(--radius-elem); padding-left: 12px; height: 38px;
    width: fit-content; max-width: 100%;
}
.input-with-prefix input { background: transparent; border: none; box-shadow: none; padding-left: 4px; height: 100%; min-width: 80px; }
.input-with-prefix:focus-within { background: var(--input-bg-hover); border-color: var(--primary); }
.prefix { font-size: 13px; color: var(--text-sub); white-space: nowrap; }

.btn-small { height: 32px; font-size: 12px; padding: 0 14px; background: var(--btn-bg); border: 1px solid var(--input-border); color: var(--text-main); border-radius: 8px; width: auto; }
.btn-small:hover { background: var(--btn-bg-hover); }
.btn-text { background: transparent; color: var(--text-sub); height: 32px; padding: 0 10px; font-size: 13px; }
.btn-text:hover { color: var(--text-main); background: rgba(255,255,255,0.1); border-radius: 8px; }

.flex-group { display: flex; gap: 8px; align-items: center; flex: 1; flex-wrap: nowrap; overflow: hidden; }
.flex-group select { flex: 1; min-width: 0; }
.flex-group button { flex: 0 0 auto; }

.sub-setting {
    display: inline-flex; align-items: center;
    background: transparent; border-left: 2px solid var(--input-border);
    padding: 4px 0 4px 12px; margin-left: 78px; margin-bottom: 12px;
    font-size: 12px; gap: 6px;
}
.sub-label { color: var(--text-sub); }
.mini-input { min-width: 45px !important; height: 30px !important; border-radius: 8px !important; text-align: center; background: var(--input-bg) !important; padding: 0 4px !important; font-size: 13px !important; }
.dash { color: var(--text-sub); margin: 0 2px; }

.datetime-row { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-sub); flex-wrap: nowrap; }
.year-inp, .date-inp, .time-inp { min-width: 38px !important; text-align: center; padding: 0 2px !important; flex: 0 1 auto; height: 32px !important; border-radius: 8px !important; background: var(--input-bg) !important; }
.year-inp { min-width: 52px !important; }
.spacer { width: 8px; }

.dual-input { display: flex; align-items: center; gap: 10px; }
.dual-input input { min-width: 50px; text-align: center; }
.unit { font-size: 12px; color: var(--text-sub); }

.switch-row { margin-left: 78px; display: flex; gap: 24px; margin-bottom: 12px; }
.switch-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-main); }
input[type="checkbox"] {
    appearance: none; width: 40px; height: 22px; border-radius: 11px; background: var(--input-border);
    position: relative; cursor: pointer; transition: background 0.3s; border: none; flex-shrink: 0; min-width: 40px !important; width: 40px !important;
}
input[type="checkbox"]::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.7, 1);
}
input[type="checkbox"]:checked { background: #34C759; }
input[type="checkbox"]:checked::after { transform: translateX(18px); }

.system-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 5px; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: rgba(255, 59, 48, 0.1); border-radius: 8px; }

.file-action-row { display: flex; gap: 8px; align-items: center; width: 100%; }

@media (max-width: 800px) {
    #main-div { flex-direction: column; align-items: center; padding: 20px; gap: 30px; }
    .new-img { transform: scale(0.9); margin-bottom: -40px; }
    .set-data { width: 100%; max-width: 100%; }
    .sub-setting, .switch-row { margin-left: 0; border-left: none; padding-left: 0; }
    li { flex-wrap: wrap; }
}

/* Patches & Fixes */
.setDataList li { display: flex; align-items: center; margin-bottom: 14px; gap: 4px !important; justify-content: flex-start; flex-wrap: nowrap; }
.setDataList li label { min-width: 0 !important; width: auto !important; flex: 0 0 auto !important; margin-right: 2px !important; text-align: right; font-size: 14px; color: var(--text-main); font-weight: 500; opacity: 0.9; white-space: nowrap; }
.flex-group select { flex: 0 1 auto !important; width: fit-content !important; min-width: 60px; max-width: 65%; padding-right: 25px !important; }
.flex-group button { flex-shrink: 0 !important; white-space: nowrap; }
.input-with-prefix { display: inline-flex !important; width: auto !important; flex-wrap: nowrap !important; gap: 2px !important; }
.prefix { margin-right: 0 !important; padding-right: 2px !important; }
.input-with-prefix input { flex-shrink: 0 !important; flex-grow: 0 !important; width: auto; min-width: 80px !important; }
.time-inp, .year-inp, .date-inp, .mini-input, #inpt_temperature, #inpt_humidity { padding: 0 2px !important; min-width: 25px !important; text-align: center !important; width: auto; }
.year-inp { min-width: 40px !important; }
#inpt_miles, #inpt_speeds, #inpt_savePic_width, .mile2-inp, .range-input { text-align: center !important; padding: 0 5px !important; }
