/* style.css - Duolingo Design System & Visual Aesthetics for Tamilo */

:root {
    --duo-green: #58cc02;
    --duo-green-dark: #46a302;
    --duo-blue: #1cb0f6;
    --duo-blue-dark: #0f86c2;
    --duo-gold: #ffc800;
    --duo-gold-dark: #d7a100;
    --duo-red: #ff4b4b;
    --duo-red-dark: #ea2b2b;
    --duo-purple: #ce82ff;
    --duo-purple-dark: #a546e8;
    --duo-orange: #ff9f1c;
    --duo-orange-dark: #d67f00;

    --bg-dark: #131f24;
    --bg-card: #18272f;
    --bg-card-border: #37464f;
    --text-light: #ffffff;
    --text-muted: #afbbcf;
    --text-dark: #131f24;

    --correct-bg: #d7ffb8;
    --correct-text: #2b7000;
    --incorrect-bg: #ffdfe0;
    --incorrect-text: #ea2b2b;

    --font-main: 'Feather', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-tamil: 'Noto Sans Tamil', 'Mukta Malar', system-ui, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* App Header & Top Widgets Bar */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-dark);
    border-bottom: 2px solid var(--bg-card-border);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--duo-green);
    letter-spacing: -0.5px;
    cursor: pointer;
}

.logo-brand .brand-tamil {
    font-family: var(--font-tamil);
    color: var(--duo-gold);
}

.top-widgets {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Audio Enable Header Button */
.audio-enable-btn {
    background: var(--duo-blue);
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 0 var(--duo-blue-dark);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s ease;
}
.audio-enable-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--duo-blue-dark);
}
.audio-enable-btn.active {
    background: var(--duo-green);
    box-shadow: 0 4px 0 var(--duo-green-dark);
}

.widget-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 6px 12px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.widget-item:hover {
    transform: translateY(-2px);
    border-color: var(--bg-card-border);
}

.widget-streak { color: var(--duo-orange); }
.widget-gems { color: var(--duo-blue); }
.widget-hearts { color: var(--duo-red); }
.widget-xp { color: var(--duo-gold); }

.streak-flame {
    animation: flamePulse 1.2s ease-in-out infinite alternate;
}

@keyframes flamePulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--duo-orange)); }
    100% { transform: scale(1.18); filter: drop-shadow(0 0 8px #ff4b4b); }
}

/* Main Container Layout */
.main-layout {
    flex: 1;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    padding: 24px;
}

@media (max-width: 820px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .side-panel {
        display: none;
    }
}

/* Path View / Map Container */
.path-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding-bottom: 60px;
}

.unit-banner {
    width: 100%;
    border-radius: 16px;
    padding: 20px 24px;
    color: #ffffff;
    box-shadow: 0 6px 0 rgba(0,0,0,0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.unit-info h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
    font-family: var(--font-tamil);
}

.unit-info p {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 600;
}

.unit-badge-icon {
    font-size: 2.8rem;
    background: rgba(255,255,255,0.2);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lesson Node Tree Path (Duolingo Curved Path Layout) */
.lesson-path-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    position: relative;
}

.node-row {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* 3D Tactile Node Button */
.node-btn {
    width: 84px;
    height: 80px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 8px 0 rgba(0,0,0,0.4);
    outline: none;
}

.node-btn:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}

.node-unlocked {
    background-color: var(--duo-green);
    color: #ffffff;
    box-shadow: 0 8px 0 var(--duo-green-dark);
}
.node-unlocked:active {
    box-shadow: 0 2px 0 var(--duo-green-dark);
}

.node-current {
    background-color: var(--duo-gold);
    color: #ffffff;
    box-shadow: 0 8px 0 var(--duo-gold-dark);
    animation: activePulse 1.8s infinite alternate;
}

@keyframes activePulse {
    0% { transform: scale(1); box-shadow: 0 8px 0 var(--duo-gold-dark), 0 0 0 0px rgba(255, 200, 0, 0.4); }
    100% { transform: scale(1.06); box-shadow: 0 8px 0 var(--duo-gold-dark), 0 0 0 16px rgba(255, 200, 0, 0); }
}

.node-completed {
    background-color: var(--duo-blue);
    color: #ffffff;
    box-shadow: 0 8px 0 var(--duo-blue-dark);
}

.node-locked {
    background-color: #37464f;
    color: #52656d;
    box-shadow: 0 8px 0 #222d34;
    cursor: not-allowed;
}

.node-tooltip {
    position: absolute;
    bottom: 95px;
    background: #ffffff;
    color: var(--text-dark);
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    white-space: nowrap;
    z-index: 10;
}
.node-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

/* Side Panel (Mascot & Daily Quest Card) */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.side-card {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-border);
    border-radius: 16px;
    padding: 20px;
}

.side-card-header {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.quest-icon {
    font-size: 1.5rem;
}

.quest-details {
    flex: 1;
}

.quest-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.quest-bar-bg {
    height: 8px;
    background: #2b3940;
    border-radius: 4px;
    margin-top: 4px;
    overflow: hidden;
}

.quest-bar-fill {
    height: 100%;
    background: var(--duo-gold);
    border-radius: 4px;
    width: 60%;
}

/* Mascot Display Container & Speech Bubble */
.mascot-display-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    position: relative;
}

.mascot-wrapper {
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mood-idle .mascot-svg {
    animation: floatIdle 3s ease-in-out infinite alternate;
}

@keyframes floatIdle {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-8px); }
}

.mood-celebrate .mascot-svg {
    animation: celebrateBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite alternate;
}

@keyframes celebrateBounce {
    0% { transform: translateY(0) scale(1) rotate(0deg); }
    100% { transform: translateY(-20px) scale(1.08) rotate(4deg); }
}

.mood-sad .mascot-svg {
    transform: translateY(6px) scale(0.95);
    filter: brightness(0.85);
}

/* Dynamic Speech Bubble */
.speech-bubble {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    color: var(--text-dark);
    padding: 10px 16px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    white-space: nowrap;
    z-index: 20;
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

/* Confetti Particle Cannon */
.confetti-burst {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confettiPop 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes confettiPop {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--vx), var(--vy)) rotate(var(--rot)); opacity: 0; }
}

/* Modal Overlay & Active Lesson Engine Screen */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-dark);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.lesson-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 24px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover { color: #ffffff; }

.lesson-progress-bar-bg {
    flex: 1;
    height: 16px;
    background: #2b3940;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.lesson-progress-bar-fill {
    height: 100%;
    background: var(--duo-green);
    border-radius: 12px;
    width: 0%;
    transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lesson-content {
    flex: 1;
    max-width: 750px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.exercise-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 24px;
}

/* Audio Pronunciation Button Widget */
.audio-play-btn {
    background: var(--duo-blue);
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 0 var(--duo-blue-dark);
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 800;
    padding: 14px 24px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    transition: transform 0.1s ease;
}
.audio-play-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--duo-blue-dark);
}

/* Multiple Choice Cards */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    width: 100%;
}

.option-card {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-tamil);
    box-shadow: 0 4px 0 var(--bg-card-border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.option-card:hover {
    background: #20323c;
    border-color: #52656d;
}

.option-card.selected {
    border-color: var(--duo-blue);
    background: #153243;
    color: var(--duo-blue);
    box-shadow: 0 4px 0 var(--duo-blue-dark);
}

/* Word Bank Sentence Builder Tile Grid */
.sentence-builder-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.target-slots-area {
    min-height: 80px;
    border-bottom: 2px solid var(--bg-card-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px;
}

.word-bank-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.word-tile {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-border);
    box-shadow: 0 4px 0 var(--bg-card-border);
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-tamil);
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.word-tile:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--bg-card-border);
}

.word-tile.used {
    opacity: 0.2;
    pointer-events: none;
}

/* Pair Matching Grid */
.pair-matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.pair-card {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-border);
    box-shadow: 0 4px 0 var(--bg-card-border);
    border-radius: 14px;
    padding: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}

.pair-card.matched {
    border-color: var(--duo-green);
    background: #1c3b1a;
    color: var(--duo-green);
    pointer-events: none;
    opacity: 0.7;
}

/* Flashcard Stroke Visualizer */
.flashcard-wrapper {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-border);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.big-tamil-letter {
    font-size: 5rem;
    font-weight: 800;
    color: var(--duo-gold);
    font-family: var(--font-tamil);
}

.translit-badge {
    background: rgba(255, 200, 0, 0.15);
    color: var(--duo-gold);
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1.1rem;
}

/* Bottom Action / Feedback Bar */
.bottom-feedback-bar {
    position: sticky;
    bottom: 0;
    width: 100%;
    padding: 24px;
    border-top: 2px solid var(--bg-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-dark);
    z-index: 210;
}

.bottom-feedback-bar.correct {
    background: var(--correct-bg);
    color: var(--correct-text);
}

.bottom-feedback-bar.incorrect {
    background: var(--incorrect-bg);
    color: var(--incorrect-text);
}

.feedback-text-area h3 {
    font-size: 1.4rem;
    font-weight: 800;
}
.feedback-text-area p {
    font-size: 1rem;
    font-weight: 600;
}

/* 3D Action Button */
.btn-primary {
    background: var(--duo-green);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 14px 36px;
    font-size: 1.2rem;
    font-weight: 800;
    box-shadow: 0 5px 0 var(--duo-green-dark);
    cursor: pointer;
    transition: transform 0.1s ease;
}
.btn-primary:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 var(--duo-green-dark);
}

.btn-danger {
    background: var(--duo-red);
    box-shadow: 0 5px 0 var(--duo-red-dark);
}
.btn-danger:active {
    box-shadow: 0 0 0 var(--duo-red-dark);
}

/* Lesson Summary Celebration Modal */
.celebration-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.stat-box-row {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.stat-box {
    background: var(--bg-card);
    border: 2px solid var(--bg-card-border);
    border-radius: 16px;
    padding: 16px 24px;
    min-width: 120px;
}
.stat-box .stat-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--duo-gold);
}
.stat-box .stat-lbl {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 700;
}
