/* ============================================
   n8n Mastery - Modern Minimal Design 2024
   Color Scheme: #EA4B71, #FFFFFF, #040506
   ============================================ */

:root {
    /* Primary Colors */
    --primary: #EA4B71;
    --primary-hover: #d63d62;
    --primary-light: rgba(234, 75, 113, 0.1);
    --primary-glow: rgba(234, 75, 113, 0.3);

    /* Light Mode */
    --bg-0: #FFFFFF;
    --bg-1: #f8f9fa;
    --bg-2: #f1f3f5;
    --bg-3: #e9ecef;

    --text-0: #040506;
    --text-1: #212529;
    --text-2: #495057;
    --text-3: #868e96;

    /* Status Colors */
    --green: #22c55e;
    --green-light: rgba(34, 197, 94, 0.1);
    --red: #ef4444;
    --red-light: rgba(239, 68, 68, 0.1);
    --yellow: #f59e0b;
    --yellow-light: rgba(245, 158, 11, 0.1);

    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);

    --transition: 0.2s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-0: #040506;
    --bg-1: #0d0e10;
    --bg-2: #16181a;
    --bg-3: #1f2124;

    --text-0: #FFFFFF;
    --text-1: #e9ecef;
    --text-2: #adb5bd;
    --text-3: #6c757d;

    --primary-light: rgba(234, 75, 113, 0.15);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-0);
    color: var(--text-0);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================
   Navigation
   ============================================ */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 64px;
    background: var(--bg-1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-0);
    letter-spacing: -0.03em;
}

.nav-brand span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.25rem;
}

.nav-links a {
    color: var(--text-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-3);
}

.toggle-icon::before {
    content: '☀️';
    font-size: 1rem;
}

[data-theme="dark"] .toggle-icon::before {
    content: '🌙';
}

.user-score {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
}

/* ============================================
   Container
   ============================================ */

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

/* ============================================
   Hero
   ============================================ */

.hero {
    text-align: center;
    padding: 5rem 1rem 4rem;
    max-width: 680px;
    margin: 0 auto 3rem;
}

.hero-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    color: var(--text-0);
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-2);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-3);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--bg-3);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg-2);
    color: var(--text-1);
}

.btn-secondary:hover {
    background: var(--bg-3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-1);
    border: 1px solid var(--bg-3);
}

.btn-ghost:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0;
    font-family: inherit;
    transition: var(--transition);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   Section Header
   ============================================ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-0);
    letter-spacing: -0.02em;
}

.section-desc {
    color: var(--text-2);
    font-size: 0.9375rem;
    margin-top: 0.25rem;
}

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-1);
    padding: 0.25rem;
    border-radius: var(--radius);
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.filter-tab:hover {
    color: var(--text-1);
}

.filter-tab.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   Course Grid
   ============================================ */

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.course-card {
    background: var(--bg-1);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.course-card:hover {
    background: var(--bg-2);
    transform: translateY(-2px);
}

.course-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.course-category {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.course-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 100px;
}

.status-new {
    background: var(--primary-light);
    color: var(--primary);
}

.status-completed {
    background: var(--green-light);
    color: var(--green);
}

.status-in-progress {
    background: var(--yellow-light);
    color: var(--yellow);
}

.course-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-0);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.course-card p {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.course-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--text-3);
}

.course-meta span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.no-courses {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-3);
    font-size: 1rem;
}

/* ============================================
   Quiz Section
   ============================================ */

.quiz-section {
    max-width: 720px;
    margin: 0 auto;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.quiz-info {
    text-align: right;
}

.quiz-info h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-0);
}

.quiz-progress-text {
    font-size: 0.875rem;
    color: var(--text-3);
}

.progress-bar {
    height: 4px;
    background: var(--bg-2);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.quiz-content {
    min-height: 360px;
}

.question-container {
    animation: fadeIn 0.3s ease;
}

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

.question-type {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-0);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.question-hint {
    background: var(--primary-light);
    color: var(--text-1);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
    border-left: 3px solid var(--primary);
}

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    gap: 1rem;
}

.option-item:hover {
    background: var(--bg-2);
}

.option-item.selected {
    background: var(--primary-light);
}

.option-item.correct {
    background: var(--green-light);
}

.option-item.incorrect {
    background: var(--red-light);
}

.option-marker {
    width: 28px;
    height: 28px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-2);
    flex-shrink: 0;
    transition: var(--transition);
}

.option-item.selected .option-marker {
    background: var(--primary);
    color: white;
}

.option-text {
    font-size: 0.9375rem;
    color: var(--text-1);
}

/* Drag and Drop */
.drag-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.drag-source h4, .drag-target h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 0.75rem;
}

.drag-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 200px;
    padding: 0.75rem;
    background: var(--bg-1);
    border-radius: var(--radius);
}

.drag-item {
    padding: 0.75rem 1rem;
    background: var(--bg-0);
    border-radius: var(--radius-sm);
    cursor: grab;
    font-size: 0.875rem;
    color: var(--text-1);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.drag-item:active { cursor: grabbing; }
.drag-item.dragging { opacity: 0.5; }

.drop-zone {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-0);
    border: 2px dashed var(--bg-3);
    border-radius: var(--radius-sm);
    min-height: 48px;
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.drop-zone.drag-over {
    background: var(--primary-light);
    border-color: var(--primary);
}

.drop-zone-label {
    color: var(--text-3);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Quiz Navigation */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
}

/* ============================================
   Results
   ============================================ */

.results-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.results-card {
    background: var(--bg-1);
    border-radius: var(--radius-xl);
    padding: 3rem;
    text-align: center;
    max-width: 420px;
    width: 100%;
}

.results-score {
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-0);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.results-score .percent {
    font-size: 2rem;
    color: var(--text-2);
}

.results-score.excellent { color: var(--green); }
.results-score.good { color: var(--yellow); }
.results-score.poor { color: var(--red); }

.results-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 1.5rem;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.result-stat {
    text-align: center;
}

.result-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.result-stat-value.correct { color: var(--green); }
.result-stat-value.wrong { color: var(--red); }
.result-stat-value.xp { color: var(--primary); }

.result-stat-label {
    font-size: 0.8125rem;
    color: var(--text-3);
}

.results-message {
    background: var(--bg-2);
    padding: 1rem;
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

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

/* Loading indicator */
.loading-overlay {
    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: 1000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Review
   ============================================ */

.review-section {
    max-width: 720px;
    margin: 0 auto;
}

.review-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.review-item {
    background: var(--bg-1);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    padding-left: 1.75rem;
}

.review-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

.review-item.correct::before { background: var(--green); }
.review-item.incorrect::before { background: var(--red); }

.review-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.review-item-number {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-2);
}

.review-item-status {
    font-size: 0.8125rem;
    font-weight: 600;
}

.review-item-status.correct { color: var(--green); }
.review-item-status.incorrect { color: var(--red); }

.review-question {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-0);
    margin-bottom: 1rem;
}

.review-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.review-answer {
    padding: 0.75rem;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
}

.review-answer-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.review-answer-value {
    font-size: 0.9375rem;
    color: var(--text-1);
}

.review-explanation {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
}

.review-explanation h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.review-explanation p {
    font-size: 0.9375rem;
    color: var(--text-2);
}

/* ============================================
   Progress Section
   ============================================ */

.progress-section {
    margin-top: 4rem;
    padding-top: 2rem;
}

.progress-overview {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.progress-card {
    background: var(--bg-1);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.progress-card.main {
    background: var(--primary);
    color: white;
}

.progress-card-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 0.5rem;
}

.progress-card.main .progress-card-label {
    color: rgba(255,255,255,0.7);
}

.progress-card-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-0);
    letter-spacing: -0.02em;
}

.progress-card.main .progress-card-value {
    color: white;
}

.progress-card-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-2);
    margin-left: 0.25rem;
}

.level-info {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.level-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.level-next {
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.7);
}

.progress-list {
    background: var(--bg-1);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.progress-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    gap: 1rem;
    transition: var(--transition);
}

.progress-item:hover {
    background: var(--bg-2);
}

.progress-item-info {
    flex: 1;
}

.progress-item-info strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-0);
}

.progress-item-info small {
    font-size: 0.8125rem;
    color: var(--text-3);
}

.progress-item-bar {
    width: 120px;
    height: 4px;
    background: var(--bg-3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-item-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
}

.progress-item-score {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-0);
    min-width: 48px;
    text-align: right;
}

/* ============================================
   Footer
   ============================================ */

footer {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-3);
    font-size: 0.875rem;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

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

    .hero-stats {
        gap: 1.25rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-tabs {
        width: 100%;
        overflow-x: auto;
    }

    .course-grid {
        grid-template-columns: 1fr;
    }

    .progress-overview {
        grid-template-columns: 1fr;
    }

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

    .review-answers {
        grid-template-columns: 1fr;
    }

    .results-actions {
        flex-direction: column;
    }

    .results-actions .btn {
        width: 100%;
    }
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-1);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}
