/* ========== 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;
}
#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 {
        position: static;           /* fixed emas — content oqimida qoladi */
        display: flex;
        justify-content: flex-end;
        align-items: flex-start;
        padding: 16px 30px 30px;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* Nav tugmalar alohida scrollable blok */
    .nav-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
        flex: 1;
        max-height: none;           /* cheklov yo'q */
        overflow: visible;
    }

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

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

    .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);
    }

    /* padding-bottom kerak emas chunki fixed emas */
    body {
        padding-bottom: 0 !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;
    }
}
