/* Verelia Learning Engine - Frontend Styles */

:root {
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Manrope', 'Segoe UI', sans-serif;
    --bg: #f6efe4;
    --bg-accent: #ffe6c9;
    --surface: rgba(255, 251, 245, 0.86);
    --surface-strong: #fffaf4;
    --surface-soft: #f2e6d7;
    --text: #21201d;
    --muted: #685f53;
    --line: rgba(70, 54, 38, 0.12);
    --primary: #d96f32;
    --primary-strong: #b7531a;
    --success: #2d8f63;
    --error: #c75643;
    --shadow-lg: 0 30px 80px rgba(90, 56, 23, 0.12);
    --shadow-md: 0 18px 42px rgba(90, 56, 23, 0.10);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

body[data-age-group='child'] {
    --bg: #f5f3df;
    --bg-accent: #cdecc8;
    --surface: rgba(252, 255, 245, 0.9);
    --surface-strong: #fbfff0;
    --surface-soft: #eaf6db;
    --text: #21312b;
    --muted: #56665d;
    --line: rgba(50, 83, 67, 0.14);
    --primary: #2f9a66;
    --primary-strong: #23764d;
}

body[data-age-group='teen'] {
    --bg: #efe8dc;
    --bg-accent: #f4cda8;
    --surface: rgba(255, 250, 244, 0.88);
    --surface-strong: #fff8ef;
    --surface-soft: #f3e4d2;
    --text: #231f1a;
    --muted: #6a5b4d;
    --line: rgba(85, 61, 33, 0.14);
    --primary: #c4672f;
    --primary-strong: #9b4f21;
}

body[data-age-group='adult'] {
    --bg: #ece8e1;
    --bg-accent: #d8d6f7;
    --surface: rgba(249, 248, 244, 0.9);
    --surface-strong: #fdfcf9;
    --surface-soft: #ebe8f0;
    --text: #22212a;
    --muted: #646173;
    --line: rgba(54, 52, 76, 0.14);
    --primary: #3559b6;
    --primary-strong: #26428c;
}

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

body {
    position: relative;
    overflow-x: hidden;
    font-family: var(--font-body);
    line-height: 1.5;
    color: var(--text);
    background:
        radial-gradient(circle at top left, var(--bg-accent), transparent 30%),
        linear-gradient(180deg, var(--bg), #f9f6f0 55%, #f3eee6 100%);
    min-height: 100vh;
    padding: 28px;
}

.page-glow {
    position: fixed;
    width: 34rem;
    height: 34rem;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.28;
    pointer-events: none;
}

.page-glow-left {
    top: -10rem;
    left: -10rem;
    background: var(--bg-accent);
}

.page-glow-right {
    right: -12rem;
    bottom: -12rem;
    background: color-mix(in srgb, var(--primary) 45%, white);
}

#app {
    position: relative;
    max-width: 1160px;
    margin: 0 auto;
}

header,
.hero-card,
.subject-card,
.task-card,
.feedback-message,
.dashboard-section,
.profile-banner,
#support-options,
form {
    backdrop-filter: blur(18px);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.brand-block {
    max-width: 640px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--primary-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
.dashboard-section h3,
.subject-card h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(2.4rem, 4vw, 4.8rem);
    line-height: 0.95;
}

.age-mode-label,
.section-note,
.form-hint,
.subject-card p,
.skill-stats,
.session-stats,
.notification-date {
    color: var(--muted);
}

.header-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.learner-chip,
.streak-badge,
.info-pill,
.subject-cta {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 800;
}

.learner-chip {
    padding: 10px 14px;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--line);
}

.streak-badge {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, white));
    color: white;
    box-shadow: var(--shadow-md);
}

.app-shell {
    display: grid;
    gap: 22px;
}

.screen {
    display: block;
}

.screen.hidden {
    display: none;
}

.hero-card,
form,
.task-card,
.dashboard-section,
.profile-banner,
#support-options {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.hero-card {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    padding: 28px;
    margin-bottom: 22px;
}

.hero-copy h2,
.section-heading h2,
#support-heading,
#current-subject,
#progress h2,
#parent-dashboard h2 {
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.02;
    margin-bottom: 12px;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.info-pill {
    padding: 10px 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.hero-panel {
    display: grid;
    gap: 12px;
}

.hero-stat {
    display: grid;
    gap: 6px;
    padding: 18px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.hero-stat-value {
    font-family: var(--font-display);
    font-size: 2.4rem;
    color: var(--primary-strong);
}

.hero-stat-label {
    color: var(--muted);
    font-weight: 700;
}

form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.92rem;
    font-weight: 800;
}

input {
    width: 100%;
    padding: 16px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    font: inherit;
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--primary);
    transform: translateY(-1px);
}

.form-hint {
    margin: 12px 0 20px;
}

.btn-primary,
.btn-secondary,
.support-option {
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-primary {
    padding: 14px 24px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
}

.btn-secondary {
    padding: 12px 18px;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.btn-primary:hover,
.btn-secondary:hover,
.support-option:hover,
.subject-card:hover {
    transform: translateY(-2px);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 18px;
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.subject-card {
    display: grid;
    gap: 14px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.subject-card:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
    box-shadow: 0 24px 50px rgba(40, 31, 21, 0.15);
}

.subject-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--surface-soft), color-mix(in srgb, var(--primary) 18%, white));
    color: var(--primary-strong);
    font-size: 1.4rem;
    font-weight: 800;
}

.subject-cta {
    justify-self: start;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--primary) 14%, white);
    color: var(--primary-strong);
}

.profile-banner {
    margin-bottom: 16px;
    padding: 16px 18px;
    color: var(--text);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.task-card {
    padding: 26px;
}

.task-prompt {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    margin-bottom: 20px;
}

.task-input {
    display: flex;
    gap: 12px;
}

#answer-input {
    flex: 1;
}

.feedback-message {
    padding: 22px;
    margin-bottom: 16px;
}

.feedback-message.success {
    border-color: color-mix(in srgb, var(--success) 50%, var(--line));
    background: color-mix(in srgb, var(--success) 12%, white);
}

.feedback-message.error {
    border-color: color-mix(in srgb, var(--error) 50%, var(--line));
    background: color-mix(in srgb, var(--error) 10%, white);
}

#support-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 20px;
}

.support-option {
    padding: 18px;
    color: var(--text);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    text-align: left;
}

.dashboard-section {
    padding: 22px;
    margin-bottom: 16px;
}

.dashboard-section h3 {
    margin-bottom: 14px;
    font-size: 1.5rem;
}

.skill-item,
.session-item,
.notification-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.skill-item:last-child,
.session-item:last-child,
.notification-item:last-child {
    border-bottom: none;
}

.skill-name,
.session-subject,
.notification-message {
    font-weight: 800;
}

.skill-progress {
    width: 100%;
    height: 10px;
    margin: 10px 0 8px;
    background: var(--surface-soft);
    border-radius: 999px;
    overflow: hidden;
}

.skill-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 45%, white));
}

.session-info {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 4px;
}

@media (max-width: 900px) {
    body {
        padding: 18px;
    }

    header,
    .hero-card,
    .section-heading,
    .session-header,
    .task-input {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-card,
    .subject-grid,
    .form-grid,
    #support-options {
        grid-template-columns: 1fr;
    }

    .header-controls {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 2.4rem;
    }

    .hero-copy h2,
    .section-heading h2,
    #support-heading,
    #current-subject,
    #progress h2,
    #parent-dashboard h2 {
        font-size: 1.9rem;
    }

    header,
    .hero-card,
    form,
    .task-card,
    .dashboard-section,
    #support-options,
    .profile-banner {
        padding: 18px;
    }
}
}

.session-stats {
    font-size: 14px;
    color: #666;
}

.notification-type {
    font-weight: 500;
    text-transform: capitalize;
}

.notification-message {
    margin: 5px 0;
}

.notification-date {
    font-size: 12px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .subject-grid {
        grid-template-columns: 1fr;
    }

    .session-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .task-input {
        flex-direction: column;
    }

    #support-options {
        grid-template-columns: 1fr;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hidden utility class */
.hidden {
    display: none !important;
}