/*
 * =========================================================
 *              WEBSITE DEVELOPMENT CREDITS
 * =========================================================
 *
 * Co-Developer
 * AFM_1337_ — Md Arafat Hossen Mugdho
 * GitHub  : https://github.com/AFM-1337
 * Website : https://afm1337.shop
 * WhatsApp: https://wa.me/+8801310329198
 * Telegram: https://t.me/afm1337
 *
 * Co-Developer
 * DARK LMNx9 — Limon Hossain
 * GitHub  : https://github.com/LMNx9-JOHNY
 * Website : https://dark.lmnx9.workers.dev
 * WhatsApp: https://wa.me/+8801882168975
 * Telegram: https://t.me/x_LMNx9
 *
 * ---------------------------------------------------------
 *          Designed & Developed Together
 * =========================================================
 */

/* BeBrainer SSC — Quiz/MCQ Module — ABSOLUTE FINAL FIX */

/* ═══════════ NUCLEAR BUTTON RESET ═══════════ */
/* Quiz পেজের ভিতরে সব button-এর কোনো transform/scale/animation হবে না */

#qzApp .bb-btn,
#qzApp .bx,
#qzApp .bb-btn--primary,
#qzApp .bb-btn--outline,
#qzApp .bx--primary,
#qzApp .bx--outline,
#qzApp .bb-btn--sm,
#qzApp .bx--sm,
#qzResultScreen .bb-btn,
#qzResultScreen .bx,
#qzResultScreen .bb-btn--primary,
#qzResultScreen .bb-btn--outline,
#qzResultScreen .bx--primary,
#qzResultScreen .bx--outline,
#qzResultScreen .bb-btn--sm,
#qzResultScreen .bx--sm,
#qzStartScreen .bb-btn,
#qzStartScreen .bx {
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease !important;
    transform: none !important;
    translate: none !important;
    scale: none !important;
    animation: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.06) !important;
}

#qzApp .bb-btn:hover,
#qzApp .bx:hover,
#qzApp .bb-btn--primary:hover,
#qzApp .bb-btn--outline:hover,
#qzApp .bx--primary:hover,
#qzApp .bx--outline:hover,
#qzApp .bb-btn--sm:hover,
#qzApp .bx--sm:hover,
#qzResultScreen .bb-btn:hover,
#qzResultScreen .bx:hover,
#qzResultScreen .bb-btn--primary:hover,
#qzResultScreen .bb-btn--outline:hover,
#qzResultScreen .bx--primary:hover,
#qzResultScreen .bx--outline:hover,
#qzResultScreen .bb-btn--sm:hover,
#qzResultScreen .bx--sm:hover,
#qzStartScreen .bb-btn:hover,
#qzStartScreen .bx:hover {
    transform: none !important;
    translate: none !important;
    scale: none !important;
    animation: none !important;
}

#qzApp .bb-btn:active,
#qzApp .bx:active,
#qzResultScreen .bb-btn:active,
#qzResultScreen .bx:active,
#qzStartScreen .bb-btn:active,
#qzStartScreen .bx:active {
    transform: scale(0.97) !important;
}

/* ═══════════ OPTION HOVER FIX ═══════════ */
.qz-option {
    transition: border-color 0.15s ease, background 0.15s ease !important;
    transform: none !important;
    translate: none !important;
    scale: none !important;
}
.qz-option:hover {
    border-color: #1A56DB !important;
    transform: none !important;
    translate: none !important;
    scale: none !important;
}

/* ═══════════ MAP BUTTON FIX ═══════════ */
.qz-map-btn {
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease !important;
    transform: none !important;
    translate: none !important;
    scale: none !important;
}
.qz-map-btn:hover {
    transform: none !important;
    translate: none !important;
    scale: none !important;
}

/* ═══════════ QUIZ SET CARDS ═══════════ */
.qz-quiz-grid { display: flex; flex-direction: column; gap: 14px; }
.qz-quiz-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 18px;
    padding: 22px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    position: relative;
    overflow: hidden;
}
.qz-quiz-card::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, #1A56DB, #DB2777);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.qz-quiz-card:hover {
    border-color: rgba(26,86,219,.20);
    box-shadow: 0 12px 32px rgba(26,86,219,.10);
}
.qz-quiz-card:hover::before { opacity: 1; }
.qz-quiz-card__title { font-weight: 800; font-size: 16px; margin-bottom: 6px; color: #111827; }
.qz-quiz-card__desc { color: #9CA3AF; font-size: 13px; margin-bottom: 12px; line-height: 1.6; }
.qz-quiz-card__meta {
    display: flex; flex-wrap: wrap; gap: 12px;
    font-size: 12px; color: #9CA3AF;
    margin-bottom: 14px;
}
.qz-quiz-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.qz-quiz-card__meta i { color: #DB2777; font-size: 11px; }

.qz-diff {
    display: inline-flex; align-items: center; padding: 3px 12px;
    border-radius: 999px; font-size: 11px; font-weight: 700;
}
.qz-diff--easy { background: #ECFDF5; color: #059669; }
.qz-diff--medium { background: #FFFBEB; color: #D97706; }
.qz-diff--hard { background: #FEF2F2; color: #DC143C; }

/* ═══════════ START CARD ═══════════ */
.qz-start-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    padding: 28px;
    max-width: 640px;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}
.qz-start-card h1 { font-size: 22px; font-weight: 800; margin: 10px 0; color: #111827; }
.qz-start-stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    margin: 18px 0;
}
.qz-start-stat {
    text-align: center; padding: 14px 8px;
    background: #F9FAFB; border-radius: 14px;
    border: 1px solid #E5E7EB;
}
.qz-start-stat b { display: block; font-size: 18px; font-weight: 800; color: #1A56DB; }
.qz-start-stat span { font-size: 11px; color: #9CA3AF; }
@media (max-width: 520px) { .qz-start-stats { grid-template-columns: repeat(2, 1fr); } }
.qz-instructions {
    background: #F9FAFB;
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 13px;
    color: #4B5563;
    line-height: 1.7;
    margin-bottom: 18px;
    border: 1px solid #E5E7EB;
}

/* ═══════════ QUIZ APP ═══════════ */
.qz-app { display: none; }
.qz-app.active { display: block; }
.qz-topbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    position: sticky; top: calc(70px + 8px);
    z-index: 5;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.qz-progress-text { font-size: 13px; font-weight: 600; color: #4B5563; }
.qz-progress-bar {
    width: 140px; height: 5px; border-radius: 999px;
    background: #F3F4F6; overflow: hidden; margin-top: 5px;
}
.qz-progress-fill {
    height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, #1A56DB, #DB2777);
    transition: width .3s ease;
}
.qz-timer {
    display: flex; align-items: center; gap: 6px;
    font-weight: 800; font-size: 16px; color: #1A56DB;
    background: #EBF0FA;
    padding: 7px 14px; border-radius: 999px;
}
.qz-timer.qz-timer--danger { color: #DC143C; background: #FEF2F2; }

.qz-layout { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .qz-layout { grid-template-columns: 1fr; } }

/* ═══════════ QUESTION CARD ═══════════ */
.qz-question-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}
.qz-question-text { font-size: 16px; font-weight: 600; line-height: 1.7; margin-bottom: 18px; color: #111827; }
.qz-options { display: flex; flex-direction: column; gap: 10px; }
.qz-option {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #111827;
    background: #fff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.qz-option:hover { border-color: #1A56DB; }
.qz-option:active { background: #F9FAFB; }
.qz-option__mark {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid #D1D5DB;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800; color: transparent;
    transition: all 0.2s ease;
}
.qz-option.selected {
    border-color: #1A56DB;
    background: #EBF0FA;
}
.qz-option.selected .qz-option__mark {
    background: linear-gradient(135deg, #1A56DB, #DB2777);
    border-color: transparent;
    color: #fff;
}
.qz-option.selected .qz-option__mark::after { content: '✓'; }

.qz-nav-buttons { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }

/* ═══════════ QUESTION MAP ═══════════ */
.qz-map-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}
.qz-map-card__title { font-weight: 700; font-size: 13px; margin-bottom: 10px; color: #111827; }
.qz-map-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px;
}
.qz-map-btn {
    width: 100%; aspect-ratio: 1; border-radius: 8px;
    border: 1px solid #E5E7EB;
    background: #F9FAFB;
    font-size: 11px; font-weight: 700; color: #4B5563;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    font-family: inherit;
}
.qz-map-btn:hover { border-color: #1A56DB; }
.qz-map-btn:active { background: #EBF0FA; }
.qz-map-btn.current {
    border-color: #1A56DB;
    box-shadow: 0 0 0 2px rgba(26,86,219,.15);
}
.qz-map-btn.answered {
    background: linear-gradient(135deg, #1A56DB, #DB2777);
    color: #fff;
    border-color: transparent;
}
.qz-map-legend { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: #9CA3AF; }
.qz-map-legend span { display: flex; align-items: center; gap: 6px; }
.qz-map-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.qz-legend-answered { background: linear-gradient(135deg, #1A56DB, #DB2777); }
.qz-legend-unanswered { background: #F9FAFB; border: 1px solid #E5E7EB; }

/* ═══════════ RESULT SCREEN ═══════════ */
.qz-result-hero {
    text-align: center;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 18px;
    padding: 30px 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
}
.qz-result-score {
    font-size: 40px; font-weight: 800;
    background: linear-gradient(135deg, #1A56DB, #DB2777);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}
.qz-result-total { font-size: 14px; color: #9CA3AF; margin-top: 4px; }
.qz-result-status {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 5px 16px;
    border-radius: 999px; font-weight: 700; font-size: 13px;
}
.qz-result-status--pass { background: #ECFDF5; color: #059669; }
.qz-result-status--fail { background: #FEF2F2; color: #DC143C; }
.qz-result-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0;
}
@media (max-width: 520px) { .qz-result-grid { grid-template-columns: repeat(2, 1fr); } }
.qz-result-stat {
    padding: 12px 10px; border-radius: 12px;
    background: #F9FAFB; border: 1px solid #E5E7EB;
}
.qz-result-stat b { display: block; font-size: 18px; font-weight: 800; color: #1A56DB; }
.qz-result-stat span { font-size: 11px; color: #9CA3AF; }
.qz-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.qz-name-form {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
    margin-top: 14px;
}
.qz-name-form input {
    padding: 10px 16px; border-radius: 999px;
    border: 2px solid #E5E7EB; font-family: inherit; font-size: 13px;
    min-width: 200px; outline: none;
    color: #111827;
    background: #fff;
}
.qz-name-form input:focus {
    border-color: #1A56DB;
    box-shadow: 0 0 0 3px rgba(26,86,219,.08);
}

/* ═══════════ ANSWER REVIEW ═══════════ */
.qz-review-item {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 12px;
    border-left: 4px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.qz-review-item.correct { border-left-color: #059669; }
.qz-review-item.incorrect { border-left-color: #DC143C; }
.qz-review-item.unanswered { border-left-color: #9CA3AF; }
.qz-review-q { font-weight: 600; font-size: 14px; margin-bottom: 10px; color: #111827; }
.qz-review-opt {
    padding: 8px 12px; border-radius: 10px;
    font-size: 13px; margin-bottom: 5px;
    border: 1px solid #E5E7EB;
    display: flex; justify-content: space-between; gap: 8px;
    color: #4B5563;
}
.qz-review-opt.is-correct { border-color: #059669; background: #ECFDF5; color: #065F46; }
.qz-review-opt.is-wrong { border-color: #DC143C; background: #FEF2F2; color: #991B1B; }
.qz-review-explain {
    margin-top: 8px; padding: 10px 12px;
    background: #F9FAFB; border-radius: 10px;
    font-size: 12.5px; color: #4B5563; line-height: 1.6;
    border: 1px solid #E5E7EB;
}

/* ═══════════ LEADERBOARD ═══════════ */
.qz-lb-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.qz-lb-tab {
    padding: 7px 16px; border-radius: 999px;
    border: 2px solid #E5E7EB; background: #fff;
    font-size: 12.5px; font-weight: 600; color: #4B5563;
    text-decoration: none; transition: border-color 0.2s, color 0.2s, background 0.2s;
    font-family: inherit;
}
.qz-lb-tab:hover { border-color: #1A56DB; color: #1A56DB; }
.qz-lb-tab.active {
    background: linear-gradient(135deg, #1A56DB, #DB2777);
    color: #fff; border-color: transparent;
    box-shadow: 0 4px 12px rgba(26,86,219,.15);
}
.qz-lb-table {
    width: 100%; border-collapse: collapse;
    background: #fff; border-radius: 14px;
    overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.03);
    border: 1px solid #E5E7EB;
}
.qz-lb-table th, .qz-lb-table td {
    padding: 10px 14px; text-align: left; font-size: 13px;
    border-bottom: 1px solid #F3F4F6;
}
.qz-lb-table th {
    background: #F9FAFB; color: #9CA3AF;
    font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px;
}
.qz-lb-table td { color: #4B5563; }
.qz-lb-rank {
    font-weight: 800;
    background: linear-gradient(135deg, #1A56DB, #DB2777);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.qz-lb-table tr:last-child td { border-bottom: none; }
.qz-lb-table tr:hover td { background: #F9FAFB; }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 480px) {
    .qz-question-card { padding: 16px; }
    .qz-question-text { font-size: 14.5px; }
    .qz-option { padding: 10px 12px; font-size: 13px; }
    .qz-nav-buttons { flex-direction: row; }
    .qz-nav-buttons .bb-btn, .qz-nav-buttons .bx { flex: 1; }
    .qz-topbar { padding: 10px 12px; }
    .qz-timer { font-size: 14px; padding: 6px 10px; }
    .qz-map-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
    .qz-map-btn { font-size: 10px; }
    .qz-start-card { padding: 20px; }
    .qz-result-hero { padding: 24px 16px; }
    .qz-result-score { font-size: 32px; }
}
/* Final layout hardening: quiz controls must size to content, never to a stretched grid row. */
#qzApp .qz-layout,
#qzApp .qz-layout > div,
#qzApp .qz-question-card,
#qzApp .qz-map-card,
#qzApp .qz-nav-buttons,
#qzResultScreen .qz-result-actions {
    min-height: 0 !important;
    height: auto !important;
    align-items: flex-start;
}

#qzApp .qz-nav-buttons {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    margin-top: 20px !important;
}

#qzApp .qz-nav-buttons .bb-btn,
#qzApp .qz-nav-buttons .bx {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 120px !important;
    min-height: 44px !important;
    height: 44px !important;
    max-height: 52px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    align-self: center !important;
    box-sizing: border-box !important;
}

#qzApp #qzNextBtn[style*="display: none"] {
    display: none !important;
}

#qzApp #qzSubmitBtn {
    display: flex !important;
    width: 100% !important;
    min-height: 44px !important;
    height: 44px !important;
    max-height: 52px !important;
    padding: 8px 16px !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
    flex: none !important;
}

#qzApp .qz-map-card {
    align-self: start !important;
}

#qzApp .qz-map-card .qz-map-grid,
#qzApp .qz-map-card .qz-map-legend {
    height: auto !important;
    min-height: 0 !important;
}

@media (max-width: 480px) {
    #qzApp .qz-nav-buttons .bb-btn,
    #qzApp .qz-nav-buttons .bx {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: 100% !important;
        height: 44px !important;
        max-height: 52px !important;
    }
}
