/* 玫瑰 AI 5.0 核心 UI 系统 (2025/12/25 最终加固版) */

:root {
    /* 核心色值 */
    --accent-primary: #FF2E4D;
    --accent-secondary: #FF6B81;
    --accent-gradient: linear-gradient(135deg, #FF2E4D, #FF8E9E);
    
    /* 基础背景与文字 */
    --bg-surface: #FFFFFF;
    --bg-app: #F6F8FA;
    --text-title: #0F172A;
    --text-body: #475569;
    --text-mute: #94A3B8;
    
    /* 玻璃态效果 */
    --glass-effect: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.8);
    
    /* 圆角与阴影 */
    --radius-xl: 32px;
    --radius-l: 24px;
    --radius-m: 16px;
    --radius-s: 12px;
    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
    --shadow-float: 0 20px 50px -12px rgba(0, 0, 0, 0.1);
    
    /* 安全区域 */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

/* --- 基础重置 --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; -webkit-text-size-adjust: 100%; }
body { 
    background: var(--bg-app); 
    color: var(--text-body); 
    font-family: 'Inter', -apple-system, 'SF Pro Display', system-ui, sans-serif; 
    letter-spacing: -0.01em;
    line-height: 1.5;
    overflow-x: hidden;
}

/* 核心 App 容器 */
.app-shell { 
    width: 100%; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    margin: 0 auto; 
    position: relative; 
    background: var(--bg-app);
}
@media (min-width: 501px) { .app-shell { max-width: 500px; box-shadow: 0 0 100px rgba(0,0,0,0.05); } }

/* --- 顶部导航规范 --- */
.page-header {
    position: sticky; top: 0; z-index: 2000;
    background: var(--glass-effect); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    padding: calc(12px + var(--safe-top)) 20px 12px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    width: 100%;
}
.header-left, .header-right { min-width: 42px; display: flex; align-items: center; }
.header-center { flex: 1; display: flex; justify-content: center; }
.page-title { font-size: 18px; font-weight: 800; color: var(--text-title); letter-spacing: -0.02em; }

.nav-back-btn {
    width: 38px; height: 38px; background: rgba(0,0,0,0.04); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--text-title);
    text-decoration: none; transition: 0.2s;
}
.nav-back-btn:active { transform: scale(0.9); background: rgba(0,0,0,0.08); }

/* --- 卡片系统 --- */
.glass-card { background: var(--bg-surface); border-radius: var(--radius-l); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-subtle); border: 1px solid var(--glass-border); }
.card-header-modern { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.header-dot { width: 8px; height: 8px; border-radius: 50%; }
.header-dot.red { background: #FF2E4D; }
.header-dot.blue { background: #4D7CFF; }
.header-dot.orange { background: #FFA940; }
.header-dot.green { background: #52C41A; }

/* --- 表单与输入 --- */
.input-group-modern { margin-bottom: 20px; }
.label-modern { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 800; color: var(--text-title); opacity: 0.9; }
.input-modern { width: 100%; padding: 16px; background: #F1F5F9; border: 1px solid transparent; border-radius: 16px; font-size: 15px; font-weight: 500; color: var(--text-title); outline: none; transition: 0.3s; }
.input-modern:focus { background: #fff; border-color: var(--accent-primary); box-shadow: 0 0 0 4px rgba(255, 46, 77, 0.1); }
.textarea-modern { width: 100%; height: 120px; padding: 16px; background: #F1F5F9; border: 1px solid transparent; border-radius: 16px; font-size: 15px; font-weight: 500; color: var(--text-title); outline: none; resize: none; transition: 0.3s; }
.textarea-modern:focus { background: #fff; border-color: var(--accent-primary); box-shadow: 0 0 0 4px rgba(255, 46, 77, 0.1); }

/* --- 结果显示区 --- */
.result-container-modern { margin-top: 32px; display: none; }
.result-card-modern { background: #fff; border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow-float); border: 1px solid var(--glass-border); position: relative; }
.result-head-modern { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.copy-pill-modern { padding: 6px 14px; background: #F1F5F9; border: none; border-radius: 12px; font-size: 12px; font-weight: 700; color: var(--accent-primary); cursor: pointer; transition: 0.2s; }
.copy-pill-modern:active { transform: scale(0.9); }

/* --- 首页特定组件 --- */
.welcome-banner { 
    background: #fff; 
    padding: 32px 24px; 
    border-radius: var(--radius-xl); 
    box-shadow: var(--shadow-subtle); 
    margin: 0 0 32px 0; /* 移除左右外边距，使用全局 Padding */
    position: relative; 
}
.welcome-h { font-size: 32px; font-weight: 900; color: var(--text-title); line-height: 1.1; margin-bottom: 12px; }

.pill-tabs { display: flex; gap: 8px; background: rgba(0,0,0,0.03); padding: 6px; border-radius: 20px; margin-bottom: 24px; width: 100%; }
.pill-tab { flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 700; border-radius: 16px; color: var(--text-mute); transition: 0.3s; }
.pill-tab.active { background: #fff; color: var(--accent-primary); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
.tool-card {
    background: #fff; padding: 24px 16px; border-radius: var(--radius-l);
    box-shadow: var(--shadow-subtle); display: flex; flex-direction: column; align-items: center; text-align: center;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.tool-card:active { transform: scale(0.96); opacity: 0.9; }
.tool-icon { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 12px; }
.tool-info h3 { font-size: 16px; font-weight: 800; color: var(--text-title); margin-bottom: 4px; }
.tool-info p { font-size: 11px; color: var(--text-mute); line-height: 1.3; }

/* AI 工具箱专用 3 列布局 */
.tools-grid-ai { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.tool-card-ai {
    background: #fff; padding: 16px 8px; border-radius: var(--radius-m);
    box-shadow: var(--shadow-subtle); display: flex; flex-direction: column; align-items: center; text-align: center;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.tool-card-ai:active { transform: scale(0.96); opacity: 0.9; }
.tool-card-ai .tool-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 8px; }
.tool-card-ai .tool-info h3 { font-size: 13px; font-weight: 800; color: var(--text-title); margin-bottom: 2px; white-space: nowrap; }
.tool-card-ai .tool-info p { font-size: 9px; color: var(--text-mute); line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* --- 底部 Dock 导航 --- */
.bottom-dock {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 460px;
    height: 72px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px;
    display: flex; justify-content: space-around; align-items: center; padding: 0 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    z-index: 3000;
}
.dock-btn { display: flex; flex-direction: column; align-items: center; color: rgba(255,255,255,0.4); text-decoration: none; gap: 6px; transition: 0.3s; }
.dock-btn.active { color: #fff; }
.dock-btn i { font-size: 20px; }
.dock-btn span { font-size: 10px; font-weight: 700; }
.active-dot { width: 4px; height: 4px; background: var(--accent-primary); border-radius: 50%; position: absolute; bottom: -10px; }

/* --- 按钮 --- */
.btn-primary-modern {
    width: 100%; padding: 18px; background: var(--accent-gradient); color: #fff;
    border: none; border-radius: 20px; font-size: 16px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 10px 25px rgba(255, 46, 77, 0.2); transition: 0.3s;
}
.btn-primary-modern:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary-modern:disabled { opacity: 0.6; pointer-events: none; }

/* --- 通知系统 --- */
.neo-toast {
    position: fixed; top: 24px; left: 50%; transform: translate(-50%, -150%);
    width: 85%; max-width: 360px; z-index: 9999; background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border-radius: 22px;
    border: 1px solid #fff; box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s;
    opacity: 0; pointer-events: none;
}
.neo-toast.active { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-content { padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.toast-icon-wrapper { width: 38px; height: 38px; background: var(--accent-gradient); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.toast-text { display: flex; flex-direction: column; }
.toast-title { font-size: 14px; font-weight: 800; color: var(--text-title); }
#toastMsg { font-size: 12px; color: var(--text-mute); }

/* --- 图片放大查看器 (回归极简纯净版) --- */
.img-preview-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.9); z-index: 100000; 
    display: none; align-items: center; justify-content: center; 
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
}
.img-preview-overlay.active { display: flex; animation: fadeIn 0.3s ease; }

.preview-img-container { 
    width: 90%; height: 90%; 
    display: flex; align-items: center; justify-content: center; 
}
.preview-img-container img { 
    max-width: 100%; max-height: 100%; 
    border-radius: 12px; 
    box-shadow: 0 0 50px rgba(0,0,0,0.5); 
}

.close-preview { 
    position: absolute; top: calc(20px + var(--safe-top)); right: 20px; 
    color: #fff; font-size: 28px; cursor: pointer; padding: 10px; z-index: 100001;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- AI 检测仪表盘 (通用组件) --- */
.detector-card { background: #fff; border-radius: var(--radius-l); padding: 24px; text-align: center; box-shadow: var(--shadow-subtle); border: 1px solid var(--glass-border); }
.gauge-container { width: 140px; height: 140px; margin: 0 auto 15px; position: relative; }
.gauge-svg { transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: #F1F5F9; stroke-width: 10; }
.gauge-fill { fill: none; stroke: url(#gauge-grad); stroke-width: 10; stroke-dasharray: 377; stroke-dashoffset: 377; transition: stroke-dashoffset 2s cubic-bezier(0.34, 1.56, 0.64, 1); stroke-linecap: round; }
.gauge-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; }
.gauge-val { font-size: 28px; font-weight: 900; color: var(--text-title); line-height: 1; }
.gauge-unit { font-size: 11px; color: var(--text-mute); font-weight: 700; margin-top: 4px; }

.detector-stats { display: flex; justify-content: space-between; margin-top: 20px; padding: 0 10px; }
.stat-point { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.point-dot { width: 8px; height: 8px; border-radius: 50%; }
.point-label { font-size: 11px; font-weight: 700; color: var(--text-mute); }
.point-val { font-size: 14px; font-weight: 800; color: var(--text-title); }
