/* ============================================================
   Exposure Tracker - Dark Glass Morphism Theme
   Base: Concept 2 glass panels + Concept 1 bar charts + Concept 3 drive summary
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep: #0f0f14;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f0eef5;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b80;
    --text-dim: #4a4a5a;
    --accent-purple: #7c3aed;
    --accent-purple-light: #a78bfa;
    --accent-purple-glow: rgba(124, 58, 237, 0.4);
    --accent-cyan: #06b6d4;
    --accent-cyan-light: #22d3ee;
    --accent-cyan-glow: rgba(6, 182, 212, 0.3);
    --accent-pink: #ec4899;
    --accent-pink-light: #f472b6;
    --accent-green: #34d399;
    --accent-green-light: #6ee7b7;
    --accent-orange: #fb923c;
    --accent-red: #ef4444;
    --gradient-main: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    --gradient-text: linear-gradient(90deg, #c084fc, #22d3ee);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 100px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-cyan-light); text-decoration: none; }
a:hover { color: var(--accent-purple-light); }


/* --- Background Orbs --- */
.bg-orbs {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.12;
}
.orb-1 { width: 300px; height: 300px; background: var(--accent-purple); top: -80px; right: -60px; }
.orb-2 { width: 250px; height: 250px; background: var(--accent-cyan); bottom: -60px; left: -40px; }
.orb-3 { width: 200px; height: 200px; background: var(--accent-pink); bottom: 20%; right: 15%; }


/* --- Layout --- */
.app-wrap {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* Mobile first - full width, stacked */
@media (min-width: 768px) {
    .app-wrap { padding: 32px 32px 48px; }
}


/* --- Glass Panel --- */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
}
.glass:hover {
    border-color: var(--border-glass-hover);
}


/* --- Header --- */
.app-header {
    margin-bottom: 28px;
}
.app-title {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}
.app-tagline {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

@media (min-width: 768px) {
    .app-header { display: flex; justify-content: space-between; align-items: center; }
    .app-title { font-size: 32px; }
}


/* --- Navigation --- */
.nav-tabs {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-tab {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-tab:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
}
.nav-tab.active {
    background: var(--gradient-main);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 20px var(--accent-cyan-glow);
}

@media (min-width: 768px) {
    .nav-tabs { margin-top: 0; }
}


/* --- Stat Cards Row (Concept 1 style) --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (min-width: 768px) {
    .stats-row { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
    padding: 18px;
    text-align: center;
}
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.stat-val {
    font-size: 28px;
    font-weight: 700;
}
.stat-val.cyan    { color: var(--accent-cyan-light); }
.stat-val.purple  { color: var(--accent-purple-light); }
.stat-val.pink    { color: var(--accent-pink-light); }
.stat-val.green   { color: var(--accent-green); }
.stat-val.orange  { color: var(--accent-orange); }
.stat-sub {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}
.stat-sub.good { color: var(--accent-green); }


/* --- Main Grid (chart + phases side by side on desktop) --- */
.main-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
}
@media (min-width: 768px) {
    .main-grid { grid-template-columns: 2fr 1fr; }
}


/* --- Panel Shared --- */
.panel {
    padding: 22px;
}
.panel-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-cyan   { background: var(--accent-cyan);   box-shadow: 0 0 8px var(--accent-cyan-glow); }
.dot-purple { background: var(--accent-purple); box-shadow: 0 0 8px var(--accent-purple-glow); }
.dot-pink   { background: var(--accent-pink);   box-shadow: 0 0 8px rgba(236,72,153,0.5); }
.dot-green  { background: var(--accent-green);  box-shadow: 0 0 8px rgba(52,211,153,0.5); }


/* --- Bar Chart (Concept 1 style) --- */
.chart-area {
    height: 180px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding-top: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    min-height: 3px;
    transition: height 0.4s ease;
}
.bar-peak { background: linear-gradient(180deg, #818cf8, #6366f1); opacity: 0.8; }
.bar-end  { background: linear-gradient(180deg, #34d399, #059669); opacity: 0.9; }
.bar-label {
    font-size: 9px;
    color: var(--text-dim);
    padding-top: 6px;
}
.chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    justify-content: center;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}


/* --- Phase Tracker --- */
.phase-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.phase-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    transition: all 0.2s;
}
.phase-item.active {
    border-color: rgba(124, 58, 237, 0.3);
    background: rgba(124, 58, 237, 0.06);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.08);
}
.phase-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.phase-item.done .phase-num {
    background: linear-gradient(135deg, #34d399, #059669);
    color: #fff;
}
.phase-item.active .phase-num {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    box-shadow: 0 0 12px var(--accent-purple-glow);
}
.phase-item.upcoming .phase-num {
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
}
.phase-info { flex: 1; }
.phase-name { font-size: 13px; font-weight: 600; }
.phase-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.phase-item.done .progress-fill  { background: linear-gradient(90deg, #34d399, #059669); }
.phase-item.active .progress-fill { background: linear-gradient(90deg, #7c3aed, #a78bfa); }


/* --- Drive Form (Concept 2 glass form) --- */
.drive-form { padding: 24px; }

.form-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}
.form-row.stack-mobile {
    flex-direction: column;
}
@media (min-width: 768px) {
    .form-row.stack-mobile { flex-direction: row; }
}

.form-group { flex: 1; }
.form-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border 0.2s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-purple);
}
.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-dim);
}
.form-textarea {
    resize: vertical;
    min-height: 60px;
}
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b80' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.form-select option {
    background: #1a1a24;
    color: var(--text-primary);
}

/* Anxiety scale buttons */
.anxiety-scale {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.scale-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.scale-btn:hover {
    background: rgba(124, 58, 237, 0.15);
    border-color: var(--accent-purple);
    color: var(--accent-purple-light);
}
.scale-btn.selected {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 0 10px var(--accent-purple-glow);
}

/* Checkbox toggles */
.toggle-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.toggle-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.15);
    background: var(--bg-input);
    appearance: none;
    cursor: pointer;
    transition: all 0.2s;
}
.toggle-check:checked {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M10 3L5 8L2 5' stroke='white' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}


/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.btn-primary {
    color: #fff;
    background: var(--gradient-main);
    box-shadow: 0 4px 20px var(--accent-cyan-glow);
}
.btn-primary:hover {
    box-shadow: 0 4px 30px var(--accent-purple-glow);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-full { width: 100%; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple-light);
}
.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}


/* --- Calendar (Concept 2) --- */
.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.cal-month-title {
    font-size: 16px;
    font-weight: 600;
}
.cal-nav {
    display: flex;
    gap: 6px;
}
.cal-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}
.cal-nav-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple-light);
}
.cal-day-labels {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}
.cal-day-label {
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 0;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    cursor: default;
    transition: all 0.2s;
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.has-drive {
    background: rgba(124, 58, 237, 0.15);
    color: var(--accent-purple-light);
    border: 1px solid rgba(124, 58, 237, 0.25);
    cursor: pointer;
}
.cal-cell.has-drive.low-anxiety {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan-light);
    border-color: rgba(6, 182, 212, 0.25);
}
.cal-cell.today {
    box-shadow: inset 0 0 0 2px var(--accent-purple);
}
.cal-streak {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid rgba(124, 58, 237, 0.12);
    font-size: 13px;
    color: var(--accent-purple-light);
}
.cal-streak-num {
    font-weight: 700;
    font-size: 16px;
}


/* --- Last Drive Summary (Concept 3 style) --- */
.last-drive {
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.last-drive-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.last-drive-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    flex-shrink: 0;
}
.last-drive-route {
    font-size: 15px;
    font-weight: 500;
}
.last-drive-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.last-drive-anxiety { text-align: right; }
.last-drive-score {
    font-size: 28px;
    font-weight: 200;
    color: var(--accent-cyan-light);
    text-shadow: 0 0 16px var(--accent-cyan-glow);
}
.last-drive-score-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* --- Drive History List --- */
.drive-list { list-style: none; }
.drive-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.drive-list-item:last-child { border-bottom: none; }
.drive-list-route { font-size: 14px; font-weight: 500; }
.drive-list-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drive-list-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}
.drive-list-stat {
    text-align: center;
}
.drive-list-stat-val {
    font-size: 16px;
    font-weight: 600;
}
.drive-list-stat-label {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* --- Overall Progress Bar --- */
.progress-strip {
    padding: 16px 20px;
    margin-bottom: 20px;
}
.progress-bar-full {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
}
.progress-seg { transition: width 0.5s ease; }
.progress-labels {
    display: flex;
    margin-top: 8px;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}
.progress-label-active {
    color: var(--accent-purple-light);
    font-weight: 600;
}


/* --- Login Page --- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 380px;
    padding: 36px 32px;
}
.login-title {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 6px;
}
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}
.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--accent-red);
    margin-bottom: 16px;
    display: none;
}
.login-error.show { display: block; }


/* --- Reminders --- */
.reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
    margin-bottom: 8px;
}
.reminder-day {
    font-size: 14px;
    font-weight: 500;
}
.reminder-time {
    font-size: 12px;
    color: var(--text-muted);
}


/* --- Toast Notifications --- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast-success {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: var(--accent-green);
}
.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}


/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-purple-light);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    gap: 10px;
    font-size: 14px;
}


/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.empty-state-text {
    font-size: 13px;
}


/* --- Utilities --- */
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-cyan { color: var(--accent-cyan-light); }
.text-purple { color: var(--accent-purple-light); }
.text-green { color: var(--accent-green); }
.text-pink { color: var(--accent-pink-light); }
.hidden { display: none; }
