/* Modern & Universal Design System */
:root {
    --primary: #f26522;
    /* LÖSEV Orange */
    --primary-hover: #db5518;
    --background: #f4f7fa;
    --surface: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border: #e2e8f0;
    --input-bg: #f8fafc;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 440px;
    height: 100dvh;
    min-height: 100dvh;
    background-color: var(--surface);
    position: relative;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
}

/* For larger screens, simulate mobile app without stretching to full width */
@media (min-width: 480px) {
    #app {
        height: 85vh;
        min-height: 85vh;
        border-radius: 20px;
        overflow: hidden;
    }
}

.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Authentication Layout */
.auth-container {
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 35px;
}

.logo-box {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.logo-box img {
    height: 60px;
}

#alt-logo-text {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.auth-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Tabs */
.auth-tabs {
    display: flex;
    background-color: var(--input-bg);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.2s all;
}

.tab-btn.active {
    background-color: var(--surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Forms */
.forms-wrapper {
    position: relative;
    min-height: 260px;
    /* Pre-allocate space to avoid jumps */
}

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

.auth-form.active-form {
    display: flex;
    animation: fadeIn 0.3s;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-group input {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--input-bg);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    transition: 0.2s ease;
}

.input-group input:focus {
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.15);
}

/* Buttons */
.btn {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s all;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(242, 101, 34, 0.3);
}

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

.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background-color: var(--input-bg);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 25px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Map Nodes (Dynamic) */
.module-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    z-index: 2;
}

.module-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 8px 0 var(--primary-hover);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    color: white;
    border: 4px solid white;
    transition: 0.2s transform, 0.2s box-shadow;
}

.module-node:active .module-circle {
    transform: translateY(6px);
    box-shadow: 0 2px 0 var(--primary-hover);
}

.module-circle.locked {
    background-color: #e5e7eb;
    box-shadow: 0 8px 0 #d1d5db;
    cursor: not-allowed;
    filter: grayscale(1);
}

.module-node:active .module-circle.locked {
    transform: none;
    box-shadow: 0 8px 0 #d1d5db;
}

.module-label {
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    max-width: 200px;
    text-align: center;
}

/* Winding Path Layout */
.module-node:nth-child(even) {
    margin-left: -80px;
}

.module-node:nth-child(odd) {
    margin-right: -80px;
}

/* Quiz Options */
.quiz-option {
    padding: 18px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: 0.2s all;
    text-align: left;
    outline: none;
}

.quiz-opt-num {
    color: #9ca3af;
    font-weight: 800;
    margin-right: 15px;
}

.quiz-option.selected {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.quiz-option.selected .quiz-opt-num {
    color: #3b82f6;
}

/* Button Validation Animations */
.quiz-option.correct-anim {
    border-color: #10b981 !important;
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    animation: bounceSuccess 0.5s ease;
}

.quiz-option.correct-anim .quiz-opt-num {
    color: #10b981 !important;
}

.quiz-option.wrong-anim {
    border-color: #ef4444 !important;
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    animation: shakeError 0.4s ease;
}

.quiz-option.wrong-anim .quiz-opt-num {
    color: #ef4444 !important;
}

@keyframes bounceSuccess {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    50% {
        transform: translateX(8px);
    }

    75% {
        transform: translateX(-8px);
    }
}

.feedback-overlay.correct {
    background-color: #dcfce7;
}

.feedback-overlay.correct h3 {
    color: #16a34a;
}

.feedback-overlay.correct .btn {
    background-color: #16a34a;
    box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.3);
}

.feedback-overlay.wrong {
    background-color: #fee2e2;
}

.feedback-overlay.wrong h3 {
    color: #ef4444;
}

.feedback-overlay.wrong .btn {
    background-color: #ef4444;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

/* Butterfly CSS SVG Animation */
.butterfly {
    transform-origin: center;
}

.left-wing {
    transform-origin: 48px 50px;
}

.right-wing {
    transform-origin: 52px 50px;
}

.flapping .left-wing {
    animation: flapLeft 0.15s ease-in-out infinite alternate;
}

.flapping .right-wing {
    animation: flapRight 0.15s ease-in-out infinite alternate;
}

@keyframes flapLeft {
    0% {
        transform: scaleX(1);
    }

    100% {
        transform: scaleX(0.2);
    }
}

@keyframes flapRight {
    0% {
        transform: scaleX(1);
    }

    100% {
        transform: scaleX(0.2);
    }
}

@keyframes popAndVanish {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    20% {
        transform: scale(1.2);
        opacity: 1;
    }

    80% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.popup-anim {
    animation: popAndVanish 1.5s ease-in-out forwards;
}