/* --- 全局变量定义 --- */
:root {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-main: #1d1d1f;
    --text-sub: #424245;
    --primary-color: #007AFF;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --table-border: rgba(0,0,0,0.05);
    --input-bg: rgba(255, 255, 255, 0.6);
    --dropdown-bg: #ffffff;
    --footer-text: #666;
    --hover-bg: #f5f5f7;
}

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-main: #ffffff;
    --text-sub: #f0f0f0;
    --primary-color: #60a5fa;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --table-border: rgba(255,255,255,0.15);
    --input-bg: rgba(255, 255, 255, 0.1);
    --dropdown-bg: #1e293b;
    --footer-text: #cbd5e1;
    --hover-bg: rgba(255,255,255,0.1);
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    padding-bottom: 60px;
    transition: color 0.3s, background 0.3s;
    font-size: 16px;
    overflow-x: hidden; 
    width: 100%;
}

/* --- 组件 --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: visible !important; 
    z-index: 1;
    transition: background 0.3s, border 0.3s;
}

.table-scroll-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    display: block;
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #007AFF, #0055b3);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
    transition: all 0.3s;
    font-size: 1rem;
}
.btn-primary:hover { transform: scale(1.02); filter: brightness(1.1); }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; }

.glass-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.glass-table th { text-align: left; padding: 16px; color: var(--text-sub); font-size: 1rem; border-bottom: 1px solid var(--table-border); font-weight: 600; }
.glass-table td { padding: 16px; border-bottom: 1px solid var(--table-border); color: var(--text-main); vertical-align: middle; }

.glass-select, input[type="text"], input[type="month"] {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0 14px;
    height: 46px;
    border-radius: 12px;
    outline: none;
    width: 100%;
    font-size: 1rem;
}
input[type="month"] { appearance: none; }

.header-glow { color: #007AFF; text-shadow: 0 0 25px rgba(0, 122, 255, 0.6); font-weight: 800; letter-spacing: 1px; }
[data-theme="dark"] .header-glow { color: #3b82f6; text-shadow: 0 0 30px rgba(59, 130, 246, 0.8); }
.typewriter-cursor { display: inline-block; width: 3px; background-color: var(--text-main); animation: blink 1s infinite; margin-left: 2px; vertical-align: middle; height: 1.2em; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.top-bar { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 20px; }
.icon-btn {
    background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-main);
    width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; backdrop-filter: blur(10px);
}
.icon-btn:hover { transform: scale(1.1); background: var(--input-bg); }

.dropdown-wrapper { position: relative; z-index: 1000; }
.glass-dropdown-btn {
    background: var(--input-bg); border: 1px solid var(--glass-border); color: var(--text-main);
    padding: 0 16px; height: 46px; border-radius: 12px; font-size: 1rem; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 160px; user-select: none;
}
.glass-dropdown-btn:hover { background: var(--glass-border); }
.glass-dropdown-menu {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 8px; width: 320px;
    background: var(--dropdown-bg); border: 1px solid var(--glass-border); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4); z-index: 2000; flex-direction: column; overflow: hidden; pointer-events: auto;
}
.glass-dropdown-menu.show { display: flex; animation: menuPop 0.1s ease-out; }
.dropdown-scroll-area { max-height: 350px; overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.checkbox-item { display: flex; align-items: center; padding: 12px 14px; margin-bottom: 2px; border-radius: 8px; cursor: pointer; transition: background 0.1s; width: 100%; box-sizing: border-box; }
.checkbox-item:hover { background: var(--hover-bg); }
.checkbox-item span { color: var(--text-main); font-size: 1rem; line-height: 1.4; }
.checkbox-item input[type="checkbox"] { appearance: none; width: 22px; height: 22px; border: 2px solid #c7c7cc; border-radius: 50%; margin-right: 14px; flex-shrink: 0; background: transparent; position: relative; }
.checkbox-item input[type="checkbox"]:checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.checkbox-item input[type="checkbox"]:checked::after { content: ''; position: absolute; top: 4px; left: 4px; width: 10px; height: 6px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg); }
.dropdown-footer { border-top: 1px solid var(--table-border); padding: 12px; background: var(--glass-bg); display: flex; justify-content: flex-end; }

#lang-menu { width: 160px; background: var(--dropdown-bg); }
#lang-menu .checkbox-item { padding: 10px 14px; }
#lang-menu .checkbox-item:hover { background: var(--primary-color); }
#lang-menu .checkbox-item:hover span { color: white; }

@keyframes menuPop { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.site-footer { text-align: center; margin-top: 40px; padding: 20px; color: var(--footer-text); font-size: 0.9rem; border-top: 1px solid var(--glass-border); }
.ai-bubble { background: var(--input-bg); color: var(--text-main); border-radius: 18px; padding: 20px; border-left: 4px solid var(--primary-color); font-size: 1rem; line-height: 1.6; }
.btn-delete { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,0.1); color: var(--text-sub); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; }
.btn-delete:hover { background: #ff3b30; color: white; }

/* 弹窗样式 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 3000; opacity: 0; visibility: hidden; transition: all 0.3s; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-box { background: var(--dropdown-bg); color: var(--text-main); padding: 30px; border-radius: 24px; width: 340px; text-align: center; border: 1px solid var(--glass-border); }
/* ★★★ 修复点：增加间距，分开按钮 ★★★ */
.modal-btn-group { display: flex; gap: 20px; justify-content: center; margin-top: 25px; }
.modal-btn { padding: 10px 24px; border-radius: 12px; font-weight: 600; cursor: pointer; border: none; }
.modal-btn-cancel { background: var(--input-bg); color: var(--text-main); }
.modal-btn-confirm { background: #ff3b30; color: white; }