/* SpeakEasy - Language Learning App Styles */

:root {
    --purple: #7C3AED;
    --purple-light: #A78BFA;
    --purple-dark: #5B21B6;
    --orange: #F59E0B;
    --orange-light: #FCD34D;
    --teal: #14B8A6;
    --teal-light: #5EEAD4;
    --blue: #3B82F6;
    --blue-light: #93C5FD;
    --red: #EF4444;
    --green: #10B981;
    --green-light: #6EE7B7;
    --yellow: #FCD34D;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-brand svg { width: 40px; height: 40px; }

.navbar-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.navbar-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.navbar-links a:hover { color: white; }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 500;
}

/* Main content */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Hero / Dashboard */
.hero {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, var(--purple) 0%, var(--blue) 100%);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.hero .mascot {
    width: 120px;
    height: 120px;
    margin: 1rem auto;
}

/* Lesson list */
.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.lesson-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.lesson-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.lesson-card.locked {
    opacity: 0.6;
    pointer-events: none;
}

.lesson-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
}

.lesson-card.completed {
    border: 2px solid var(--green);
}

.lesson-card-illustration {
    height: 160px;
    background: linear-gradient(135deg, var(--purple-light) 0%, var(--teal-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.lesson-card-illustration svg {
    max-height: 140px;
    max-width: 100%;
}

.lesson-card-body {
    padding: 1.25rem;
}

.lesson-card-body h3 {
    font-size: 1.15rem;
    margin-bottom: 0.35rem;
    color: var(--gray-900);
}

.lesson-card-body p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.lesson-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lesson-card-footer .badge {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.badge-available { background: var(--teal-light); color: var(--gray-900); }
.badge-completed { background: var(--green-light); color: var(--gray-900); }
.badge-locked { background: var(--gray-200); color: var(--gray-500); }
.badge-in-progress { background: var(--orange-light); color: var(--gray-900); }

.score-display {
    font-weight: 700;
    color: var(--purple);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--purple);
    color: white;
}

.btn-primary:hover { background: var(--purple-dark); }

.btn-success {
    background: var(--green);
    color: white;
}

.btn-success:hover { background: #059669; }

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

.btn-outline:hover {
    background: var(--purple);
    color: white;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1.1rem;
}

/* Progress bar */
.progress-bar-container {
    background: var(--gray-200);
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
    width: 100%;
}

.progress-bar {
    background: linear-gradient(90deg, var(--purple) 0%, var(--teal) 100%);
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* Lesson page */
.lesson-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.lesson-header-illustration {
    width: 200px;
    flex-shrink: 0;
}

.lesson-header-illustration svg {
    width: 100%;
    height: auto;
}

.lesson-header-info h1 {
    font-size: 2rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.lesson-header-info p {
    color: var(--gray-500);
    font-size: 1.05rem;
}

.script-toggle {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 4px;
    margin-top: 1rem;
    gap: 4px;
}

.script-toggle button {
    padding: 0.4rem 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-500);
    transition: all 0.2s;
}

.script-toggle button.active {
    background: var(--purple);
    color: white;
}

/* Sections */
.section {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section h2 {
    font-size: 1.35rem;
    color: var(--purple-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Vocab cards */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.vocab-card {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s;
    cursor: pointer;
    perspective: 1000px;
}

.vocab-card:hover {
    border-color: var(--purple-light);
    background: white;
}

.vocab-card-inner {
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.vocab-card.flipped .vocab-card-inner {
    transform: rotateY(180deg);
}

.vocab-front, .vocab-back {
    backface-visibility: hidden;
}

.vocab-back {
    transform: rotateY(180deg);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem;
}

.vocab-english {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.35rem;
}

.vocab-serbian {
    font-size: 1.25rem;
    color: var(--purple);
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.vocab-cyrillic {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.vocab-hint {
    font-size: 0.8rem;
    color: var(--teal);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.vocab-example {
    font-size: 0.85rem;
    color: var(--gray-500);
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-200);
}

.play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--purple);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.play-btn:hover { background: var(--purple-dark); }

.play-btn svg {
    width: 14px;
    height: 14px;
}

.vocab-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Grammar section */
.grammar-explanation {
    background: var(--gray-50);
    border-left: 4px solid var(--orange);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.grammar-examples {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.grammar-example {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 8px;
}

.grammar-example .serbian {
    color: var(--purple);
    font-weight: 600;
    flex: 1;
}

.grammar-example .english {
    color: var(--gray-500);
    flex: 1;
}

/* Cultural note */
.cultural-note {
    background: linear-gradient(135deg, var(--orange-light) 0%, var(--yellow) 100%);
    border-radius: 10px;
    padding: 1.25rem;
    position: relative;
}

.cultural-note::before {
    content: '💡';
    font-size: 1.5rem;
    position: absolute;
    top: -10px;
    left: 1rem;
}

.cultural-note p {
    line-height: 1.7;
}

/* Quiz styles */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-progress-text {
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.question-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.question-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.quiz-option:hover {
    border-color: var(--purple-light);
    background: white;
}

.quiz-option.selected {
    border-color: var(--purple);
    background: rgba(124, 58, 237, 0.05);
}

.quiz-option.correct {
    border-color: var(--green);
    background: rgba(16, 185, 129, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--red);
    background: rgba(239, 68, 68, 0.1);
}

.quiz-option input[type="radio"] { display: none; }

.quiz-option-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gray-500);
    flex-shrink: 0;
}

.quiz-option.selected .quiz-option-marker {
    border-color: var(--purple);
    background: var(--purple);
    color: white;
}

/* Type answer */
.type-answer-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.type-answer-input:focus {
    border-color: var(--purple);
}

/* Match pairs */
.match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.match-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-item {
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.match-item:hover {
    border-color: var(--purple-light);
}

.match-item.selected {
    border-color: var(--purple);
    background: rgba(124, 58, 237, 0.1);
}

.match-item.matched {
    border-color: var(--green);
    background: rgba(16, 185, 129, 0.1);
    pointer-events: none;
}

/* Results page */
.results-card {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.results-score {
    font-size: 4rem;
    font-weight: 800;
    margin: 1rem 0;
}

.results-score.pass { color: var(--green); }
.results-score.fail { color: var(--orange); }

.results-message {
    font-size: 1.25rem;
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Auth forms */
.auth-container {
    max-width: 440px;
    margin: 3rem auto;
}

.auth-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--purple-dark);
    font-size: 1.75rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--purple);
}

.auth-card .btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray-500);
}

.auth-switch a {
    color: var(--purple);
    font-weight: 600;
    text-decoration: none;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Dashboard stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--purple);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* Confetti animation */
@keyframes confetti-fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall 3s ease-in forwards;
    z-index: 1000;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .navbar { padding: 0 1rem; }
    .hero h1 { font-size: 1.75rem; }
    .lesson-header { flex-direction: column; text-align: center; }
    .lesson-header-illustration { width: 150px; }
    .lesson-grid { grid-template-columns: 1fr; }
    .vocab-grid { grid-template-columns: 1fr; }
    .match-container { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Script visibility */
.script-cyrillic { display: none; }
.script-latin { display: inline; }
.script-both .script-cyrillic { display: inline; }
.script-both .script-latin { display: inline; }

body.show-cyrillic .script-cyrillic { display: inline; }
body.show-cyrillic .script-latin { display: none; }
body.show-both .script-cyrillic { display: inline; }
body.show-both .script-latin { display: inline; }
body.show-latin .script-cyrillic { display: none; }
body.show-latin .script-latin { display: inline; }
