/* Testlar — «Yumshoq oq» kit */

/* ---------- Test kartasi ---------- */
.test-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: var(--sh-card);
    overflow: hidden;
    transition: transform .3s var(--ease-out),
                box-shadow .3s var(--ease-out),
                border-color .3s var(--ease-out);
}

/* Yuqorida yashil chiziq: hover'da chapdan o'ngga yoyiladi */
.test-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--green-btn), var(--green));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .4s var(--ease-out);
}

.test-card:hover,
.test-card:focus-within {
    transform: translateY(-6px);
    border-color: transparent;
    box-shadow: var(--sh-card-hover);
}

.test-card:hover::before,
.test-card:focus-within::before {
    transform: scaleX(1);
}

.test-card__icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: var(--r-icon);
    background: var(--blue-tint);
    color: var(--blue-ink);
    margin-bottom: 4px;
    transition: background .3s var(--ease-out), color .3s var(--ease-out);
}

.test-card:hover .test-card__icon {
    background: var(--green-tint);
    color: var(--green-btn);
}

.test-card__icon .ico {
    width: 20px;
    height: 20px;
}

.test-card__topic {
    display: inline-flex;
    padding: 5px 11px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    font: 600 11px/1.2 var(--font-kit);
    color: var(--ink-2);
}

.test-card__title {
    font: 700 18px/1.3 var(--font-kit);
    color: var(--ink);
    text-wrap: pretty;
    transition: color .3s var(--ease-out);
}

.test-card:hover .test-card__title {
    color: var(--green-btn);
}

/* Tugma kartaning pastida tekislanadi: kartalar bir xil ko'rinadi */
.test-card .btn {
    margin-top: auto;
}

@media (prefers-reduced-motion: reduce) {
    .test-card,
    .test-card::before,
    .test-card__icon,
    .test-card__title {
        transition: none;
    }

    .test-card:hover {
        transform: none;
    }
}

.test-card__desc {
    font: 400 13px/1.65 var(--font-kit);
    color: var(--body);
    text-wrap: pretty;
}

.test-card .text-sm {
    font: 500 12px/1 var(--font-kit);
    color: var(--muted);
}

.test-card .btn {
    margin-top: 6px;
}

/* ---------- Test ishlash ---------- */
.test-form {
    padding-bottom: 32px;
}

.test-form__name {
    max-width: 420px;
    margin-bottom: 28px;
}

.test-questions {
    list-style: none;
    counter-reset: tq;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.test-question {
    counter-increment: tq;
    padding: 22px 24px;
    border: 1px solid transparent;
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: var(--sh-soft);
    scroll-margin-top: calc(var(--header-height) + var(--float-top) + 24px);
    transition: border-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}

/* Savol raqami: kitdagi step raqami kabi kvadrat */
.test-question__text {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font: 700 15px/1.45 var(--font-kit);
    color: var(--ink);
    margin-bottom: 16px;
}

.test-question__text::before {
    content: counter(tq);
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--r-step);
    background: var(--surface-2);
    color: var(--ink-2);
    font: 800 14px/1 var(--font-kit);
    transition: background .18s, color .18s, box-shadow .18s;
}

/* Javob berilgan savolning raqami yashil bo'ladi */
.test-question.is-answered .test-question__text::before {
    background: var(--green-btn);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(14, 125, 68, .28);
}

/* Yuborishda javobsiz qolgan savol: qizil chegara bilan belgilanadi */
.test-question.is-missing {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-tint);
}

.test-question.is-missing .test-question__text::before {
    background: var(--red);
    color: #fff;
}

/* ---------- Javob variantlari: input ko'rinishida ---------- */
.test-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 48px;
}

.test-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-input);
    background: var(--bg);
    cursor: pointer;
    transition: border-color .25s var(--ease-out),
                background .25s var(--ease-out),
                transform .25s var(--ease-out);
}

.test-option:hover {
    border-color: var(--green-btn);
    background: var(--green-tint);
    transform: translateX(3px);
}

.test-option:hover .test-option__letter {
    background: var(--green-btn);
    color: #fff;
}

.test-option:hover .test-option__text {
    color: var(--ink);
}

/* Haqiqiy radio yashiringan, harf doirasi uning o'rnini bosadi */
.test-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.test-option__letter {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--track);
    color: var(--ink-2);
    font: 700 12px/1 var(--font-kit);
    transition: background .18s, color .18s;
}

.test-option__text {
    font: 500 14px/1.45 var(--font-kit);
    color: var(--body);
}

/* Tanlangan variant: yashil — javob berilgani bildiriladi */
.test-option:has(input:checked) {
    border-color: var(--green-btn);
    background: var(--green-tint);
}

.test-option:has(input:checked) .test-option__letter {
    background: var(--green-btn);
    color: #ffffff;
}

.test-option:has(input:checked) .test-option__text {
    color: var(--ink);
}

.test-option:has(input:focus-visible) {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* ---------- Natija ---------- */
.result-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 32px;
    padding: 26px 30px;
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: var(--sh-card);
}

.result-card__score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-card__value {
    font: 800 48px/1.1 var(--font-kit);
    letter-spacing: -.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.result-card__percent {
    font: 600 14px/1 var(--font-kit);
    color: var(--muted);
    margin-top: 4px;
}

.result-card--great .result-card__value { color: var(--green); }
.result-card--low   .result-card__value { color: var(--red-ink); }

.result-card__info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.result-card__bar {
    width: 100%;
    height: 10px;
    border-radius: var(--r-pill);
    background: var(--track);
    overflow: hidden;
}

.result-card__bar span {
    display: block;
    height: 100%;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    transition: width .8s var(--ease-out);
}

.result-card--great .result-card__bar span { background: linear-gradient(90deg, var(--green), #4ecb8a); }
.result-card--low   .result-card__bar span { background: linear-gradient(90deg, var(--red), #FF7C92); }

.result-card__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- Javoblar tahlili ---------- */
.review-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 32px;
}

.review-item {
    padding: 22px 24px;
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: var(--sh-soft);
}

.review-item__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.review-item__mark {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font: 700 12px/1 var(--font-kit);
    color: #ffffff;
}

.review-item.is-right .review-item__mark { background: var(--green); }
.review-item.is-wrong .review-item__mark { background: var(--red); }

.review-item__q {
    font: 700 15px/1.45 var(--font-kit);
    color: var(--ink);
    padding-top: 3px;
}

.review-item__options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 38px;
}

.review-option {
    display: block;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-input);
    background: var(--bg);
    font: 500 13px/1.5 var(--font-kit);
    color: var(--body);
}

.review-option.is-correct {
    border-color: #bfe5cf;
    background: var(--green-tint);
    color: var(--ink);
}

.review-option.is-picked {
    border-color: var(--red-tint-2);
    background: var(--red-tint);
    color: var(--ink);
}

.review-option__tag {
    font: 700 10px/1 var(--font-kit);
    font-style: normal;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-left: 8px;
}

.review-option.is-correct .review-option__tag { color: var(--green); }
.review-option.is-picked  .review-option__tag { color: var(--red-ink); }

@media (max-width: 768px) {
    .result-card {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 16px;
    }

    .result-card__info {
        align-items: center;
    }

    .result-card__actions {
        flex-direction: row;
    }

    .result-card__actions .btn {
        flex: 1;
    }

    .test-options,
    .review-item__options {
        padding-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .test-card,
    .result-card__bar span {
        transition: none;
    }

    .test-card:hover {
        transform: none;
    }
}


/* ---------- Test tuzilmasi: savollar + yon panel ---------- */
.test-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 32px;
    align-items: start;
}

/* Panel sahifa bilan birga suriladi */
.test-map {
    position: sticky;
    top: calc(var(--header-height) + var(--float-top) + 24px);
}

.test-map__card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    background: var(--surface);
    box-shadow: var(--sh-card);
}

.test-map__title {
    font: 700 14px/1.3 var(--font-kit);
    color: var(--ink);
}

/* Savollar xaritasi: raqamli kvadratchalar */
.test-map__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
}

.test-map__item {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: var(--r-step);
    background: var(--surface-2);
    color: var(--ink-2);
    font: 700 12px/1 var(--font-kit);
    text-decoration: none;
    transition: background .25s var(--ease-out),
                color .25s var(--ease-out),
                border-color .25s var(--ease-out),
                transform .2s var(--ease-out);
}

.test-map__item:hover {
    border-color: var(--green-btn);
    color: var(--green-btn);
    transform: translateY(-2px);
}

/* Javob berilgan savol yashil bo'ladi */
.test-map__item.is-done {
    background: var(--green-btn);
    border-color: var(--green-btn);
    color: #fff;
}

.test-map__item.is-done:hover {
    background: var(--green-btn-hover);
    color: #fff;
}

/* Bajarilgan ulush chizig'i */
.test-map__bar {
    height: 6px;
    border-radius: var(--r-pill);
    background: var(--track);
    overflow: hidden;
}

.test-map__bar span {
    display: block;
    height: 100%;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--green-btn), var(--green));
    transition: width .35s var(--ease-out);
}

.test-map__count {
    font: 500 12px/1.4 var(--font-kit);
    color: var(--muted);
}

.test-map__count strong {
    font-weight: 800;
    color: var(--ink);
}

.test-map__hint {
    font: 600 12px/1.4 var(--font-kit);
    color: var(--muted);
    transition: color .25s var(--ease-out);
}

.test-map__hint.is-ready {
    color: var(--green-btn);
}

.test-map__hint.is-error {
    color: var(--red-ink);
}

.test-map__submit {
    width: 100%;
    justify-content: center;
}

/* Javobsiz savol qolgan bo'lsa tugma bosiq ko'rinadi.
   Bosilishi mumkin: bosilganda yetishmagan savolga olib boradi. */
.test-map__submit.is-blocked {
    opacity: .55;
}

@media (max-width: 1000px) {
    .test-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    /* Tor ekranda panel savollardan oldin turadi */
    .test-map {
        position: static;
        order: -1;
    }

    .test-map__grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (max-width: 560px) {
    .test-map__grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .test-option,
    .test-question,
    .test-map__item,
    .test-map__bar span {
        transition: none;
    }

    .test-option:hover,
    .test-map__item:hover {
        transform: none;
    }
}
