/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #10B981;
    --primary-dark: #059669;
    --secondary-color: #3B82F6;
    --accent-color: #F59E0B;
    --danger-color: #EF4444;
    --success-color: #10B981;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 48px;
    color: white;
    margin-bottom: 8px;
    font-weight: 700;
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
}

.login-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.tab-container {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form input {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.hidden {
    display: none !important;
}

.btn-primary {
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 12px 20px;
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.demo-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.demo-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.feature {
    text-align: center;
    color: white;
}

.feature .icon {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.feature p {
    font-size: 14px;
    opacity: 0.9;
}

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-content h2 {
    font-size: 24px;
    color: var(--text-primary);
}

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

.streak, .points {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-back {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
}

/* Dashboard */
.dashboard-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.welcome-section {
    margin-bottom: 48px;
}

.welcome-section h1 {
    font-size: 32px;
    margin-bottom: 24px;
}

.progress-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.progress-stat {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.progress-stat h3 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.progress-stat p {
    color: var(--text-secondary);
    font-size: 14px;
}

.lessons-section {
    margin-bottom: 48px;
}

.lessons-section h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.lesson-path {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lesson-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.lesson-card:not(.locked):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.lesson-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.lesson-card.completed {
    border-color: var(--success-color);
    background: #F0FDF4;
}

.lesson-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.lesson-card.locked .lesson-number {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.lesson-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.lesson-content {
    flex: 1;
}

.lesson-content h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.lesson-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.lesson-meta {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.lesson-status {
    font-weight: 600;
    color: var(--primary-color);
}

.lesson-connector {
    width: 2px;
    height: 24px;
    background: var(--border-color);
    margin-left: 72px;
}

/* Achievements */
.achievements-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.badges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.badge {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.badge.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.badge-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.badge p {
    font-size: 14px;
    font-weight: 600;
}

/* Lesson Page */
.lesson-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
}

.lesson-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.lesson-sidebar h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.lesson-sidebar ul {
    list-style: none;
}

.lesson-sidebar li {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.lesson-sidebar li.active {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    font-weight: 600;
}

.lesson-content-area {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-height: 600px;
}

.lesson-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.lesson-number-badge {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.lesson-header h1 {
    font-size: 32px;
}

.content-section h2 {
    font-size: 24px;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.content-section p {
    margin-bottom: 16px;
    line-height: 1.8;
}

.content-section ul, .content-section ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.content-section li {
    margin-bottom: 8px;
}

.highlight-box {
    background: #FEF3C7;
    border-left: 4px solid var(--accent-color);
    padding: 20px;
    margin: 24px 0;
    border-radius: var(--radius-sm);
}

.example-box {
    background: var(--bg-tertiary);
    padding: 24px;
    border-radius: var(--radius-md);
    margin: 24px 0;
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.lesson-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    width: 150px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* Quiz */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.quiz-header {
    text-align: center;
    margin-bottom: 48px;
}

.quiz-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.quiz-header p {
    color: var(--text-secondary);
}

.quiz-progress {
    margin-top: 24px;
}

#quizProgress {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

.quiz-content {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    min-height: 400px;
}

.question-card h2 {
    font-size: 24px;
    margin-bottom: 32px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.option:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.option.selected {
    border-color: var(--primary-color);
    background: #ECFDF5;
}

.option.correct {
    border-color: var(--success-color);
    background: #F0FDF4;
}

.option.incorrect {
    border-color: var(--danger-color);
    background: #FEF2F2;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
}

.quiz-timer {
    font-weight: 600;
}

/* Quiz Results */
.quiz-results {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.results-card {
    background: white;
    padding: 48px;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.results-icon {
    font-size: 80px;
    margin-bottom: 24px;
}

.results-card h1 {
    font-size: 32px;
    margin-bottom: 32px;
}

.score-display {
    margin-bottom: 32px;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 8px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.score-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
}

.score-total {
    font-size: 24px;
    color: var(--text-secondary);
}

.score-percentage {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.stat span {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

.stat strong {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

.stat p {
    font-size: 14px;
    color: var(--text-secondary);
}

.results-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Character System */
.character-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 40px;
}

.character-preview {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 100px;
    height: fit-content;
    text-align: center;
}

.character-preview h2 {
    font-size: 24px;
    margin-bottom: 24px;
}

.character-display {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-accessory {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 36px;
}

.character-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.character-shop {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.character-shop h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.shop-description {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.shop-section {
    margin-bottom: 48px;
}

.shop-section h3 {
    font-size: 20px;
    margin-bottom: 20px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}

.shop-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.shop-item:hover:not(.locked) {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.shop-item.selected {
    border-color: var(--primary-color);
    background: #ECFDF5;
}

.shop-item.owned {
    border-color: var(--success-color);
}

.shop-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.color-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 12px;
    border: 3px solid #000;
}

.accessory-preview {
    font-size: 48px;
    margin-bottom: 8px;
}

.shop-item p {
    font-weight: 600;
    margin-bottom: 4px;
}

.price {
    display: block;
    color: var(--accent-color);
    font-weight: 700;
    font-size: 14px;
}

.unlock-text {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
}

.character-widget {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
    margin-bottom: 24px;
}

.character-widget h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.character-widget-display {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.points-earned {
    background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.points-earned h3 {
    color: white;
    font-size: 24px;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .features {
        grid-template-columns: 1fr;
    }
    
    .progress-overview {
        grid-template-columns: 1fr;
    }
    
    .badges {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lesson-container {
        grid-template-columns: 1fr;
    }
    
    .lesson-sidebar {
        position: static;
    }
    
    .nav-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .character-container {
        grid-template-columns: 1fr;
    }
    
    .character-preview {
        position: static;
    }
}

/* New Character System Styles */
.wealth-buddy {
    position: relative;
    display: inline-block;
    padding: 20px;
}

.buddy-svg {
    display: block;
    margin: 0 auto;
}

.buddy-accessory {
    position: absolute;
    font-size: 2rem;
    z-index: 10;
    animation: accessory-float 2s ease-in-out infinite;
}

@keyframes accessory-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.buddy-accessory-top {
    top: -15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.buddy-accessory-top-right {
    top: -10px !important;
    right: 20px !important;
}

.buddy-accessory-face {
    top: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.buddy-accessory-side {
    top: 50% !important;
    right: -10px !important;
    transform: translateY(-50%) !important;
}

.accessory-emoji {
    display: inline-block;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

/* Notification Popup */
.notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 15px 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    transform: translateX(400px);
    transition: transform 0.3s ease-out;
    z-index: 1000;
}

.notification-popup.show {
    transform: translateX(0);
}

/* Enhanced shop items */
.shop-item {
    position: relative;
    transition: all 0.3s ease;
}

.shop-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.shop-item.owned {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.shop-item.owned .price {
    background: rgba(255,255,255,0.3);
    color: white;
}

.shop-item.selected {
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Character display animations */
.character-display {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
}

/* Buddy animations */
.buddy-body, .buddy-head {
    transition: all 0.3s ease;
}

.buddy-eyes {
    cursor: pointer;
}

/* Mobile optimizations for character */
@media (max-width: 768px) {
    .buddy-svg {
        width: 150px;
        height: 166px;
    }
    
    .buddy-accessory {
        font-size: 1.5rem;
    }
}
