/* ============================================================
   吾季 v2.0 - 现代化UI
   ============================================================ */

:root {
    --primary: #4a6fa5;
    --primary-dark: #166088;
    --accent: #ff6b6b;
    --success: #28a745;
    --warning: #f0ad4e;
    --danger: #dc3545;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --border: #e9ecef;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --wood: #28a745; --fire: #dc3545; --earth: #fd7e14; --metal: #6c757d; --water: #17a2b8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, 'Microsoft YaHei', 'Segoe UI', sans-serif;
    line-height: 1.6; color: var(--dark);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f0 100%);
    min-height: 100vh;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.small { font-size: 0.85em; }

/* ---- Header ---- */
header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 12px 0;
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
header h1 { font-size: 1.4rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 10px; }
.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 0.9rem; }
.lang-switch {
    background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.4);
    color: #fff; padding: 5px 10px; border-radius: 20px; cursor: pointer;
    font-size: 0.8rem; font-weight: 600; transition: all 0.2s;
    display: flex; align-items: center; gap: 4px;
}
.lang-switch:hover { background: rgba(255,255,255,0.25); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-accent { background: linear-gradient(135deg, var(--accent), #ff4757); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid rgba(255,255,255,0.6); color: #fff; padding: 6px 14px; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Cards ---- */
.card {
    background: #fff; border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { color: var(--primary); margin-bottom: 16px; font-size: 1.25rem; display: flex; align-items: center; gap: 8px; }
.card h3 { color: var(--primary-dark); margin-bottom: 12px; font-size: 1.1rem; }
.card h4 { color: var(--primary); margin: 12px 0 8px; font-size: 1rem; }
.card ul { padding-left: 20px; }
.card li { padding: 4px 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }

/* ---- Hero / Landing ---- */
.hero-section {
    text-align: center; padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; border-radius: var(--radius); margin-bottom: 20px;
}
.hero-section h2 { font-size: 1.8rem; margin-bottom: 8px; }
.hero-section p { font-size: 1.1rem; opacity: 0.9; margin-bottom: 24px; }
.hero-features {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
    max-width: 600px; margin: 0 auto;
}
.feature-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 16px 8px; background: rgba(255,255,255,0.15); border-radius: var(--radius-sm);
}
.feature-item i { font-size: 1.5rem; margin-bottom: 4px; }
.feature-item span { font-weight: 600; font-size: 0.9rem; }
.feature-item small { font-size: 0.75rem; opacity: 0.8; }

/* ---- Forms ---- */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.9rem; color: var(--dark); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 0.95rem;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary);
}
.input-sm { padding: 8px 10px !important; font-size: 0.85rem !important; margin-top: 6px; }

/* ---- Bazi Display ---- */
.bazi-display { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bazi-pillar {
    text-align: center; padding: 14px; background: var(--light);
    border-radius: var(--radius-sm); border: 2px solid transparent;
    transition: all 0.2s;
}
.bazi-pillar:hover { border-color: var(--primary); transform: translateY(-2px); }
.pillar-label { font-size: 0.8rem; color: var(--gray); margin-bottom: 4px; }
.pillar-content { font-size: 1.4rem; font-weight: 700; color: var(--primary); }

/* ---- Wuxing Chart ---- */
.wuxing-chart { display: flex; flex-direction: column; gap: 8px; }
.wuxing-item { display: flex; align-items: center; gap: 10px; }
.wuxing-name { width: 28px; font-weight: 700; text-align: center; }
.wuxing-bar { flex: 1; height: 22px; background: var(--light); border-radius: 11px; overflow: hidden; }
.wuxing-fill { height: 100%; border-radius: 11px; transition: width 0.5s ease; }
.wuxing-value { width: 20px; font-weight: 600; font-size: 0.9rem; }
.wood { color: var(--wood); } .wuxing-fill.wood { background: var(--wood); }
.fire { color: var(--fire); } .wuxing-fill.fire { background: var(--fire); }
.earth { color: var(--earth); } .wuxing-fill.earth { background: var(--earth); }
.metal { color: var(--metal); } .wuxing-fill.metal { background: var(--metal); }
.water { color: var(--water); } .wuxing-fill.water { background: var(--water); }

/* ---- Risk Badge ---- */
.risk-badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 600; margin-left: 8px;
}
.risk-low { background: #d4edda; color: #155724; }
.risk-medium { background: #fff3cd; color: #856404; }
.risk-high { background: #f8d7da; color: #721c24; }

/* ---- Health Card ---- */
.health-card { border-left: 4px solid var(--primary); }
.health-card h3 { display: flex; align-items: center; gap: 8px; }

/* ---- Advice ---- */
.advice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.advice-card { background: var(--light); padding: 14px; border-radius: var(--radius-sm); }
.advice-card h4 { display: flex; align-items: center; gap: 6px; color: var(--primary); margin-bottom: 8px; }

/* ---- CTA ---- */
.cta-card { text-align: center; background: linear-gradient(135deg, #e3f2fd, #bbdefb); }
.cta-card h3 { justify-content: center; color: var(--primary-dark); }

/* ---- Dashboard Stats ---- */
.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 16px; text-align: center;
    box-shadow: var(--shadow); transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card i { font-size: 1.3rem; margin-bottom: 4px; }
.stat-card.streak i { color: #ff6b6b; }
.stat-card.score i { color: var(--success); }
.stat-card.ai i { color: var(--info); }
.stat-card.member i { color: #ffc107; }
.stat-number { font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.stat-label { font-size: 0.8rem; color: var(--gray); }

/* ---- Tabs ---- */
.tab-bar {
    display: flex; gap: 4px; background: #fff; border-radius: var(--radius);
    padding: 4px; margin-bottom: 16px; box-shadow: var(--shadow);
    overflow-x: auto;
}
.tab {
    flex: 1; padding: 10px 8px; border: none; background: transparent;
    border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
    display: flex; align-items: center; justify-content: center; gap: 4px;
}
.tab:hover { background: var(--light); }
.tab.active { background: var(--primary); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Checkin ---- */
.checkin-group {
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.checkin-group label { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.star-rating { display: inline-flex; gap: 4px; cursor: pointer; font-size: 1.4rem; color: #ddd; }
.star-rating span { transition: color 0.15s; }
.star-rating span:hover, .star-rating span.active { color: #ffc107; }

/* ---- Severity ---- */
.severity-slider { margin-top: 6px; }
.severity-slider input[type="range"] { width: 100%; }
.severity-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--gray); }

/* ---- Symptom Records ---- */
.symptom-records { display: flex; flex-direction: column; gap: 6px; }
.symptom-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--light); border-radius: var(--radius-sm); font-size: 0.9rem;
}
.symptom-date { color: var(--gray); font-size: 0.8rem; min-width: 80px; }
.symptom-name { font-weight: 600; flex: 1; }
.symptom-part { color: var(--gray); font-size: 0.85rem; }
.severity-dots { color: var(--accent); letter-spacing: 2px; }
.alert-box { background: #fff3cd; padding: 12px; border-radius: var(--radius-sm); margin-bottom: 12px; }

/* ---- Plan ---- */
.plan-header { margin-bottom: 16px; }
.plan-header h2 { margin-bottom: 8px; }
.plan-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 3px 10px; background: var(--primary); color: #fff; border-radius: 20px; font-size: 0.8rem; }
.plan-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.plan-section:last-child { border-bottom: none; }
.plan-section h3 { margin-bottom: 8px; }
.checklist-cat { margin: 8px 0; }
.checklist-cat h4 { font-size: 0.95rem; margin-bottom: 4px; }
.alert-section { background: #fff8e1; padding: 14px; border-radius: var(--radius-sm); margin: 8px 0; }
.daily-tip {
    margin-top: 16px; padding: 14px 18px; background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: var(--radius-sm); font-style: italic; color: #2e7d32;
}

/* ---- Trend ---- */
.trend-btns { display: flex; gap: 8px; margin-bottom: 16px; }
.score-bars { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.score-bar-row { display: flex; align-items: center; gap: 10px; }
.dim-name { width: 50px; font-size: 0.9rem; font-weight: 500; }
.score-bar-track { flex: 1; height: 18px; background: var(--light); border-radius: 9px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 9px; transition: width 0.5s; }
.dim-score { width: 30px; font-weight: 600; font-size: 0.9rem; text-align: right; }

/* ---- AI Chat ---- */
.ai-chat {
    max-height: 400px; overflow-y: auto; padding: 12px;
    background: var(--light); border-radius: var(--radius-sm);
    margin-bottom: 12px; min-height: 100px;
}
.chat-msg { display: flex; margin-bottom: 10px; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.ai { justify-content: flex-start; }
.chat-bubble {
    max-width: 80%; padding: 10px 14px; border-radius: 14px;
    font-size: 0.9rem; line-height: 1.5;
}
.chat-msg.user .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.ai .chat-bubble { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-source { display: block; font-size: 0.75rem; color: var(--gray); margin-top: 4px; }
.ai-input-area { display: flex; gap: 8px; margin-bottom: 10px; }
.ai-input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; }
.ai-input:focus { outline: none; border-color: var(--primary); }
.ai-quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Modal ---- */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #fff; padding: 32px; border-radius: var(--radius);
    width: 90%; max-width: 400px; position: relative;
}
.modal-close {
    position: absolute; top: 10px; right: 14px; background: none; border: none;
    font-size: 1.5rem; cursor: pointer; color: var(--gray);
}
.auth-switch { text-align: center; margin-top: 16px; font-size: 0.9rem; }
.auth-switch a { color: var(--primary); font-weight: 600; }

/* ---- Loading ---- */
.loading { display: none; text-align: center; padding: 20px; }
.loading-spinner {
    width: 40px; height: 40px; border: 4px solid var(--light);
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Footer ---- */
footer { padding: 24px 0; text-align: center; color: var(--gray); font-size: 0.85rem; margin-top: 32px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero-features { grid-template-columns: repeat(2, 1fr); }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .bazi-display { grid-template-columns: repeat(2, 1fr); }
    .tab { font-size: 0.78rem; padding: 8px 6px; }
    .tab i { display: none; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    header h1 { font-size: 1.1rem; }
    .hero-section h2 { font-size: 1.3rem; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .stat-number { font-size: 1.2rem; }
}

/* ============================================================
   Growth Engine Styles
   ============================================================ */

/* ---- Notification Bell ---- */
.notif-bell {
    position: relative; background: none; border: none; color: #fff;
    font-size: 1.1rem; cursor: pointer; padding: 4px 8px;
}
.notif-count {
    position: absolute; top: -4px; right: -4px; background: var(--accent);
    color: #fff; font-size: 0.65rem; width: 18px; height: 18px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.notif-panel {
    position: absolute; top: 50px; right: 16px; width: 300px; max-height: 400px;
    overflow-y: auto; background: #fff; border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15); z-index: 200;
}
.notif-item {
    padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: var(--light); }
.notif-title { font-weight: 600; font-size: 0.9rem; }
.notif-body { font-size: 0.8rem; color: var(--gray); margin-top: 2px; }
.notif-time { font-size: 0.7rem; color: #bbb; margin-top: 4px; }

/* ---- Badge Grid ---- */
.badge-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.badge-item {
    text-align: center; padding: 16px 8px; border-radius: var(--radius-sm);
    border: 2px solid var(--border); transition: all 0.2s; position: relative;
}
.badge-item.earned { border-color: var(--warning); background: #fffbeb; }
.badge-item.locked { opacity: 0.5; }
.badge-item i { font-size: 2rem; color: var(--warning); margin-bottom: 8px; display: block; }
.badge-item.locked i { color: var(--gray); }
.badge-name { font-weight: 600; font-size: 0.85rem; }
.badge-desc { font-size: 0.75rem; color: var(--gray); margin-top: 4px; }
.badge-date { font-size: 0.7rem; color: var(--success); margin-top: 4px; }
.badge-locked { position: absolute; top: 8px; right: 8px; font-size: 0.7rem; color: var(--gray); }

/* ---- Badge Popup ---- */
.badge-popup {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
    z-index: 2000; animation: fadeIn 0.3s;
}
.badge-popup-content {
    background: #fff; padding: 32px; border-radius: 16px; text-align: center;
    max-width: 320px; width: 90%; animation: bounceIn 0.4s;
}
.badge-popup-icon { font-size: 3rem; color: var(--warning); margin-bottom: 12px; }
.badge-popup-content h3 { margin-bottom: 8px; }
.badge-popup-content p { color: var(--gray); margin-bottom: 16px; }
@keyframes bounceIn { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---- Invite ---- */
.invite-code-box {
    display: flex; align-items: center; gap: 12px; padding: 16px;
    background: var(--light); border-radius: var(--radius-sm); margin-bottom: 12px;
}
.invite-code {
    font-size: 1.5rem; font-weight: 700; letter-spacing: 4px; color: var(--primary);
    font-family: monospace;
}

/* ---- Pricing ---- */
.pricing-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-top: 12px;
}
.pricing-card {
    text-align: center; padding: 24px 16px; border-radius: var(--radius);
    border: 2px solid var(--border); position: relative; transition: all 0.2s;
}
.pricing-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.pricing-card.popular { border-color: var(--accent); }
.pricing-tag {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff; padding: 2px 14px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
}
.pricing-price { font-size: 2rem; font-weight: 700; color: var(--primary); margin: 12px 0; }
.pricing-price span { font-size: 0.85rem; color: var(--gray); font-weight: 400; }
.modal-lg { max-width: 700px; }

/* ---- Onboarding ---- */
.onboard-progress {
    height: 6px; background: var(--light); border-radius: 3px;
    margin-bottom: 16px; overflow: hidden;
}
.onboard-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 3px; transition: width 0.5s; }
.onboard-step {
    display: flex; align-items: center; gap: 10px; padding: 10px 0;
    border-bottom: 1px solid var(--border); font-size: 0.95rem;
}
.onboard-step.done { color: var(--success); }
.onboard-step.done i { color: var(--success); }
.onboard-step i { color: var(--gray); width: 20px; }

/* ---- FAB Share ---- */
.fab-share {
    position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px;
    border-radius: 50%; background: var(--accent); color: #fff; border: none;
    font-size: 1.3rem; cursor: pointer; box-shadow: 0 4px 16px rgba(255,107,107,0.4);
    z-index: 50; transition: all 0.2s;
}
.fab-share:hover { transform: scale(1.1); }

/* ---- Outline Primary Button ---- */
.btn-outline-primary {
    background: transparent; border: 1.5px solid var(--primary); color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

/* ---- PWA Install Banner ---- */
.pwa-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: #fff; border-top: 2px solid var(--primary);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.pwa-banner-inner {
    max-width: 600px; margin: 0 auto; padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pwa-info { display: flex; align-items: center; gap: 12px; }
.pwa-info i { font-size: 1.6rem; color: var(--primary); }
.pwa-info strong { display: block; font-size: 0.95rem; }
.pwa-info small { color: var(--gray); font-size: 0.8rem; }
.pwa-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- Payment Modal ---- */
.payment-info { text-align: center; padding: 12px 0; }
.payment-amount { font-size: 2.2rem; font-weight: 700; color: var(--primary); margin: 8px 0; }
.payment-methods { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.pay-method-btn {
    flex: 1; padding: 14px; border: 2px solid var(--border); border-radius: 12px;
    background: #fff; cursor: pointer; font-size: 1rem; text-align: center;
    transition: all 0.2s; max-width: 180px;
}
.pay-method-btn:hover { border-color: var(--primary); }
.pay-method-btn.active { border-color: var(--primary); background: rgba(74,111,165,0.05); }
.pay-method-btn i { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.pay-method-btn[data-method="wechat"] i { color: #07c160; }
.pay-method-btn[data-method="alipay"] i { color: #1677ff; }
.payment-qr { text-align: center; padding: 24px; background: var(--light); border-radius: 12px; margin: 12px 0; }
.qr-placeholder { padding: 20px; }
