/* ─── Custom Properties ─────────────────────────────── */
:root {
    --bg:             #F4F2FB;
    --bg-card:        #FDFCFF;
    --primary:        #8B7DB8;
    --primary-dark:   #6B5E99;
    --primary-light:  #EAE6F8;
    --primary-mid:    #C4BADF;
    --green:          #7CAE8A;
    --green-dark:     #5A8F6B;
    --green-light:    #E6F3EB;
    --warm:           #F9F5F0;
    --text:           #3A3350;
    --text-muted:     #8A82A0;
    --text-light:     #B0AACC;
    --border:         #E2DCF5;
    --border-light:   #EDE9F8;
    --shadow-sm:      0 2px 8px rgba(107, 94, 153, 0.08);
    --shadow-md:      0 4px 20px rgba(107, 94, 153, 0.12);
    --shadow-lg:      0 8px 32px rgba(107, 94, 153, 0.16);
    --radius:         18px;
    --radius-sm:      12px;
    --radius-xs:      8px;
    --transition:     0.2s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ─── Layout ────────────────────────────────────────── */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ─── Header ────────────────────────────────────────── */
header {
    padding: 48px 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
}

.logo-icon {
    font-size: 52px;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(139, 125, 184, 0.25));
}

.logo-text h1 {
    font-size: 38px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -1px;
    line-height: 1;
}

.tagline {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
    letter-spacing: 0.2px;
}

/* ─── Tabs ──────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-card);
    padding: 6px;
    border-radius: var(--radius);
    margin-bottom: 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.tab:hover:not(.active) {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(139, 125, 184, 0.35);
}

.tab-icon {
    font-size: 17px;
}

.tab-label {
    display: inline;
}

/* ─── Panels ────────────────────────────────────────── */
.panel {
    display: none;
}

.panel.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

/* ─── Panel Header ──────────────────────────────────── */
.panel-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 26px 30px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-left: 5px solid var(--primary);
}

.panel-header-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.panel-desc {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.55;
}

/* ─── Tool Form ─────────────────────────────────────── */
.tool-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px 30px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

/* ─── Age Selector ──────────────────────────────────── */
.age-selector {
    border: none;
    margin-bottom: 26px;
}

.age-selector legend {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.age-options {
    display: flex;
    gap: 10px;
}

.age-option {
    flex: 1;
    cursor: pointer;
}

.age-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.age-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition);
    text-align: center;
    line-height: 1.2;
}

.age-emoji {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 1px;
}

.age-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-light);
}

.age-option input:checked + .age-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.age-option input:checked + .age-label .age-sub {
    color: var(--primary-mid);
}

.age-option:hover .age-label {
    border-color: var(--primary-mid);
    color: var(--primary-dark);
}

/* ─── Form Elements ─────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition), background var(--transition);
    outline: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238A82A0' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
}

.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(139, 125, 184, 0.12);
}

.form-group textarea::placeholder {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.5;
}

/* ─── Submit Button ─────────────────────────────────── */
.btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.2px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 94, 153, 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 18px;
    transition: transform var(--transition);
}

.btn-primary:hover:not(:disabled) .btn-icon {
    transform: translateX(3px);
}

/* ─── Loading State ─────────────────────────────────── */
.loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 36px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.loading.visible {
    display: flex;
}

.loading p {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 15px;
}

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.loading-dots span {
    width: 9px;
    height: 9px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1.1); opacity: 1; }
}

/* ─── Response Area ─────────────────────────────────── */
.response-area {
    display: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px 34px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-top: 4px solid var(--green);
    animation: slideUp 0.35s ease;
}

.response-area.visible {
    display: block;
}

/* ─── Response Markdown Styles ──────────────────────── */
.response-area h2 {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-area h2:first-child {
    margin-top: 0;
}

.response-area h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 16px 0 8px;
}

.response-area p {
    color: var(--text);
    font-size: 15px;
    line-height: 1.75;
    margin-bottom: 12px;
}

.response-area p:last-child {
    margin-bottom: 0;
}

.response-area ul,
.response-area ol {
    padding-left: 22px;
    margin-bottom: 14px;
}

.response-area li {
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 8px;
}

.response-area li::marker {
    color: var(--primary);
}

.response-area strong {
    color: var(--primary-dark);
    font-weight: 700;
}

.response-area em {
    color: var(--text-muted);
    font-style: italic;
}

.response-area blockquote {
    border-left: 3px solid var(--green);
    padding: 10px 16px;
    margin: 16px 0;
    background: var(--green-light);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--green-dark);
    font-weight: 600;
}

/* Last section ("Remember" / "You've Got This") styling */
.response-area h2:last-of-type {
    color: var(--green-dark);
    border-bottom-color: var(--green-light);
}

/* ─── Error State ────────────────────────────────────── */
.response-error {
    color: #9B4B4B;
    background: #FDF2F2;
    border: 1px solid #F5C6C6;
    border-radius: var(--radius-xs);
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
}

/* ─── Footer ────────────────────────────────────────── */
footer {
    margin-top: 48px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 500;
}

/* ─── Edit Profile Button ───────────────────────────── */
.edit-profile-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.edit-profile-btn:hover {
    border-color: var(--primary-mid);
    color: var(--primary-dark);
    background: var(--primary-light);
}

/* ─── Onboarding Overlay ────────────────────────────── */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1000;
    padding: 48px 20px;
    overflow-y: auto;
}

.onboarding-overlay.hidden {
    display: none;
}

.onboarding-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

/* Progress indicator */
.onboarding-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 36px;
    gap: 0;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background var(--transition);
    flex-shrink: 0;
}

.progress-dot.active {
    background: var(--primary);
    width: 12px;
    height: 12px;
}

.progress-dot.done {
    background: var(--primary-mid);
}

.progress-line {
    flex: 1;
    max-width: 56px;
    height: 2px;
    background: var(--border);
    transition: background var(--transition);
}

.progress-line.done {
    background: var(--primary-mid);
}

/* Steps */
.onboarding-step {
    display: none;
}

.onboarding-step.active {
    display: block;
    animation: slideUp 0.25s ease;
}

/* Step 1 branding */
.ob-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.ob-logo-icon {
    font-size: 38px;
    line-height: 1;
}

.ob-logo-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
}

.ob-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 28px;
}

.ob-question {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 18px;
    line-height: 1.3;
}

.ob-question-sub {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
}

.ob-hint {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Option buttons (role & age — single select, auto-advance) */
.ob-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.ob-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    cursor: pointer;
    text-align: left;
    font-family: 'Nunito', sans-serif;
    transition: all var(--transition);
    width: 100%;
    position: relative;
}

.ob-option:hover {
    border-color: var(--primary-mid);
    background: var(--primary-light);
}

.ob-option.selected {
    border-color: var(--primary);
    border-width: 2px;
    background: var(--primary-light);
    padding-right: 100px; /* room for the badge */
}

.ob-option.selected::after {
    content: "✓ Selected";
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 800;
    color: var(--primary-dark);
    background: #fff;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1.5px solid var(--primary);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.ob-option-emoji {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
}

.ob-option-text strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.ob-option-text span {
    font-size: 13px;
    color: var(--text-muted);
}

/* Challenge checkboxes (multi-select) */
.ob-challenges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.ob-challenge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 13px;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
    background: var(--bg);
    user-select: none;
}

.ob-challenge:hover {
    border-color: var(--primary-mid);
    color: var(--text);
}

.ob-challenge input[type="checkbox"] {
    display: none;
}

.ob-challenge:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Notes textarea */
.ob-notes-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    resize: vertical;
    outline: none;
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 20px;
    line-height: 1.6;
    display: block;
}

.ob-notes-input:focus {
    border-color: var(--primary);
    background: #fff;
}

.ob-notes-input::placeholder {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.5;
}

/* Action buttons */
.ob-next-btn,
.ob-finish-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
}

.ob-next-btn:hover,
.ob-finish-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 94, 153, 0.3);
}

/* Skip link */
.ob-skip {
    margin-top: 18px;
    background: none;
    border: none;
    color: var(--text-light);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 20px;
    transition: color var(--transition);
}

.ob-skip:hover {
    color: var(--text-muted);
}

/* ─── Welcome Screen ────────────────────────────────── */
.ob-welcome-desc {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.ob-feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ob-feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: var(--radius-xs);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.ob-feature-icon {
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}

.ob-welcome-cta {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ─── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
    .container {
        padding: 0 16px 60px;
    }

    header {
        padding: 32px 0 24px;
    }

    .logo-icon {
        font-size: 40px;
    }

    .logo-text h1 {
        font-size: 30px;
    }

    .edit-profile-btn span[aria-hidden] {
        display: none;
    }

    .onboarding-card {
        padding: 28px 22px;
    }

    .ob-challenges {
        grid-template-columns: 1fr;
    }

    .tabs {
        gap: 4px;
        padding: 5px;
    }

    .tab {
        padding: 11px 8px;
        font-size: 12px;
        gap: 5px;
    }

    .tab-icon {
        font-size: 15px;
    }

    .panel-header,
    .tool-form {
        padding: 20px;
    }

    .response-area {
        padding: 22px 20px;
    }

    .age-options {
        gap: 7px;
    }

    .age-label {
        padding: 10px 6px;
        font-size: 12px;
    }

    .age-emoji {
        font-size: 18px;
    }
}

@media (max-width: 400px) {
    .tab-label {
        display: none;
    }

    .tab {
        padding: 11px;
    }

    .tab-icon {
        font-size: 20px;
    }
}
