/* ========================================
   AlphaOne Math Tutor — Kid-Cool Light Theme
   ======================================== */

:root {
    /* Kid-cool light palette */
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --accent: #00CEC9;
    --accent-light: #81ECEC;
    --accent-warm: #FD79A8;
    --accent-warm-light: #FDCBDF;

    /* Backgrounds */
    --bg: #F8F9FF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F0EDFF;
    --surface: #EDE9FE;
    --surface-accent: #E0F7FA;

    /* Borders */
    --border: rgba(108, 92, 231, 0.12);
    --border-hover: rgba(108, 92, 231, 0.25);

    /* Text */
    --text: #2D3436;
    --text-muted: #636E72;
    --text-dim: #B2BEC3;
    --white: #FFFFFF;

    /* Feedback */
    --success: #00B894;
    --success-bg: #E6FFF8;
    --success-border: rgba(0, 184, 148, 0.3);
    --warning: #FDCB6E;
    --warning-bg: #FFF8E1;
    --error: #FF7675;
    --error-bg: #FFF0F0;
    --error-border: rgba(255, 118, 117, 0.3);
    --star: #FFC312;

    /* Layout */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-btn: 20px;
    --radius-pill: 100px;
    --touch-min: 48px;
    --font-question: 1.25rem;
    --shadow-card: 0 2px 12px rgba(108, 92, 231, 0.08);
    --shadow-hover: 0 4px 20px rgba(108, 92, 231, 0.15);
    --shadow-btn: 0 4px 14px rgba(108, 92, 231, 0.25);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   Navigation
   ======================================== */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248, 249, 255, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    font-weight: 800;
    font-size: 14px;
    border-radius: 10px;
    letter-spacing: -0.5px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--surface);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
}

.student-badge .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--white);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-btn);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: var(--touch-min);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.35);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #00B5B0);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(0, 206, 201, 0.25);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 206, 201, 0.35);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--border-hover);
}

.btn-outline:hover {
    background: var(--surface);
    border-color: var(--primary-light);
}

.btn-nav {
    background: var(--surface);
    color: var(--primary);
    font-size: 0.85rem;
    padding: 8px 16px;
    min-height: 36px;
}

.btn-nav:hover {
    background: var(--bg-card-hover);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
    border-radius: 24px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    min-height: 32px;
    border-radius: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--border-hover);
}

.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    transform: translateY(-3px);
}

/* ========================================
   Grade Selection Cards
   ======================================== */

.grade-select {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 960px;
    margin: 0 auto;
}

.grade-card {
    text-align: center;
    padding: 40px 28px;
    position: relative;
    overflow: hidden;
}

.grade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.grade-card[data-grade="grade3"]::before {
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.grade-card[data-grade="grade6"]::before {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

.grade-card[data-grade="grade6ap"]::before {
    background: linear-gradient(90deg, var(--accent-warm), var(--primary));
}

.grade-card .grade-emoji {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

.grade-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.grade-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.grade-card .badge-count {
    display: inline-block;
    padding: 4px 12px;
    background: var(--surface);
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 20px;
}

/* ========================================
   Domain Browser
   ======================================== */

.domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.domain-card {
    padding: 24px;
}

.domain-card .domain-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 14px;
}

.domain-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.domain-card .domain-code {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.domain-card .domain-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.domain-card .standard-count {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ========================================
   Practice / Question View
   ======================================== */

.practice-container {
    max-width: 720px;
    margin: 0 auto;
}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.question-header .standard-tag {
    padding: 4px 12px;
    background: var(--surface);
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

.question-header .difficulty-dots {
    display: flex;
    gap: 4px;
}

.question-header .difficulty-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}

.question-header .difficulty-dots .dot.active {
    background: var(--primary);
}

.question-card {
    padding: 32px;
    margin-bottom: 24px;
}

.question-stem {
    font-size: var(--font-question);
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 28px;
    color: var(--text);
}

/* Multiple Choice */
.choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    min-height: var(--touch-min);
}

.choice-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--primary-light);
}

.choice-btn.selected {
    background: var(--surface);
    border-color: var(--primary);
}

.choice-btn.correct {
    background: var(--success-bg);
    border-color: var(--success);
}

.choice-btn.incorrect {
    background: var(--error-bg);
    border-color: var(--error);
}

.choice-btn .choice-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    flex-shrink: 0;
}

.choice-btn.correct .choice-label {
    background: var(--success);
    color: var(--white);
}

.choice-btn.incorrect .choice-label {
    background: var(--error);
    color: var(--white);
}

/* Fill-in */
.fill-in-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fill-in-input {
    flex: 1;
    max-width: 240px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    text-align: center;
    transition: var(--transition);
}

.fill-in-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.fill-in-input.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.fill-in-input.incorrect {
    border-color: var(--error);
    background: var(--error-bg);
}

/* ========================================
   Feedback
   ======================================== */

.feedback {
    padding: 20px 24px;
    border-radius: var(--radius);
    margin-top: 20px;
    display: none;
}

.feedback.visible {
    display: block;
    animation: slideUp 0.3s ease;
}

.feedback.correct {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
}

.feedback.incorrect {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
}

.feedback-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.feedback.correct .feedback-title {
    color: var(--success);
}

.feedback.incorrect .feedback-title {
    color: var(--error);
}

.feedback-explanation {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.explanation-box {
    background: var(--surface);
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    margin-top: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

/* ========================================
   Hints
   ======================================== */

.hint-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--warning-bg);
    border: 1px solid rgba(253, 203, 110, 0.4);
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: #E17055;
    cursor: pointer;
    transition: var(--transition);
}

.hint-btn:hover {
    background: rgba(253, 203, 110, 0.3);
}

.hint-box {
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--warning-bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
    font-size: 0.9rem;
    color: var(--text);
    display: none;
}

.hint-box.visible {
    display: block;
    animation: slideUp 0.25s ease;
}

/* ========================================
   Progress Indicators
   ======================================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.5s ease;
}

.mastery-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}

.mastery-badge.not_started {
    background: #F1F2F6;
    color: var(--text-dim);
}

.mastery-badge.practicing {
    background: var(--warning-bg);
    color: #E17055;
}

.mastery-badge.proficient {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary);
}

.mastery-badge.mastered {
    background: var(--success-bg);
    color: var(--success);
}

.streak-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #FFF3BF, #FFE066);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
    color: #B7791F;
}

.stars {
    display: flex;
    gap: 2px;
}

.stars .star {
    color: var(--border);
    font-size: 1.1rem;
}

.stars .star.earned {
    color: var(--star);
}

/* ========================================
   Visual Aid Container
   ======================================== */

.visual-aid {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ========================================
   Action Bar (bottom of question)
   ======================================== */

.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.action-bar-left {
    display: flex;
    gap: 8px;
}

/* ========================================
   Home / Welcome Screen
   ======================================== */

.hero {
    text-align: center;
    padding: 80px 20px 48px;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
}

.hero .gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

/* ========================================
   Section Headers
   ======================================== */

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .sep {
    color: var(--text-dim);
}

/* ========================================
   Student Profile Select
   ======================================== */

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    max-width: 640px;
    margin: 0 auto;
}

.profile-card {
    text-align: center;
    padding: 28px 16px;
    cursor: pointer;
}

.profile-card .profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--white);
}

.profile-card .profile-name {
    font-weight: 600;
    font-size: 1rem;
}

.profile-card .profile-grade {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-card.add-new {
    border: 2px dashed var(--border);
    background: transparent;
    box-shadow: none;
}

.profile-card.add-new:hover {
    border-color: var(--primary-light);
    background: var(--surface);
}

/* ========================================
   Standards List (within a domain)
   ======================================== */

.standards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.standard-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}

.standard-row .standard-code {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    white-space: nowrap;
    min-width: 60px;
}

.standard-row .standard-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
}

.standard-row .standard-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========================================
   Quiz Results
   ======================================== */

.quiz-results {
    text-align: center;
    max-width: 560px;
    margin: 0 auto;
}

.quiz-score {
    font-size: 4rem;
    font-weight: 800;
    margin: 20px 0;
}

.quiz-score.excellent {
    color: var(--success);
}

.quiz-score.good {
    color: var(--primary);
}

.quiz-score.needs-work {
    color: var(--error);
}

/* ========================================
   Animations
   ======================================== */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pop {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.view-enter {
    animation: fadeIn 0.25s ease;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    padding: 24px 20px 48px;
}

/* ========================================
   Utilities
   ======================================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .grade-select {
        grid-template-columns: 1fr;
    }

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

    .question-card {
        padding: 24px 18px;
    }

    .question-stem {
        font-size: 1.1rem;
    }

    .action-bar {
        flex-direction: column;
    }

    .nav-container {
        padding: 0 12px;
    }

    .logo-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 60px 12px 32px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .profile-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .standard-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
