/* /css/style.css */

/* --- FONTS (Local) --- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-v20-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-v20-latin-700.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/orbitron-v35-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/orbitron-v35-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/orbitron-v35-latin-700.woff2') format('woff2'); }
@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:swap;src:url("/assets/fontawesome/webfonts/fa-solid-900.woff2") format("woff2");}


/* --- VARIABLES --- */
:root {
    --accent-color: #00C9FF;
    --bg-main: #1a202c;
    --bg-card: #1f2937;
    --border-color: #4a5568;
    --text-color: #e2e8f0;
    --text-muted: #a0aec0;
    --gold-color: #facc15;
    --strike-color: #ef4444;
    --correct-color: #48bb78;
    --elevated-color: #facc15;
    --high1-color: #f97316;
    --high2-color: #ef4444;
    --crisis-color: #b91c1c;
}

/* --- BASE STYLES --- */
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    background-image: url('/images/bg-pattern.svg');
    color: var(--text-color);
    overflow-x: hidden;
}

.main-content-wrapper { width: 100%; min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 20px; box-sizing: border-box; }
.app-container { width: 100%; max-width: 1100px; margin: 0 auto; }

/* --- CARDS --- */
.card { background-color: var(--bg-card); border-radius: 0.75rem; padding: 1.5rem; margin-bottom: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); animation: fadeIn 0.5s ease; height: 100%; box-sizing: border-box; position: relative; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Login Card Specifics */
.login-card-width { max-width: 400px; margin: 40px auto; height: auto; }

h1, h2 { font-family: 'Orbitron', sans-serif; color: var(--accent-color); margin-top: 0; }
h1 { font-size: 2rem; text-align: center; margin-bottom: 1.5rem; }
h2 { font-size: 1.3rem; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px; }

/* --- HEADER LAYOUT (Updated for Mobile) --- */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 10px 0; flex-wrap: wrap; gap: 10px; }
.dashboard-header .brand { font-family: 'Orbitron', sans-serif; font-size: 1.5rem; font-weight: bold; color: #fff; display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; gap: 10px; align-items: center; }

@media (max-width: 600px) {
    .dashboard-header { justify-content: center; }
    .brand-container { width: 100%; text-align: center; display: flex; justify-content: center; margin-bottom: 10px; }
    .header-actions { width: 100%; justify-content: center; }
}

/* --- DASHBOARD GRID --- */
.dashboard-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; align-items: start; }
.gauge-card, .heart-age-card, .stats-card, .entry-card, .history-card { grid-column: span 12; }

@media (min-width: 1024px) {
    .gauge-card { grid-column: span 8; }
    .heart-age-card { grid-column: span 4; }
    .stats-card { grid-column: span 5; }
    .entry-card { grid-column: span 7; }
    .history-card { grid-column: span 12; }
}

/* --- CHART STYLES --- */
.chart-wrapper { position: relative; width: 100%; height: 250px; margin-bottom: 15px; }
.unlock-trigger { z-index: 20; position: relative; }

/* --- INPUTS & FORMS --- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; align-items: flex-end; }
.input-group { display: flex; flex-direction: column; }
.input-group label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 600; }
.input-group input, .input-group select { background-color: var(--bg-main); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 0.5rem; padding: 0.65rem; font-size: 1rem; width: 100%; box-sizing: border-box; font-family: 'Inter', sans-serif; transition: border-color 0.2s; }
.input-group input:focus { outline: none; border-color: var(--accent-color); }

.password-reqs { background: rgba(0,0,0,0.2); border-radius: 8px; padding: 10px; margin-top: 5px; font-size: 0.8rem; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.password-reqs p { margin: 0; display: flex; align-items: center; gap: 6px; }
.password-reqs .invalid { color: var(--text-muted); opacity: 0.7; }
.password-reqs .valid { color: var(--correct-color); font-weight: bold; opacity: 1; }
.password-reqs .valid i::before { content: "\f058"; } 

/* --- BUTTONS --- */
.btn { font-family: 'Orbitron', sans-serif; font-size: 0.95rem; padding: 0.6rem 1.2rem; border-radius: 0.5rem; border: none; cursor: pointer; font-weight: bold; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background-color: var(--accent-color); color: var(--bg-main); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { background-color: var(--border-color); cursor: not-allowed; }
.btn-outline { background-color: transparent; border: 1px solid var(--accent-color); color: var(--accent-color); }
.btn-outline:hover { background-color: rgba(0, 201, 255, 0.1); }
.btn-outline-danger { background-color: transparent; border: 1px solid var(--strike-color); color: var(--strike-color); }
.btn-outline-danger:hover { background-color: rgba(239, 68, 68, 0.1); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; text-decoration: underline; padding: 0; font-family: 'Inter', sans-serif; font-size: 0.9rem; }

/* --- LEGAL PAGE BACK BUTTON (Fixed) --- */
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; color: #ffffff; text-decoration: none; font-weight: bold; font-family: 'Orbitron', sans-serif; transition: all 0.2s; background: rgba(0,0,0,0.2); padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border-color); }
.back-link:hover { border-color: var(--accent-color); color: var(--accent-color); background: rgba(0, 201, 255, 0.1); }

.auth-buttons-center { display: flex; justify-content: center; width: 100%; }
.btn-wide { width: 100%; max-width: 300px; } 
.btn-full-grid-column { grid-column: 1 / -1; width: 100%; margin-top: 10px; }

/* --- WIDGETS --- */
.heart-age-container { text-align: center; padding: 5px; position: relative; }
.heart-age-text { font-family: 'Orbitron', sans-serif; font-size: 2.5rem; font-weight: bold; margin-bottom: 10px; line-height: 1; }
.age-bar-container { width: 100%; height: 25px; background: #333; border-radius: 12px; overflow: hidden; position: relative; display: flex; margin-bottom: 10px; }
.age-bar { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: bold; color: #000; transition: width 1s ease-in-out; white-space: nowrap; overflow: hidden; }
.real-age { background: var(--accent-color); }
.heart-age { background: var(--strike-color); }

.gauge-container { display: grid; grid-template-columns: 1fr; gap: 1rem; justify-items: center; align-items: center; }
@media(min-width: 600px) { .gauge-container { grid-template-columns: 1fr 1fr; } }
.gauge { position: relative; width: 100%; max-width: 280px; }
.gauge-value { position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%); font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: bold; }
.gauge-label { position: absolute; bottom: -5%; left: 50%; transform: translateX(-50%); font-size: 0.9rem; color: var(--text-muted); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.8rem; text-align: center; }
.stat-item { background: rgba(0,0,0,0.2); padding: 10px; border-radius: 8px; }
.stat-item h3 { margin: 0 0 0.3rem 0; font-size: 0.8rem; color: var(--text-muted); font-family: 'Inter', sans-serif; font-weight: normal; }
.stat-item p { margin: 0; font-size: 1.2rem; font-weight: bold; color: var(--text-color); font-family: 'Orbitron', sans-serif;}

.history-header-flex { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.history-filter { margin-bottom: 0; min-width: 140px; }
.history-table-wrapper { overflow-x: auto; max-height: 300px; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; font-size: 0.9rem; }
.history-table th { color: var(--gold-color); text-transform: uppercase; letter-spacing: 1px; position: sticky; top: 0; background: var(--bg-card); }
.history-table th:last-child { text-align: right; }
.no-wrap { white-space: nowrap; }
.text-right { text-align: right; }
.actions-cell { text-align: right !important; white-space: nowrap; }
.actions-cell button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; margin-left: 0.5rem; transition: color 0.2s; }
.actions-cell button:hover { color: var(--accent-color); }
.actions-cell button.delete-btn:hover { color: var(--strike-color); }

.bp-level { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.bp-normal { background-color: var(--correct-color); }
.bp-elevated { background-color: var(--elevated-color); }
.bp-high1 { background-color: var(--high1-color); }
.bp-high2 { background-color: var(--high2-color); }
.bp-crisis { background-color: var(--crisis-color); animation: pulse-red 1s infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(185, 28, 28, 0); } 100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0); } }

.text-center { text-align: center; }
.text-accent { color: var(--accent-color); }
.text-success { color: var(--correct-color); }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-1-5 { margin-top: 1.5rem; }
.flex-center { display: flex; justify-content: center; }
.min-h-65 { min-height: 65px; }
.hidden { display: none !important; }
.block { display: block !important; }
.error-message { color: var(--strike-color); text-align: center; margin-top: 1rem; font-weight: bold; display: none; }
.error-message.active { display: block; }

/* --- FREEMIUM UI & LOCKS --- */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.badge-free { background-color: var(--bg-card); border: 1px solid var(--text-muted); color: var(--text-muted); }
.badge-pro { background-color: rgba(0, 201, 255, 0.1); border: 1px solid var(--accent-color); color: var(--accent-color); box-shadow: 0 0 8px rgba(0, 201, 255, 0.2); }

.btn-locked { opacity: 0.6; cursor: not-allowed; }
.btn-locked::after { content: '\f023'; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: 6px; color: var(--gold-color); font-size: 0.9em; }

.premium-blur { filter: blur(5px); pointer-events: none; opacity: 0.5; }
.lock-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; text-align: center; width: 100%; }
.lock-overlay i { font-size: 2rem; color: var(--gold-color); margin-bottom: 5px; text-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.lock-overlay p { margin: 0; font-weight: bold; text-shadow: 0 2px 5px rgba(0,0,0,0.5); }

/* --- MODALS & SOS --- */
.btn-sos { background-color: #ef4444; color: white; animation: pulse-sos 1.5s infinite; box-shadow: 0 0 10px #ef4444; border: none; }
.btn-sos:hover { background-color: #b91c1c; }
@keyframes pulse-sos { 
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } 
}

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 2000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(8px); }
.modal-content { background: var(--bg-card); padding: 2rem; border-radius: 1rem; max-width: 400px; width: 90%; text-align: center; border: 1px solid var(--accent-color); box-shadow: 0 0 30px rgba(0, 201, 255, 0.15); position: relative; }
.close-modal { position: absolute; top: 15px; right: 15px; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.premium-feature-list { text-align: left; margin: 20px 0; list-style: none; padding: 0; }
.premium-feature-list li { margin-bottom: 12px; display: flex; align-items: center; }
.premium-feature-list li i { color: var(--correct-color); margin-right: 12px; width: 20px; text-align: center; }

/* --- FOOTER & DISCLAIMERS --- */
.footer-container{width:100%;max-width:100%;margin:0 auto;padding:20px;height:200px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;box-sizing:border-box;}
.disclaimer-block { max-width: 600px; margin: 0 auto 15px auto; font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 15px; }
.separator { margin: 0 5px; color: var(--text-muted); }
.footer-link-style { color: #888; text-decoration: underline; transition: color 0.2s; }
.footer-link-style:hover { color: var(--accent-color); }

/* --- AI INSIGHT CLASSES --- */
.ai-summary-box { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 8px; margin-bottom: 15px; }
.ai-summary-title { margin-top: 0; color: var(--accent-color); }
.ai-trend-box { margin-bottom: 10px; }
.ai-pp-text { margin-top: 10px; font-size: 0.9em; border-top: 1px solid #444; padding-top: 10px; }
.ai-rec-box { border-left: 3px solid var(--gold-color); padding-left: 10px; }

/* --- LEGAL & UTILITIES --- */
.w-full { width: 100%; }
.span-full { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }
.flex-row-center { display: flex; align-items: center; gap: 10px; }
.flex-gap-10 { display: flex; gap: 10px; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.font-09 { font-size: 0.9rem; }
.pos-relative { position: relative; }
.w-50 { width: 50%; }
.flex-gap-center { display: flex; gap: 10px; align-items: center; }
.register-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.btn-gold-outline { border-color: var(--gold-color); color: var(--gold-color); }
.voice-listening { display: block; color: var(--accent-color); }
.voice-success { color: var(--correct-color); }
.voice-error { color: var(--strike-color); }
.voice-status-base { font-size: 0.8rem; margin-top: 5px; text-align: center; }
.text-xs-muted { font-size: 0.6em; display: block; color: var(--text-muted); }
.text-danger { color: var(--strike-color); }
.text-success { color: var(--correct-color); }
.bg-danger { background-color: var(--strike-color); }
.bg-success { background-color: var(--correct-color); }
.cookie-banner{min-height:40px; z-index: 9999; }
.cookie-wrapper { max-width: 800px; margin: 0 auto; }
.cookie-text { margin: 0 0 15px 0; font-size: 0.9rem; line-height: 1.5; }
.cookie-link-color { color: #00C9FF; font-weight: bold; text-decoration: underline; padding: 2px; }
.cookie-btn-group { display: flex; justify-content: center; gap: 10px; }
.cookie-outline-btn { border-color: #666; color: #ccc; }
#loginScreen, #appScreen { display: none; }
#loginScreen.active, #appScreen.active { display: block; }

/* --- NEW FEATURES & INFO --- */
.meds-checkbox { width: 20px; height: 20px; accent-color: var(--correct-color); cursor: pointer; }
.pointer { cursor: pointer; }
.tags-wrapper { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.tag-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 12px; border-radius: 20px; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif; }
.tag-btn.active { background: rgba(0, 201, 255, 0.15); border-color: var(--accent-color); color: var(--accent-color); font-weight: 600; }
.tag-btn:hover { border-color: var(--text-muted); }
.btn-icon-only { padding: 0.4rem; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-left: 8px; flex-shrink: 0; }
.info-content-scroll { max-height: 60vh; overflow-y: auto; text-align: left; }
.info-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 15px; }
.info-table th { border-bottom: 1px solid var(--border-color); padding: 8px; color: var(--gold-color); text-align: left; }
.info-table td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.bp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.bg-elevated { background-color: var(--elevated-color); }
.bg-high1 { background-color: var(--high1-color); }
.bg-high2 { background-color: var(--high2-color); }
.bg-crisis { background-color: var(--crisis-color); }
.info-h3 { font-size: 1rem; color: var(--text-color); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.info-list { padding-left: 20px; margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }
.info-list li { margin-bottom: 6px; }
.opacity-50 { opacity: 0.5; }
.support-textarea { resize: none; background: var(--bg-main); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 0.5rem; padding: 10px; font-family: inherit; width: 100%; box-sizing: border-box; }

/* --- GOAL & CARD INFO --- */
.card-info-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; margin-left: auto; font-size: 0.9rem; transition: color 0.2s; }
.card-info-btn:hover { color: var(--accent-color); }
.goal-container { background: rgba(0,0,0,0.2); padding: 10px; border-radius: 8px; margin-top: 15px; text-align: center; }
.goal-bar-track { width: 100%; height: 8px; background: #333; border-radius: 4px; margin: 8px 0; overflow: hidden; }
.goal-bar-fill { height: 100%; width: 0; background: var(--correct-color); transition: width 1s ease-out; }
.goal-text { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* --- LOADING OVERLAY --- */
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-main); z-index: 9999; display: flex; justify-content: center; align-items: center; }

/* LEGAL SPECIFIC */
.legal-body { background-color: var(--bg-main); color: var(--text-color); font-family: 'Inter', sans-serif; padding: 20px; margin: 0; overflow-x: hidden; }
.legal-container { max-width: 800px; width: 100%; margin: 20px auto; padding: 20px; background: var(--bg-card); border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); border: 1px solid var(--border-color); box-sizing: border-box; }
.legal-h1 { color: var(--accent-color); border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-top: 0; font-family: 'Orbitron', sans-serif; font-size: 1.5rem; }
.legal-h2 { margin-top: 30px; color: #fff; font-family: 'Inter', sans-serif; font-size: 1.2rem; border-left: 3px solid var(--accent-color); padding-left: 10px; }
.legal-p, .legal-li { line-height: 1.7; color: var(--text-muted); margin-bottom: 15px; font-size: 0.95rem; }
.legal-divider { border: 0; border-top: 1px solid var(--border-color); margin: 40px 0; }
.medical-disclaimer { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--strike-color); padding: 20px; border-radius: 8px; margin-bottom: 30px; }
.medical-title { color: var(--strike-color); margin-top: 0; display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: bold; }
.medical-text { margin-bottom: 0; color: #e2e8f0; font-size: 0.95rem; }