/* ============================================
   GLOSEMESTER.CSS — Øvedel-design
   Nivåvalg, Quiz-grensesnitt, Resultater
   ============================================ */

/* ==================== NIVÅVALG ==================== */

.glosemester-container {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, hsl(258, 90%, 92%) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 100%, hsl(270, 85%, 93%) 0%, transparent 55%),
        hsl(258, 60%, 97%);
    padding-bottom: 40px;
}

/* Header */
.fag-header {
    background: linear-gradient(170deg, hsl(258, 80%, 14%) 0%, hsl(270, 75%, 22%) 100%);
    padding: 52px 24px 44px;
    text-align: center;
    border-radius: 0 0 48px 48px;
    position: relative;
    overflow: hidden;
    margin-bottom: 32px;
}

.fag-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 60% at 20% 0%, rgba(139, 92, 246, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 80% 100%, rgba(99, 102, 241, 0.2) 0%, transparent 55%);
    pointer-events: none;
}

.fag-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, hsl(270, 100%, 88%) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.fag-header p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.65);
    position: relative;
    z-index: 1;
    letter-spacing: 0.02em;
}

/* Nette grid for nivåkortene */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
    max-width: 740px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Nivåkort */
.level-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-lg, 32px);
    padding: 28px 24px 24px;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.10);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 32px 32px 0 0;
}

.level-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(124, 58, 237, 0.18);
}

/* Fargede topstriper per nivå */
.level-card[data-level="niva1"]::before {
    background: linear-gradient(90deg, #10b981, #34d399);
}
.level-card[data-level="niva2"]::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}
.level-card[data-level="niva3"]::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.level-card[data-level="niva4"]::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.level-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.level-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary, #1F2937);
    line-height: 1.3;
}

.level-badge {
    flex-shrink: 0;
    background: rgba(124, 58, 237, 0.09);
    color: var(--purple-600, #7C3AED);
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    font-family: var(--font-body);
}

.level-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary, #6B7280);
    font-weight: 600;
}

.word-count {
    display: flex;
    align-items: center;
    gap: 5px;
}

.word-count::before {
    content: '📖';
    font-size: 14px;
}

.has-images {
    background: rgba(16, 185, 129, 0.10);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

/* Start-knapp på kortene */
.start-practice-btn {
    width: 100%;
    padding: 14px 20px;
    font-family: var(--font-heading, 'Outfit', system-ui);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, hsl(258, 80%, 52%) 0%, hsl(270, 85%, 62%) 100%);
    border: none;
    border-radius: var(--radius-full, 999px);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.38);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease;
    letter-spacing: 0.01em;
}

.start-practice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.50);
}

.start-practice-btn:active {
    transform: scale(0.98);
}

/* Nivåfarge-varianter på knapper */
.level-card[data-level="niva1"] .start-practice-btn {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}
.level-card[data-level="niva2"] .start-practice-btn {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}
.level-card[data-level="niva3"] .start-practice-btn {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}
.level-card[data-level="niva4"] .start-practice-btn {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* ==================== QUIZ-GRENSESNITT ==================== */

.glosemester-quiz {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, hsl(258, 90%, 92%) 0%, transparent 60%),
        hsl(258, 60%, 97%);
    position: relative;
}

/* Quiz header */
.quiz-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(124, 58, 237, 0.10);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}

.btn-back {
    flex-shrink: 0;
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple-600, #7C3AED);
    border: 1.5px solid rgba(124, 58, 237, 0.2);
    border-radius: 999px;
    padding: 8px 16px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-back:hover {
    background: rgba(124, 58, 237, 0.14);
    border-color: var(--purple-500, #8B5CF6);
}

.quiz-info {
    flex: 1;
    min-width: 0;
}

.quiz-info h2 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary, #1F2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quiz-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 2px;
}

.quiz-stats span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6B7280);
}

/* Retnings-toggle */
.direction-toggle {
    display: flex;
    background: rgba(124, 58, 237, 0.08);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
}

.lang-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 999px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary, #6B7280);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.lang-btn.active {
    background: linear-gradient(135deg, hsl(258, 80%, 52%), hsl(270, 85%, 62%));
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

/* Quiz-innhold */
.quiz-content {
    flex: 1;
    padding: 24px 20px;
    max-width: 580px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Spørsmålskontainer */
.question-container {
    text-align: center;
    padding: 32px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-lg, 32px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.10);
    margin-bottom: 20px;
}

.question-word {
    font-family: var(--font-heading);
    font-size: clamp(28px, 7vw, 52px);
    font-weight: 900;
    background: linear-gradient(135deg, hsl(258, 80%, 36%) 0%, hsl(270, 85%, 50%) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.15;
    word-break: break-word;
}

.word-image {
    margin-top: 20px;
}

.word-image img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Svarboks (skriving) */
.answer-container {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: stretch;
}

.answer-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid rgba(124, 58, 237, 0.18);
    border-radius: var(--radius-full, 999px);
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--text-primary, #1F2937);
    background: rgba(255, 255, 255, 0.95);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.answer-input:focus {
    border-color: var(--purple-500, #8B5CF6);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.btn-check {
    flex-shrink: 0;
    padding: 14px 24px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, hsl(258, 80%, 52%), hsl(270, 85%, 62%));
    border: none;
    border-radius: var(--radius-full, 999px);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(124, 58, 237, 0.50);
}

/* Flervalg-alternativer */
.answer-alternatives {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.alternative-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(124, 58, 237, 0.15);
    border-radius: var(--radius-md, 22px);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s ease,
                background 0.2s ease,
                box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.06);
}

.alternative-btn:hover:not(:disabled) {
    border-color: var(--purple-500, #8B5CF6);
    background: rgba(139, 92, 246, 0.06);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.14);
}

.alternative-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Tilbakemelding */
.feedback {
    min-height: 40px;
    text-align: center;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    padding: 10px;
    border-radius: var(--radius-sm, 14px);
    transition: all 0.25s ease;
    margin-bottom: 8px;
}

.feedback.correct {
    color: #059669;
    background: rgba(16, 185, 129, 0.10);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.feedback.incorrect {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.20);
}

/* Progress-bar nederst */
.progress-bar {
    position: sticky;
    bottom: 0;
    height: 6px;
    background: rgba(124, 58, 237, 0.12);
    border-radius: 999px 999px 0 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, hsl(258, 80%, 52%), hsl(270, 85%, 62%));
    border-radius: inherit;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

/* ==================== RESULTATER ==================== */

.quiz-results {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, hsl(258, 90%, 92%) 0%, transparent 60%),
        hsl(258, 60%, 97%);
    text-align: center;
    gap: 28px;
}

.quiz-results h2 {
    font-family: var(--font-heading);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 900;
    color: var(--text-primary, #1F2937);
}

.result-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-md, 22px);
    padding: 24px 32px;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.10);
    min-width: 130px;
}

.stat-box .stat-value {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, hsl(258, 80%, 48%), hsl(270, 85%, 60%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-box .stat-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary, #6B7280);
}

.kort-won {
    background: linear-gradient(135deg, hsl(258, 80%, 52%), hsl(270, 85%, 62%));
    color: #fff;
    border-radius: var(--radius-lg, 32px);
    padding: 20px 32px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.35);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}

.result-actions .btn-primary,
.result-actions button.btn-primary {
    width: 100%;
    padding: 16px 24px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, hsl(258, 80%, 52%), hsl(270, 85%, 62%));
    border: none;
    border-radius: var(--radius-full, 999px);
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(124, 58, 237, 0.40);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-actions .btn-primary:hover,
.result-actions button.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.52);
}

.result-actions .btn-secondary,
.result-actions button.btn-secondary {
    width: 100%;
    padding: 14px 24px;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: var(--purple-600, #7C3AED);
    background: transparent;
    border: 2px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-full, 999px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-actions .btn-secondary:hover,
.result-actions button.btn-secondary:hover {
    background: rgba(124, 58, 237, 0.07);
    border-color: var(--purple-500, #8B5CF6);
}

/* ==================== RESPONSIVT ==================== */

@media (max-width: 600px) {
    .fag-header {
        padding: 40px 20px 36px;
        border-radius: 0 0 36px 36px;
        margin-bottom: 24px;
    }

    .level-grid {
        grid-template-columns: 1fr;
        padding: 0 16px;
        gap: 14px;
    }

    .quiz-header {
        gap: 8px;
        padding: 12px 16px;
    }

    .quiz-info h2 {
        font-size: 13px;
    }

    .quiz-content {
        padding: 18px 16px;
    }

    .question-container {
        padding: 28px 16px;
    }

    .answer-container {
        flex-direction: column;
    }

    .answer-input,
    .btn-check {
        width: 100%;
    }

    .result-stats {
        gap: 12px;
    }

    .stat-box {
        padding: 18px 24px;
        min-width: 110px;
    }

    .stat-box .stat-value {
        font-size: 34px;
    }
}
