/* ========== GLOBAL STYLES ========== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== HEADER ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111;
    padding: 16px 24px;
    border-bottom: 2px solid #222;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .left strong {
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    background: linear-gradient(135deg, #00aaff, #007bff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header .right {
    display: flex;
    gap: 8px;
}

.header .lang-btn {
    background: #1f1f1f;
    color: #fff;
    border: 1px solid #333;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.header .lang-btn:hover {
    background: #007bff;
    border-color: #007bff;
}

/* MOBILE MENU */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: #1f1f1f;
    border-radius: 8px;
    cursor: pointer;
}

.menu-toggle span {
    width: 22px;
    height: 2px;
    background: #fff;
    margin: 3px 0;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .header .right {
        display: none;
    }

    .header .right.show {
        display: flex;
        flex-direction: column;
        width: 100%;
        background: #111;
        padding: 12px 0;
        border-top: 1px solid #222;
    }
}

/* ========== MAIN CONTAINER ========== */
.exam-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 20px;
    margin: 0 auto;
}

/* ========== QUESTION ========== */
.question-side {
    flex: 1 1 200px;
}

#topModal {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.question-text {
    font-size: clamp(16px, 2.6vw, 24px);
    margin-bottom: 20px;
    background: rgba(47, 47, 47, 0.9);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.5;
}

/* ========== ANSWERS ========== */
.answers button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 10px 0;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(47, 47, 47, 0.85);
    color: #fff;
    font-size: clamp(14px, 2.3vw, 18px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.answers button:hover:not(:disabled) {
    background: rgba(70, 70, 70, 0.95);
    transform: translateX(4px);
}

.answers button .badge {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    min-width: 45px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.answers button.correct {
    background: linear-gradient(135deg, #18e622, #14b81d) !important;
    border-color: #18e622;
}

.answers button.wrong {
    background: linear-gradient(135deg, #fa0019, #c00014) !important;
    border-color: #fa0019;
}

/* ========== PHOTO SIDE ========== */
.photo-side {
    flex: 1 1 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.photo-side img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ========== NAVIGATION ========== */
.nav-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: start;
    padding: 20px 0;
}

.nav-bar button {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(47, 47, 47, 0.85);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-bar button:hover {
    background: #007bff;
    transform: scale(1.05);
}

.nav-bar button.active {
    border: 2px solid #007bff;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

.nav-bar button.success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.nav-bar button.danger {
    background: linear-gradient(135deg, #dc3545, #a71d2a);
}

/* ========== FINISH BUTTON ========== */
.finish-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 600;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    float: right;
}

.finish-btn:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    transform: translateY(-2px);
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #252525;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 26px;
    color: #00aaff;
}

.modal-content p {
    font-size: 18px;
    line-height: 1.6;
}

.modal-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.modal-actions button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}
progress-counter {
    position: sticky;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 999;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    padding: 10px 20px;
    background: rgba(10, 10, 10, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

/* Asosiy son bloki: "0 / 1200" */
.progress-fraction {
    display: flex;
    align-items: baseline;
    gap: 3px;
    background: rgba(0, 170, 255, 0.08);
    border: 1px solid rgba(0, 170, 255, 0.18);
    border-radius: 8px;
    padding: 5px 14px;
}

#current-number {
    font-size: 20px;
    font-weight: 800;
    color: #00aaff;
    letter-spacing: -0.5px;
    line-height: 1;
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.separator {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 300;
    margin: 0 1px;
}

#total-number {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Divider */
.counter-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1px;
    margin: 0 4px;
}

/* Stat bloklar: To'g'ri / Xato */
.stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.stat-label.correct-stat {
    background: rgba(40, 167, 69, 0.08);
    border-color: rgba(40, 167, 69, 0.18);
}

.stat-label.wrong-stat {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.18);
}

.stat-label .stat-icon {
    font-size: 12px;
    opacity: 0.8;
}

#correct-count {
    color: #28a745;
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 20px;
    text-align: right;
}

#wrong-count {
    color: #dc3545;
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    min-width: 20px;
    text-align: right;
}

/* Progress bar (pastda ingichka chiziq) */
.progress-counter::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, #28a745, #00aaff);
    transition: width 0.4s ease;
    border-radius: 0 2px 2px 0;
}

/* Mobile */
@media (max-width: 600px) {
    .progress-counter {
        gap: 4px;
        padding: 8px 12px;
    }

    .progress-fraction {
        padding: 4px 10px;
    }

    #current-number {
        font-size: 17px;
    }

    .stat-label {
        padding: 4px 8px;
        font-size: 12px;
        gap: 4px;
    }

    #correct-count,
    #wrong-count {
        font-size: 14px;
    }

    .counter-divider {
        margin: 0 2px;
    }
}

@media (max-width: 380px) {
    .stat-label .stat-text {
        display: none; /* Faqat ikonka va son qolsin */
    }

    .stat-label {
        padding: 4px 8px;
    }
}

#retryBtn {
    background: #007bff;
    color: #fff;
}

#retryBtn:hover {
    background: #0056b3;
}

#homeBtn {
    background: #28a745;
    color: #fff;
}

#homeBtn:hover {
    background: #1e7e34;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 992px) {
    .exam-container {
        flex-direction: column;
    }

    .question-text {
        font-size: 22px;
    }

    .answers button {
        font-size: 20px;
        padding: 18px;
    }

    .photo-side img {
        max-height: 350px;
    }

    .nav-bar button {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

/* ====== MOBILE OPTIMIZATION ====== */
@media (max-width: 768px) {
    .exam-container {
        padding: 10px;
    }

    .question-text {
        font-size: 17px;
        padding: 14px 16px;
        line-height: 1.4;
    }

    .answers button {
        font-size: 15px;
        padding: 12px 14px;
        margin: 8px 0;
        border-radius: 8px;
    }

    .answers button .badge {
        padding: 5px 10px;
        font-size: 13px;
        min-width: 38px;
    }

    .photo-side img {
        max-height: 260px;
    }

    .nav-bar {
        gap: 6px;
        justify-content: center;
    }

    .nav-bar button {
        width: 42px;
        height: 42px;
        font-size: 14px;
        border-radius: 6px;
    }

    .finish-btn {
        font-size: 16px;
        padding: 12px 20px;
        width: auto;
        min-width: 150px;
        align-self: center;
    }

    #timer {
        width: 100px;
        margin: 10px;
        text-align: center;
        font-weight: bold;
        font-size: 14px;
        padding: 8px 14px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .question-text {
        font-size: 15px;
        padding: 12px;
    }

    .answers button {
        font-size: 14px;
        padding: 10px 12px;
    }

    .answers button .badge {
        font-size: 12px;
        padding: 4px 8px;
        min-width: 35px;
    }

    .photo-side img {
        max-height: 220px;
    }

    .nav-bar button {
        width: 38px;
        height: 38px;
        font-size: 13px;
    }

    .finish-btn {
        font-size: 15px;
        padding: 10px 16px;
        border-radius: 8px;
    }

    #timer {
        width: 100px;
        margin: 10px;
        text-align: center;
        font-weight: bold;
        font-size: 13px;
        padding: 6px 12px;
        border-radius: 6px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin-bottom: 10px;
    }
}


/* ========== TOUCH OPTIMIZATION ========== */
@media (hover: none) and (pointer: coarse) {

    .answers button,
    .nav-bar button,
    .finish-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* ===== Fix bottom controls alignment ===== */
@media (min-width: 992px) {
    .bottom-controls .nav-bar button {
        flex-shrink: 0;
        /* siqilmasin */
        scroll-snap-align: center;
        width: 38px !important;
        height: 38px !important;
        min-width: 38px;
        padding: 0;
        font-size: 12px;
        font-weight: 600;
        border-radius: 7px;
        cursor: pointer;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(47, 47, 47, 0.85);
        color: #ccc;
        transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;

        /* style.css dan kelgan transform override */
        transform: none;
    }

    .bottom-controls .nav-bar button:hover {
        background: rgba(0, 123, 255, 0.3);
        border-color: rgba(0, 123, 255, 0.5);
        color: #fff;
        transform: scale(1.08);
    }

    .bottom-controls .nav-bar button.active {
        border: 2px solid #00aaff !important;
        background: rgba(0, 170, 255, 0.2) !important;
        color: #00aaff !important;
        font-weight: 700;
        box-shadow: 0 0 8px rgba(0, 170, 255, 0.35);
    }

    .bottom-controls .nav-bar button.success {
        background: linear-gradient(135deg, #28a745, #1e7e34) !important;
        border-color: #28a745 !important;
        color: #fff !important;
    }

    .bottom-controls .nav-bar button.danger {
        background: linear-gradient(135deg, #dc3545, #a71d2a) !important;
        border-color: #dc3545 !important;
        color: #fff !important;
    }


    .nav-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
        flex: 1;
    }

    .right-controls {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        min-width: 200px;
    }

    #timer {
        width: 100px;
        margin: 10px;
        text-align: center;
        font-weight: bold;
        font-size: 15px;
        font-weight: 700;
        padding: 8px 16px;
        border: 2px solid rgba(255, 255, 255, 0.25);
        border-radius: 8px;
        background: rgba(47, 47, 47, 0.9);
        color: #fff;
    }

    .finish-btn {
        padding: 10px 22px;
        font-size: 15px;
        border-radius: 8px;
        background: linear-gradient(135deg, #007bff, #0056b3);
        color: #fff;
        font-weight: 600;
        cursor: pointer;
        border: none;
        transition: all 0.2s ease;
    }

    .finish-btn:hover {
        background: linear-gradient(135deg, #0056b3, #003d82);
        transform: translateY(-2px);
    }

    body {
        padding-bottom: 110px !important;
    }
}

/* ===== FAIL MODAL STYLING ===== */
.fail-modal {
    background: linear-gradient(135deg, #2a0000, #330000);
    border: 1px solid rgba(255, 0, 0, 0.3);
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.2);
    color: #fff;
    padding: 40px 30px;
    border-radius: 16px;
    text-align: center;
    width: 90%;
    max-width: 420px;
    animation: fadeInScale 0.4s ease;
}

.fail-modal h2 {
    font-size: 24px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #ff4d4d, #ff2222);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.fail-modal .modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.fail-modal .modal-actions button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s ease;
}

#retryFailBtn {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

#retryFailBtn:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    transform: translateY(-2px);
}

#homeFailBtn {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

#homeFailBtn:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
    transform: translateY(-2px);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   LESSONS PAGE — AVTOBILIM.UZ REFINED THEME
   ============================================ */

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.page-title {
    text-align: center;
    font-size: clamp(24px, 4vw, 34px);
    margin-bottom: 45px;
    font-weight: 700;
    color: #00aaff;
    letter-spacing: 0.5px;
    text-shadow: 0 0 15px rgba(0, 170, 255, 0.3);
}

/* ===== GRID ===== */
.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    /* 2 ta per row */
    gap: 28px;
}

/* ===== CARD ===== */
.lesson-card {
    background: linear-gradient(180deg, #1b1b1b 0%, #212121 100%);
    border: 1px solid rgba(0, 170, 255, 0.15);
    border-radius: 16px;
    padding: 22px 24px;
    color: #eaeaea;
    text-decoration: none;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.lesson-card:hover {
    background: linear-gradient(180deg, #232323 0%, #2a2a2a 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(0, 170, 255, 0.25);
}

/* ===== TITLE ===== */
.lesson-title {
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 600;
    margin-bottom: 12px;
    color: #fff;
    line-height: 1.5;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

/* ===== INFO ===== */
.lesson-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lesson-info span {
    font-size: clamp(13px, 2vw, 15px);
    color: #aaa;
}

/* ===== BUTTON ===== */
.start-btn {
    background: transparent;
    border: 1.5px solid #00ff99;
    color: #00ff99;
    font-size: clamp(13px, 2vw, 16px);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 6px rgba(0, 255, 153, 0.2);
}

.start-btn:hover {
    background: #00ff99;
    color: #000;
    box-shadow: 0 0 12px rgba(0, 255, 153, 0.4);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 992px) {
    .container {
        padding: 24px 16px;
    }

    .lesson-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        /* planshetda 2 ta */
        gap: 22px;
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .lesson-grid {
        grid-template-columns: 1fr;
        /* telefonda 1 ta */
        gap: 18px;
    }
}

.lesson-card {
    padding: 20px 18px;
    min-height: 120px;
    border-radius: 12px;
}

.lesson-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.lesson-info span {
    font-size: 14px;
}

.start-btn {
    width: 100%;
    text-align: center;
    font-size: 15px;
}
}

@media (max-width: 480px) {
    .lesson-card {
        padding: 16px;
    }

    .lesson-title {
        font-size: 16px;
    }

    .start-btn {
        font-size: 14px;
        padding: 10px;
    }
}
