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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5b21b6 0%, #6d28d9 50%, #7c3aed 100%);
    padding: 20px;
}

.login-container {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 1.8rem;
    color: #6d28d9;
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #6d28d9;
}

.error-message {
    color: #dc2626;
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: #6d28d9;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 2px solid #e0e0e0;
    color: #666;
}

.btn-outline:hover {
    background: #f5f5f5;
}

.btn-full {
    width: 100%;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #5b21b6 0%, #6d28d9 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.sidebar-header .subtitle {
    font-size: 0.85rem;
    opacity: 0.7;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn-outline {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-footer .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    background: #f5f7fa;
    min-height: 100vh;
}

/* ============================================================
   PAGES
   ============================================================ */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 1.8rem;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.page-header p {
    color: #666;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 1rem;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title svg {
    width: 20px;
    height: 20px;
}

.section-title.learn {
    color: #6d28d9;
}

.section-title.practice {
    color: #10b981;
}

/* ============================================================
   CHILD SELECTOR
   ============================================================ */
.child-selector-card {
    margin-bottom: 20px;
}

.form-select {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: #6d28d9;
}

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.coins {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
}

.stat-icon.points {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
}

.stat-icon.modules {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.stat-icon.streak {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
}

/* ============================================================
   PLAYER INFO CARD
   ============================================================ */
.player-info-card {
    margin-bottom: 20px;
}

.player-info-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
}

.player-details h2 {
    font-size: 1.5rem;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.player-meta {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge.team {
    background: #e0e7ff;
    color: #4338ca;
}

.badge.position {
    background: #d1fae5;
    color: #059669;
}

/* ============================================================
   ACTIVITY LIST
   ============================================================ */
.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-title {
    font-weight: 500;
    color: #333;
}

.activity-meta {
    font-size: 0.85rem;
    color: #888;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* ============================================================
   MODULES
   ============================================================ */
.modules-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.module-section {
    height: fit-content;
}

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

.module-item {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ccc;
}

.module-item.locked {
    border-left-color: #94a3b8;
    opacity: 0.6;
}

.module-item.unlocked {
    border-left-color: #f59e0b;
}

.module-item.completed {
    border-left-color: #10b981;
}

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

.module-name {
    font-weight: 600;
    color: #333;
}

.module-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-locked {
    background: #e5e7eb;
    color: #6b7280;
}

.status-unlocked {
    background: #fef3c7;
    color: #b45309;
}

.status-completed {
    background: #d1fae5;
    color: #059669;
}

.scenarios-list {
    margin-top: 12px;
    padding-left: 12px;
}

.scenario-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.scenario-item.completed {
    border-left: 3px solid #10b981;
}

.scenario-item.unlocked {
    border-left: 3px solid #f59e0b;
}

.score-badge {
    padding: 2px 8px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================================
   ACHIEVEMENTS
   ============================================================ */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.achievement-item {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.achievement-item.earned {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.achievement-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.achievement-item.earned .achievement-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.achievement-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.achievement-desc {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .app {
        flex-direction: column;
    }

    .modules-container {
        grid-template-columns: 1fr;
    }

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