@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ════════════════════════════════════════════════════════
   SVENSKA365 — SPEAKING (SAMTAL) PRACTICE HUB
   ════════════════════════════════════════════════════════ */

:root {
    --bg-color: #b3e5fc;
    --sidebar-bg: #e8f8ff;
    --card-bg: #ffffff;
    --primary-green: #4caf50;
    --primary-blue: #1565c0;
    --accent-blue: #1d72ff;
    --accent-orange: #ff8a3d;
    --text-main: #1a2a3a;
    --text-muted: #4a6070;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --border-radius: 16px;
    --card-border: 1px solid rgba(255,255,255,0.6);
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(145deg, #b3e5fc 0%, #81d4fa 50%, #a5d8f0 100%);
    min-height: 100vh;
    color: var(--text-main);
}

.hide { display: none !important; }

/* ════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════ */

.title {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 40%, #1976d2 100%);
    padding: 28px 40px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(13, 71, 161, 0.35);
}

.title h1 {
    color: #ffffff;
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ════════════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════════════ */

.workspace-container {
    display: flex;
    flex-direction: row;
    gap: 24px;
    padding: 28px 32px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════ */

.topics-sidebar {
    min-width: 220px;
    width: 240px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 22px 18px;
    box-shadow: 0 6px 24px rgba(21, 101, 192, 0.13);
    border: var(--card-border);
    flex-shrink: 0;
    position: sticky;
    top: 24px;
}

.topics-sidebar h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ddeef8;
}

.level-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.level-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    transition: background 0.18s, color 0.18s;
    user-select: none;
}

.level-item:hover {
    background: #d6eef9;
    color: var(--primary-blue);
}

.level-item input[type="checkbox"] {
    accent-color: var(--primary-blue);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   MAIN AREA
   ════════════════════════════════════════════════════════ */

.tests-display-area {
    flex: 1;
    min-width: 0;
}

.tests-display-area > h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

#panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0;
}

.panel-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* ════════════════════════════════════════════════════════
   TOPIC CARDS — ACCORDION
   ════════════════════════════════════════════════════════ */

.practice-card {
    background: rgba(255,255,255,0.92);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 3px 14px rgba(21, 101, 192, 0.10);
    border: var(--card-border);
    transition: box-shadow 0.2s;
}

.practice-card:hover {
    box-shadow: 0 6px 24px rgba(21, 101, 192, 0.18);
}

.practice-card.is-done {
    border: 1px solid #a5d6a7;
}

.practice-card.is-empty {
    opacity: 0.55;
}

.practice-card.is-empty .card-count {
    color: #9aa8b3;
}

.test-card-title {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    padding: 14px 20px;
    user-select: none;
    transition: background 0.15s;
}

.test-card-title:hover {
    background: rgba(213, 238, 251, 0.45);
}

.card-icon-img {
    width: 2.4rem;
    height: 2.4rem;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}

.card-text {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.card-done-badge {
    font-size: 0.95rem;
    margin-left: -4px;
}

.card-count {
    font-size: 1rem;
    font-weight: 700;
    font-style: italic;
    color: var(--text-muted);
    margin-left: 4px;
    white-space: nowrap;
}

.card-arrow {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: transform 0.25s;
}

.button-container {
    border-top: 1px solid #ddeef8;
    background: #f4fbff;
}

.sq-loading {
    padding: 16px 20px;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-style: italic;
}

.sq-error {
    padding: 16px 20px;
    font-size: 0.88rem;
    color: #c62828;
}

/* ════════════════════════════════════════════════════════
   TOPIC TITLE LIST (rows inside an expanded topic card)
   ════════════════════════════════════════════════════════ */

.test-title-item {
    padding: 11px 20px 11px 48px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    border-bottom: 1px solid #e8f4fb;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.test-title-item::before {
    content: '🗣️';
    font-size: 13px;
    flex-shrink: 0;
    position: absolute;
    left: 20px;
}

.test-title-item:hover {
    background: #d6eef9;
    color: var(--primary-blue);
}

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

/* ════════════════════════════════════════════════════════
   QUIZ / PRACTICE CONTAINER
   ════════════════════════════════════════════════════════ */

#quiz-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

/* ════════════════════════════════════════════════════════
   SPEAKING PRACTICE CARD (mirrors .reading-quiz)
   ════════════════════════════════════════════════════════ */

.reading-quiz {
    background: rgba(255,255,255,0.92);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(21, 101, 192, 0.12);
    border: var(--card-border);
}

.reading-quiz__title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(90deg, #dceefb 0%, #cfe8f7 100%);
    border-bottom: 1px solid #b5d4ee;
}

.reading-quiz__index {
    display: none;
}

.reading-quiz__title {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-main);
}

.reading-quiz__body {
    display: flex;
    flex-direction: column;
    padding: 20px 22px;
    gap: 24px;
}

.reading-quiz__passage-row {
    display: flex;
    flex-direction: row;
    gap: 18px;
    align-items: stretch;
}

.reading-quiz__image-col {
    flex: 0 0 50%;
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reading-quiz__image {
    width: 100%;
    height: 100%;
    max-height: 260px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 3px 12px rgba(21,101,192,0.13);
    display: block;
}

.reading-quiz__content-col {
    flex: 0 0 50%;
    width: 50%;
    min-width: 0;
    display: flex;
    align-items: center;
}

.reading-quiz__questions-col {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ════════════════════════════════════════════════════════
   BACK BUTTONS
   ════════════════════════════════════════════════════════ */

.rq-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    padding: 9px 20px;
    background: rgba(255,255,255,0.85);
    color: var(--primary-blue);
    border: 2px solid #b5d4ee;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.3px;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(21,101,192,0.10);
    transition: background 0.18s, border-color 0.18s, transform 0.15s;
}

.rq-back-btn:hover {
    background: #d6eef9;
    border-color: #90caf9;
    transform: translateX(-2px);
}

.rq-score-actions {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.rq-back-after-result-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 28px;
    background: linear-gradient(90deg, #1d72ff 0%, #1565c0 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.8px;
    box-shadow: 0 3px 10px rgba(29,114,255,0.3);
    transition: filter 0.2s, transform 0.15s;
}

.rq-back-after-result-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.rq-back-after-result-btn:active {
    transform: translateY(0);
}

/* ════════════════════════════════════════════════════════
   SPEAKING PRACTICE PANEL
   ════════════════════════════════════════════════════════ */

.sq-panel {
    padding: 20px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sq-intro {
    font-size: 0.92rem;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.6;
    background: linear-gradient(160deg, #ffffff 60%, #eaf5fd 100%);
    border: 1px solid #d0e8f5;
    border-radius: 12px;
    padding: 12px 16px;
}

/* ── Each guided point ── */
.sq-point {
    background: #ffffff;
    border: 1px solid #d0e8f5;
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sq-point-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.sq-point-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #fff;
    font-weight: 900;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.sq-point-label {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.4;
}

.sq-point-hint {
    font-size: 0.88rem;
    font-weight: 600;
    font-style: italic;
    color: var(--text-muted);
    margin-left: 36px;
    line-height: 1.5;
}

.sq-point-body {
    margin-left: 36px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sq-textarea {
    width: 100%;
    min-height: 62px;
    resize: vertical;
    font-family: 'Nunito', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    border: 2px solid #d0e8f5;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f9fdff;
    transition: border-color 0.15s, background 0.15s;
}

.sq-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: #ffffff;
}

.sq-point-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sq-mic-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 2px solid #d0e8f5;
    border-radius: 50px;
    background: #ffffff;
    color: var(--primary-blue);
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.sq-mic-btn:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}

.sq-mic-btn.recording {
    background: #ffebee;
    border-color: #e53935;
    color: #c62828;
    animation: sq-pulse 1s infinite;
}

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

.sq-audio-player {
    height: 34px;
    max-width: 220px;
}

.sq-mic-error {
    font-size: 0.78rem;
    color: #c62828;
    font-weight: 600;
}

/* ── Example / model answer reveal ── */
.sq-example-wrap {
    background: linear-gradient(160deg, #fff8ec 60%, #fff1de 100%);
    border: 1px solid #f0dcb5;
    border-radius: 14px;
    padding: 14px 18px;
}

.sq-example-heading {
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.3px;
    color: #b5651d;
    text-transform: uppercase;
}

.sq-example-text {
    margin-top: 10px;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.8;
    color: var(--text-main);
}

/* ── Complete button + banner ── */
.sq-complete-btn {
    display: block;
    margin: 4px 0 0 auto;
    padding: 11px 30px;
    background: linear-gradient(90deg, #4caf50 0%, #2e7d32 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(46,125,50,0.3);
    transition: filter 0.2s, transform 0.15s;
}

.sq-complete-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.sq-done-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    background: linear-gradient(160deg, #ffffff 60%, #eaf5fd 100%);
    border: 1px solid #d0e8f5;
    border-radius: 16px;
    text-align: center;
}

.sq-done-emoji {
    font-size: 2.6rem;
    line-height: 1;
}

.sq-done-msg {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-main);
}

.sq-done-sub {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .workspace-container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }

    .topics-sidebar {
        width: 100%;
        position: static;
        padding: 16px 14px;
    }

    .level-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .level-item {
        padding: 8px 12px;
        border-radius: 50px;
        background: rgba(21, 101, 192, 0.07);
        font-size: 0.88rem;
    }

    .title { padding: 18px 16px; }
    .title h1 { font-size: 1.2rem; }
    .tests-display-area > h2 { font-size: 1.1rem; }
    #panel-title { font-size: 0.88rem; }

    .test-card-title { padding: 12px 14px; gap: 10px; }
    .card-icon-img { width: 2rem; height: 2rem; }
    .card-text { font-size: 0.92rem; }
    .card-count { font-size: 0.85rem; }

    .sq-panel { padding: 16px 14px 18px; }
    .sq-point { padding: 14px; }
    .sq-point-hint, .sq-point-body { margin-left: 0; }
    .sq-point-label { font-size: 0.92rem; }
    .sq-complete-btn { width: 100%; }

    .test-title-item {
        padding: 12px 16px 12px 44px;
        font-size: 0.88rem;
    }

    .reading-quiz__title {
        font-size: 1rem;
    }

    .reading-quiz__passage-row {
        flex-direction: column;
        align-items: center;
    }

    .reading-quiz__image-col {
        width: 100%;
        justify-content: center;
    }

    .reading-quiz__image {
        width: 130px;
        height: 130px;
    }

    .reading-quiz__body {
        padding: 14px;
        gap: 18px;
    }

    .rq-back-btn {
        font-size: 0.82rem;
        padding: 8px 16px;
    }

    .rq-back-after-result-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 0.88rem;
    }
}

@media (max-width: 380px) {
    .title h1 { font-size: 1rem; }
    .level-item { font-size: 0.8rem; padding: 7px 10px; }
    .card-text, .card-count { font-size: 0.85rem; }
}