/* Custom subchapter picker — Quiz vânătoare */

.quiz-intro {
    max-width: min(640px, 100%);
}

/* Header quiz activ — toolbar + titlu pe rânduri separate */
.quiz-header--exam-active {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px 16px 20px;
    text-align: center;
    overflow: visible;
}

.quiz-header-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 44px;
}

.quiz-header-toolbar .btn-back-header {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    flex-shrink: 0;
    margin: 0;
}

.quiz-header-toolbar .exam-header-menu,
.quiz-header-toolbar .exam-header-menu-btn {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    flex-shrink: 0;
    margin: 0;
    z-index: 30;
}

.exam-header-menu-btn {
    border: none;
    font-family: inherit;
}

.quiz-body .loading-container {
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quiz-header-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.quiz-header--exam-active h1 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.25;
    width: 100%;
}

.quiz-header--exam-active p {
    display: block;
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.92;
    line-height: 1.4;
}

.quiz-header--exam-active .quiz-session-badge {
    margin-top: 0;
}

.quiz-container.scope-picker-open,
.quiz-scope-field,
.quiz-intro-modern .quiz-scope-field {
    overflow: visible;
}

.quiz-container.scope-picker-open {
    z-index: 50;
}

.quiz-scope-picker {
    position: relative;
    width: 100%;
    text-align: left;
}

.quiz-scope-picker.open {
    z-index: 120;
}

.quiz-scope-picker.disabled {
    opacity: 0.65;
    pointer-events: none;
}

.quiz-scope-picker-trigger {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz-scope-picker-trigger:hover:not(:disabled) {
    border-color: #adb5bd;
}

.quiz-scope-picker.open .quiz-scope-picker-trigger {
    border-color: #2f5d3a;
    box-shadow: 0 0 0 3px rgba(47, 93, 58, 0.15);
}

.quiz-scope-picker-trigger-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.scope-line {
    display: block;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.scope-line-chapter {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2f5d3a;
}

.scope-line-main {
    font-weight: 700;
    color: #1e3c2a;
    font-size: 0.95rem;
}

.scope-line-main.long {
    font-size: 0.8125rem;
}

.scope-line-sub {
    font-size: 0.8125rem;
    color: #6c757d;
}

.scope-count-badge {
    flex-shrink: 0;
    align-self: center;
    background: #e8f5e9;
    color: #1e3c2a;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.quiz-scope-picker-caret {
    flex-shrink: 0;
    align-self: center;
    color: #6c757d;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.quiz-scope-picker.open:not(.opens-up) .quiz-scope-picker-caret {
    transform: rotate(180deg);
}

.quiz-scope-picker.open.opens-up .quiz-scope-picker-caret {
    transform: rotate(0deg);
}

body.scope-picker-body-lock {
    overflow: hidden;
}

.scope-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    background: rgba(10, 18, 14, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.scope-sheet-dialog {
    width: min(580px, 100%);
    max-height: min(680px, 88vh);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scopeSheetIn 0.2s ease-out;
}

@keyframes scopeSheetIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.scope-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 10px;
    border-bottom: 1px solid #eef1f3;
    flex-shrink: 0;
}

.scope-sheet-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    color: #1e3c2a;
}

.scope-sheet-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f1f3f5;
    color: #495057;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scope-sheet-close:hover {
    background: #e9ecef;
    color: #1e3c2a;
}

.scope-sheet-dialog .scope-panel-toolbar {
    border-radius: 0;
    border-bottom: 1px solid #eef1f3;
}

.scope-sheet-scroll {
    flex: 1;
    min-height: 200px;
    max-height: none;
}

@media (max-width: 576px) {
    .scope-sheet-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .scope-sheet-dialog {
        width: 100%;
        max-height: 90vh;
        border-radius: 18px 18px 0 0;
    }
}

.quiz-scope-picker-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 2px solid #dee2e6;
    border-radius: 14px;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.18);
    -webkit-overflow-scrolling: touch;
}

.quiz-scope-picker-panel--floating {
    position: fixed;
    z-index: 10050;
    max-height: min(520px, 72vh);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
    border-color: #cfd8dc;
}

.quiz-scope-picker-panel--floating.opens-up {
    animation: scopePanelSlideUp 0.18s ease-out;
}

.quiz-scope-picker-panel--floating.opens-down {
    animation: scopePanelSlideDown 0.18s ease-out;
}

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

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

.scope-panel-toolbar {
    flex-shrink: 0;
    padding: 10px 10px 8px;
    border-bottom: 1px solid #eef1f3;
    background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
    border-radius: 12px 12px 0 0;
}

.scope-panel-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #d7dee5;
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.scope-panel-search:focus-within {
    border-color: #2f5d3a;
    box-shadow: 0 0 0 3px rgba(47, 93, 58, 0.12);
}

.scope-panel-search > i {
    color: #6c757d;
    font-size: 0.85rem;
}

.scope-panel-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 10px 0;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
    color: #1e3c2a;
}

.scope-panel-search-input::placeholder {
    color: #9aa3ab;
}

.scope-panel-search-clear {
    border: none;
    background: #eef1f3;
    color: #6c757d;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.scope-panel-search-clear:hover {
    background: #dee2e6;
    color: #343a40;
}

.scope-panel-stats {
    font-size: 0.74rem;
    color: #6c757d;
    margin-top: 7px;
    padding-left: 2px;
    font-weight: 600;
}

.scope-panel-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px;
    flex: 1;
    min-height: 160px;
    max-height: none;
    -webkit-overflow-scrolling: touch;
}

.scope-panel-presets {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef1f3;
}

.scope-option-preset-row {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
}

.scope-preset-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e8f5e9 0%, #d4edda 100%);
    color: #1e3c2a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.scope-preset-icon.muted {
    background: linear-gradient(135deg, #f1f3f5 0%, #e9ecef 100%);
    color: #495057;
}

.scope-preset-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.scope-panel-empty {
    text-align: center;
    color: #6c757d;
    padding: 18px 12px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.scope-option {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
    font: inherit;
    color: inherit;
}

.scope-option:hover {
    background: #f1f3f5;
}

.scope-option.selected {
    background: linear-gradient(90deg, #e8f5e9 0%, #f3fbf5 100%);
    border-left-color: #2f5d3a;
}

.scope-option.selected .scope-option-count {
    color: #1e3c2a;
}

.scope-option-preset .scope-line-main {
    font-size: 0.9rem;
}

.scope-chapter-group {
    margin-top: 6px;
}

.scope-chapter-group:first-of-type {
    margin-top: 4px;
}

.scope-chapter-heading {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 0 0 4px;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.scope-chapter-group--0 .scope-chapter-heading {
    background: linear-gradient(135deg, #1e3c2a 0%, #2f5d3a 100%);
}

.scope-chapter-group--1 .scope-chapter-heading {
    background: linear-gradient(135deg, #2c4a7c 0%, #3d6ba8 100%);
}

.scope-chapter-group--2 .scope-chapter-heading {
    background: linear-gradient(135deg, #5c4033 0%, #8b6914 100%);
}

.scope-chapter-group--3 .scope-chapter-heading {
    background: linear-gradient(135deg, #4a3728 0%, #6b5344 100%);
}

.scope-option-sub {
    font-size: 0.8125rem;
    color: #343a40;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.scope-option-sub.long {
    font-size: 0.75rem;
    color: #495057;
}

.scope-option-count {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 600;
}

.quiz-modal-dialog .quiz-scope-picker-panel {
    max-height: min(420px, 58vh);
}

.quiz-scope-field {
    position: relative;
    z-index: 1;
}

.quiz-scope-field:focus-within,
.quiz-scope-picker.open {
    z-index: 120;
}

@media (max-width: 768px) {
    .quiz-scope-picker-trigger {
        padding: 12px 14px;
    }

    .scope-line-main {
        font-size: 0.9rem;
    }

    .scope-line-main.long {
        font-size: 0.78rem;
    }

    .quiz-scope-picker-panel--floating {
        max-height: min(480px, 78vh);
        border-radius: 16px 16px 0 0;
    }

    .quiz-intro .lead {
        font-size: 1rem;
        line-height: 1.5;
    }

    .quiz-scope-banner {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .quiz-header--intro {
        padding-top: 3.25rem;
    }

    .quiz-header--exam-active {
        padding: 12px 10px 16px;
        gap: 12px;
    }

    .quiz-header--exam-active h1 {
        font-size: 1.25rem;
    }

    .quiz-header-toolbar .btn-back-header {
        padding: 8px 10px;
        font-size: 0.82rem;
        min-height: 44px;
    }

    .quiz-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .quiz-modal-dialog {
        max-width: 100%;
        width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 20px 16px max(20px, env(safe-area-inset-bottom));
        max-height: min(92vh, 640px);
        overflow-y: auto;
    }

    .quiz-logged-bar {
        flex-direction: column;
        align-items: stretch !important;
        text-align: center;
    }

    .quiz-logged-user {
        justify-content: center;
    }

    .quiz-logged-actions {
        justify-content: center;
        width: 100%;
    }

    .quiz-logged-link {
        flex: 1 1 auto;
        justify-content: center;
        min-height: 44px;
    }
}

@media (max-width: 575.98px) {
    .scope-line-chapter {
        font-size: 0.68rem;
    }

    .scope-line-main {
        font-size: 0.875rem;
    }

    .scope-line-main.long {
        font-size: 0.75rem;
    }

    .scope-option-sub {
        font-size: 0.78rem;
    }

    .scope-option-sub.long {
        font-size: 0.7rem;
    }

    .scope-chapter-heading {
        font-size: 0.64rem;
        padding: 7px 10px;
    }

    .quiz-header--intro {
        padding: 3rem 12px 16px;
        text-align: center;
    }

    .btn-back-header .btn-back-label {
        display: none;
    }

    .btn-back-header {
        min-width: 44px;
        min-height: 44px;
        padding: 10px 12px;
        justify-content: center;
    }

    .btn-start {
        width: 100%;
        min-height: 48px;
    }

    .quiz-scope-banner {
        font-size: 0.875rem;
        padding: 10px 12px;
    }
}
