/* === 核心变量与重置 === */
:root {
  /* 背景调得更透一点 (0.7)，让高斯模糊更明显，营造液态感 */
  --glass-bg: rgba(30, 30, 35, 0.70);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent-color: #007AFF; /* Apple Blue */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
}

.hidden { display: none !important; }

body {
    background-color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--text-primary);
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* === 玻璃面板基础 === */
.glass-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* === 顶部 Logo & 时间容器 === */
.header-container {
    display: flex;
    align-items: center; 
    gap: 25px; 
    padding: 15px 35px;
    border-radius: 20px;
    transition: all 0.3s;
}
.header-container:hover {
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.logo-area {
    font-weight: 800;
    letter-spacing: -0.5px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-align: right;
}

.separator {
    width: 2px;
    height: 45px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.time-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
    text-align: center;
}

/* === 模态框通用 === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9990;
    background: rgba(0,0,0,0.4); /* 背景适当加深 */
    display: none;
}
.modal-overlay.active { display: block; }

/* 设置弹窗 (右下角) */
#settings-modal {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 400px;
    max-height: 85vh;
    z-index: 9999;
    transform-origin: bottom right;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
}
#settings-modal.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* === 图标编辑弹窗 (核心修复) === */
#icon-modal-wrapper {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}
#icon-modal-wrapper.active {
    opacity: 1;
    pointer-events: auto;
}

.glass-modal-content {
    background: var(--glass-bg);
    /* 核心：高斯模糊 + 饱和度，模拟 Apple 液态玻璃 */
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: 0 40px 80px -12px rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 24px !important; 
}

/* 编辑弹窗固定尺寸 */
.edit-modal-size {
    width: 560px;
    transform: scale(0.95);
    transition: transform 0.3s;
}
#icon-modal-wrapper.active .edit-modal-size {
    transform: scale(1);
}

/* === 核心：固定高度区域 === */
/* 增加到 110px 确保两行输入框不会重叠 */
/* .input-area-fixed {
    width: 100%;
    height: 110px; 
    position: relative;
    /* overflow: hidden; */ /* 调试时可开启，目前关闭以允许阴影溢出 */

.edit-form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
/* 左侧标签统一宽度，确保上下对齐 */
.edit-label {
    width: 40px; /* 固定宽度 */
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}
/* 移除之前的固定高度容器，改用自然流式布局，防止重叠 */
.input-group-wrapper {
    transition: all 0.2s;
}

/* === 控件样式 === */
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 12px;
    margin-top: 24px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08); /* 仅保留底部分割 */
    display: flex;
    align-items: center;
}
.section-title:first-child { margin-top: 0; }

.setting-group {
    background: rgba(255,255,255,0.03); 
    border-radius: 12px;
    padding: 12px 6px; 
    margin-bottom: 10px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.9);
}

/* === 玻璃输入框 === */
.glass-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    font-size: 13px;
    width: 100%;
    transition: 0.2s;
    appearance: none; 
}
.glass-input:focus, .glass-input:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}
.glass-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* Select 美化 */
select.glass-input {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
}
option { background-color: #222; color: white; padding: 10px; }

/* === 按钮风格化 === */
.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 8px 24px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    transition: transform 0.1s, background 0.2s;
}
.btn-primary:hover { background: #0062cc; }
.btn-primary:active { transform: scale(0.96); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.2); color: white; }

/* === Toggle Group (Tab切换) === */
.toggle-group {
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 10px;
    display: flex;
}
.toggle-btn {
    flex: 1;
    padding: 6px;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    transition: 0.2s;
    font-weight: 500;
}
.toggle-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* === 颜色选择器美化 === */
.color-preview-wrapper {
    width: 42px;
    height: 38px;
    border-radius: 8px;
    overflow: hidden; /* 关键：确保内部input不溢出 */
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    background: #000;
}
.color-picker-input {
    -webkit-appearance: none;
    border: none;
    padding: 0;
    width: 150%; 
    height: 150%;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%); /* 居中放大 */
    background: transparent;
    cursor: pointer;
}

/* Switch 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255, 255, 255, 0.15); transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 2px; bottom: 2px; background-color: white; transition: .3s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: #34C759; }
input:checked + .slider:before { transform: translateX(20px); }

/* Range Slider */
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; margin: 10px 0; display: block; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 6px; cursor: pointer; background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
input[type=range]::-webkit-slider-thumb { height: 18px; width: 18px; border-radius: 50%; background: #ffffff; cursor: pointer; -webkit-appearance: none; margin-top: -6px; box-shadow: 0 2px 5px rgba(0,0,0,0.4); transition: transform 0.1s; }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.1); }

/* App Item Hover */
.app-item:hover .glass-panel { transform: scale(1.1); background: rgba(255,255,255,0.2); box-shadow: 0 15px 30px rgba(0,0,0,0.3); z-index: 10; }

/* 背景层淡入动画 */
#bg-layer.loaded { opacity: 1; }

.main-content { padding-top: clamp(48px, 10vh, 140px); }

/* === 1. 解决弹窗跳动：固定输入区域高度 === */
.input-fixed-container {
    height: 84px; /* 根据两行输入框的高度计算得出，固定死 */
    width: 100%;
    /* 配合 index.html 里的 absolute 定位，实现原位切换 */
}

/* 确保切换时的淡入淡出效果 */
.input-group-wrapper {
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 1;
    transform: translateY(0);
}
.input-group-wrapper.hidden {
    display: block !important; /* 覆盖默认 hidden，改用透明度控制 */
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    transform: translateY(5px);
}

/* === 2. 确认弹窗样式与动画 === */
#confirm-modal-wrapper {
    /* 核心定位样式 (之前缺失的部分) */
    position: fixed;
    inset: 0; /* 占满全屏 */
    z-index: 10001; /* 确保层级极高，盖过所有元素 */
    background: rgba(0, 0, 0, 0.5); /* 半透明黑背景 */
    backdrop-filter: blur(8px); /* 背景模糊 */
    
    /* 弹性布局居中 */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 默认隐藏状态 */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

#confirm-modal-wrapper.active {
    opacity: 1;
    pointer-events: auto;
}

#confirm-modal-content {
    /* 初始稍微缩小，激活时放大 */
    transform: scale(0.95);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#confirm-modal-wrapper.active #confirm-modal-content {
    transform: scale(1);
    opacity: 1;
}

