/* ===========================
   VARIABLES & RESET
   =========================== */
:root {
    --primary-color: #10b981;
    --primary-dark: #059669;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --success-color: #22c55e;
    --warning-color: #fbbf24;
    --danger-color: #ef4444;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.page {
    display: none;
}

.page.active {
    display: block;
}

.view-content {
    display: none;
}

.view-content.active {
    display: block;
}

/* ===========================
   BUTTONS
   =========================== */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===========================
   LANDING PAGE
   =========================== */
.landing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.landing-hero {
    text-align: center;
    padding: 60px 20px;
}

.logo-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.logo-main i {
    font-size: 64px;
    color: var(--primary-color);
}

.logo-main h1 {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 24px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.stats-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    max-width: 800px;
    margin: 40px auto;
}

.stat-item {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
}

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

.login-link {
    margin-top: 24px;
    color: var(--text-secondary);
}

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

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 60px;
}

.feature-card {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: var(--transition);
}

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

.feature-card i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

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

/* ===========================
   MODAL
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--text-primary);
}

/* ===========================
   AUTH FORMS
   =========================== */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.auth-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
}

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

/* ===========================
   ONBOARDING
   =========================== */
.onboarding-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.onboarding-slide {
    display: none;
    text-align: center;
    animation: slideUp 0.5s ease;
}

.onboarding-slide.active {
    display: block;
}

.onboarding-icon {
    font-size: 80px;
    color: var(--primary-color);
    margin-bottom: 24px;
}

.onboarding-content h2 {
    font-size: 32px;
    margin-bottom: 16px;
}

.onboarding-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.onboarding-list {
    list-style: none;
    text-align: left;
    max-width: 500px;
    margin: 32px auto;
}

.onboarding-list li {
    padding: 12px 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.onboarding-list i {
    color: var(--success-color);
}

.onboarding-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.onboarding-feature {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius-lg);
}

.onboarding-feature i {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.onboarding-feature h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

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

.speed-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.speed-option {
    background: white;
    border: 3px solid var(--border-color);
    padding: 32px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
}

.speed-option:hover,
.speed-option.selected {
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.05);
    transform: scale(1.05);
}

.speed-option i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.speed-option h4 {
    font-size: 20px;
    margin-bottom: 8px;
}

.speed-option p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.speed-option span {
    display: block;
    font-size: 14px;
    color: var(--text-light);
}

.onboarding-note {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 24px;
}

.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 40px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    transition: var(--transition);
}

.progress-dot.active {
    background: var(--primary-color);
    width: 32px;
    border-radius: 6px;
}

/* ===========================
   DASHBOARD
   =========================== */
.dashboard-header {
    background: white;
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left .logo i {
    font-size: 24px;
    color: var(--primary-color);
}

.header-right .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-menu {
    position: absolute;
    top: 70px;
    right: 24px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none;
    z-index: 200;
}

.user-menu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

.user-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.user-menu a:hover {
    background: var(--bg-secondary);
}

.user-menu a i {
    margin-right: 12px;
    color: var(--primary-color);
}

.dashboard-main {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
    width: 300px;
    background: white;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
}

.progress-section {
    margin-bottom: 32px;
}

.progress-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar-container {
    position: relative;
    margin-bottom: 16px;
}

.progress-bar {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    overflow: hidden;
}

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

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 12px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.xp-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent-color);
}

.xp-display i {
    font-size: 20px;
}

.modules-nav {
    margin-bottom: 32px;
}

.modules-nav h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modules-list {
    list-style: none;
}

.module-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.module-item.completed {
    background: rgba(34, 197, 94, 0.1);
}

.module-item.active {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--primary-color);
}

.module-item:hover:not(.locked) {
    background: var(--bg-secondary);
}

.module-icon {
    font-size: 20px;
}

.module-icon.locked {
    color: var(--text-light);
}

.module-icon.completed {
    color: var(--success-color);
}

.module-icon.active {
    color: var(--primary-color);
}

.module-info {
    flex: 1;
}

.module-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.module-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.badges-preview h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.badge-mini {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--bg-secondary);
    transition: var(--transition);
}

.badge-mini.locked {
    opacity: 0.3;
    filter: grayscale(1);
}

.badge-mini.unlocked {
    background: linear-gradient(135deg, var(--accent-color), #f97316);
    color: white;
    animation: pulse 2s infinite;
}

/* ===========================
   CONTENT AREA
   =========================== */
.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.welcome-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

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

.next-step-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.next-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.next-step-header i {
    font-size: 32px;
    color: var(--primary-color);
}

.next-step-header h2 {
    font-size: 24px;
}

.next-step-content h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.next-step-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card i {
    font-size: 36px;
    color: var(--primary-color);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

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

/* ===========================
   PROFILE VIEW
   =========================== */
.profile-card {
    background: white;
    padding: 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    max-width: 600px;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 1001;
    animation: slideInRight 0.3s ease;
}

.toast.active {
    display: block;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-content i {
    font-size: 24px;
    color: var(--success-color);
}

/* ===========================
   BADGE UNLOCK ANIMATION
   =========================== */
.badge-unlock-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.badge-unlock-modal.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.badge-unlock-content {
    background: white;
    padding: 48px;
    border-radius: var(--radius-xl);
    text-align: center;
    max-width: 500px;
    animation: bounceIn 0.6s ease;
}

.badge-unlock-icon {
    font-size: 80px;
    color: var(--accent-color);
    margin-bottom: 24px;
    animation: pulse 1.5s infinite;
}

.badge-unlock-content h2 {
    font-size: 32px;
    margin-bottom: 24px;
}

.badge-display {
    background: linear-gradient(135deg, var(--accent-color), #f97316);
    color: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    margin: 24px 0;
}

.badge-display i {
    font-size: 64px;
    margin-bottom: 16px;
}

.badge-display h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.xp-earned {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 24px;
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 70px;
        height: calc(100vh - 70px);
        z-index: 99;
        transition: var(--transition);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .content-area {
        padding: 16px;
    }
    
    .logo-main h1 {
        font-size: 32px;
    }
    
    .logo-main i {
        font-size: 48px;
    }
    
    .welcome-card {
        padding: 24px;
    }
    
    .welcome-card h1 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 24px;
    }
    
    .features-grid,
    .stats-preview {
        grid-template-columns: 1fr;
    }
}
