/* ============================================
   CERT QUIZ PRO - Frontend Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display&display=swap');

/* CSS Variables */
.cqp-quiz-wrap {
    --cqp-bg: #FAFBFC;
    --cqp-card: #FFFFFF;
    --cqp-border: #E2E8F0;
    --cqp-text: #1A202C;
    --cqp-text-dim: #64748B;
    --cqp-text-muted: #94A3B8;
    --cqp-primary: #0D9488;
    --cqp-primary-light: #CCFBF1;
    --cqp-primary-dark: #0F766E;
    --cqp-correct: #16A34A;
    --cqp-correct-bg: #F0FDF4;
    --cqp-correct-border: #86EFAC;
    --cqp-wrong: #DC2626;
    --cqp-wrong-bg: #FEF2F2;
    --cqp-wrong-border: #FCA5A5;
    --cqp-radius: 12px;
    --cqp-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --cqp-font-display: 'DM Serif Display', Georgia, serif;
    --cqp-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --cqp-shadow-lg: 0 10px 30px rgba(0,0,0,0.08);

    font-family: var(--cqp-font);
    color: var(--cqp-text);
    line-height: 1.6;
    max-width: 860px;
    margin: 32px auto;
    -webkit-font-smoothing: antialiased;
}

.cqp-quiz-wrap *,
.cqp-quiz-wrap *::before,
.cqp-quiz-wrap *::after {
    box-sizing: border-box;
}

/* ─── Loading ─── */
.cqp-loading {
    text-align: center;
    padding: 60px 24px;
    color: var(--cqp-text-muted);
    font-size: 15px;
}

/* ─── Start Screen ─── */
.cqp-start {
    background: var(--cqp-card);
    border: 1px solid var(--cqp-border);
    border-radius: var(--cqp-radius);
    padding: 48px 40px;
    text-align: center;
    box-shadow: var(--cqp-shadow);
}

.cqp-start-badge {
    display: inline-block;
    background: var(--cqp-primary-light);
    color: var(--cqp-primary-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 5px 16px;
    border-radius: 100px;
    margin-bottom: 20px;
}

.cqp-start h2 {
    font-family: var(--cqp-font-display);
    font-size: 28px;
    font-weight: 400;
    margin: 0 0 8px;
    color: var(--cqp-text);
}

.cqp-start-desc {
    color: var(--cqp-text-dim);
    font-size: 15px;
    margin-bottom: 28px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.cqp-start-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.cqp-start-stat {
    text-align: center;
}

.cqp-start-stat-val {
    font-family: var(--cqp-font-display);
    font-size: 26px;
    color: var(--cqp-primary);
    display: block;
}

.cqp-start-stat-label {
    font-size: 11px;
    color: var(--cqp-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.cqp-btn-start {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--cqp-primary);
    color: #fff;
    border: none;
    padding: 16px 40px;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--cqp-font);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(13,148,136,0.3);
}

.cqp-btn-start:hover {
    background: var(--cqp-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13,148,136,0.35);
}

.cqp-btn-start svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ─── Quiz Header (sticky) ─── */
.cqp-header {
    background: var(--cqp-card);
    border: 1px solid var(--cqp-border);
    border-radius: var(--cqp-radius);
    padding: 16px 24px;
    margin-bottom: 16px;
    box-shadow: var(--cqp-shadow);
    position: sticky;
    top: 32px;
    z-index: 50;
}

.cqp-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cqp-exam-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--cqp-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cqp-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cqp-text);
}

.cqp-timer svg {
    width: 16px;
    height: 16px;
    stroke: var(--cqp-text-dim);
}

.cqp-timer.cqp-timer-warn {
    color: var(--cqp-wrong);
}

.cqp-timer.cqp-timer-warn svg {
    stroke: var(--cqp-wrong);
}

/* Question Nav Dots */
.cqp-nav-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cqp-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid var(--cqp-border);
    background: var(--cqp-card);
    color: var(--cqp-text-dim);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--cqp-font);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.cqp-dot:hover {
    border-color: var(--cqp-primary);
    color: var(--cqp-primary);
}

.cqp-dot.cqp-dot-active {
    background: var(--cqp-primary);
    border-color: var(--cqp-primary);
    color: #fff;
}

.cqp-dot.cqp-dot-correct {
    background: var(--cqp-correct);
    border-color: var(--cqp-correct);
    color: #fff;
}

.cqp-dot.cqp-dot-wrong {
    background: var(--cqp-wrong);
    border-color: var(--cqp-wrong);
    color: #fff;
}

.cqp-dot.cqp-dot-answered {
    background: var(--cqp-primary-light);
    border-color: var(--cqp-primary);
    color: var(--cqp-primary-dark);
}

/* Score Bar */
.cqp-score-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--cqp-border);
    font-size: 13px;
    font-weight: 600;
}

.cqp-score-correct {
    color: var(--cqp-correct);
    display: flex;
    align-items: center;
    gap: 5px;
}

.cqp-score-wrong {
    color: var(--cqp-wrong);
    display: flex;
    align-items: center;
    gap: 5px;
}

.cqp-score-remaining {
    color: var(--cqp-text-muted);
    margin-left: auto;
}

.cqp-score-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.cqp-score-dot-g { background: var(--cqp-correct); }
.cqp-score-dot-r { background: var(--cqp-wrong); }

/* ─── Question Card ─── */
.cqp-question-card {
    background: var(--cqp-card);
    border: 1px solid var(--cqp-border);
    border-radius: var(--cqp-radius);
    padding: 36px 32px;
    box-shadow: var(--cqp-shadow);
    animation: cqpFadeIn 0.25s ease;
}

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

.cqp-q-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--cqp-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.cqp-q-text {
    font-family: var(--cqp-font-display);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.45;
    margin-bottom: 28px;
    color: var(--cqp-text);
}

/* Answer Options */
.cqp-options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cqp-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border: 2px solid var(--cqp-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.cqp-option:hover {
    border-color: var(--cqp-primary);
    background: rgba(13,148,136,0.03);
}

.cqp-option-letter {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #F1F5F9;
    color: var(--cqp-text-dim);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.cqp-option:hover .cqp-option-letter {
    background: var(--cqp-primary-light);
    color: var(--cqp-primary-dark);
}

.cqp-option-text {
    font-size: 15px;
    line-height: 1.5;
    padding-top: 4px;
    flex: 1;
}

/* Selected / Correct / Wrong states */
.cqp-option.cqp-option-correct {
    border-color: var(--cqp-correct-border);
    background: var(--cqp-correct-bg);
    cursor: default;
}

.cqp-option.cqp-option-correct .cqp-option-letter {
    background: var(--cqp-correct);
    color: #fff;
}

.cqp-option.cqp-option-wrong {
    border-color: var(--cqp-wrong-border);
    background: var(--cqp-wrong-bg);
    cursor: default;
}

.cqp-option.cqp-option-wrong .cqp-option-letter {
    background: var(--cqp-wrong);
    color: #fff;
}

.cqp-option.cqp-option-disabled {
    cursor: default;
    opacity: 0.5;
}

.cqp-option.cqp-option-disabled:hover {
    border-color: var(--cqp-border);
    background: transparent;
}

.cqp-option.cqp-option-disabled:hover .cqp-option-letter {
    background: #F1F5F9;
    color: var(--cqp-text-dim);
}

/* Result icon in option */
.cqp-option-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-left: auto;
    padding-top: 4px;
}

/* ─── Explanation Block ─── */
.cqp-explanation {
    margin-top: 20px;
    padding: 20px 22px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    animation: cqpSlideDown 0.3s ease;
}

@keyframes cqpSlideDown {
    from { opacity: 0; max-height: 0; transform: translateY(-8px); }
    to { opacity: 1; max-height: 500px; transform: translateY(0); }
}

.cqp-explanation.cqp-explanation-correct {
    background: var(--cqp-correct-bg);
    border: 1px solid var(--cqp-correct-border);
    color: #166534;
}

.cqp-explanation.cqp-explanation-wrong {
    background: var(--cqp-wrong-bg);
    border: 1px solid var(--cqp-wrong-border);
    color: #991B1B;
}

.cqp-explanation-label {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cqp-explanation-correct .cqp-explanation-label { color: var(--cqp-correct); }
.cqp-explanation-wrong .cqp-explanation-label { color: var(--cqp-wrong); }

/* ─── Navigation Buttons ─── */
.cqp-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.cqp-btn {
    font-family: var(--cqp-font);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cqp-btn-prev {
    background: #F1F5F9;
    color: var(--cqp-text-dim);
}
.cqp-btn-prev:hover { background: #E2E8F0; color: var(--cqp-text); }

.cqp-btn-next {
    background: var(--cqp-primary);
    color: #fff;
}
.cqp-btn-next:hover { background: var(--cqp-primary-dark); }

.cqp-btn-finish {
    background: linear-gradient(135deg, var(--cqp-primary), #0E7490);
    color: #fff;
    padding: 14px 32px;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(13,148,136,0.3);
}
.cqp-btn-finish:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13,148,136,0.35);
}

.cqp-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ─── Results Screen ─── */
.cqp-results {
    background: var(--cqp-card);
    border: 1px solid var(--cqp-border);
    border-radius: var(--cqp-radius);
    box-shadow: var(--cqp-shadow-lg);
    overflow: hidden;
    animation: cqpFadeIn 0.4s ease;
}

.cqp-results-hero {
    padding: 48px 40px;
    text-align: center;
}

.cqp-results-hero.cqp-results-pass {
    background: linear-gradient(135deg, #065F46, #0D9488);
}

.cqp-results-hero.cqp-results-fail {
    background: linear-gradient(135deg, #991B1B, #DC2626);
}

.cqp-results-badge {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.cqp-results-pass .cqp-results-badge {
    background: rgba(255,255,255,0.15);
    color: #A7F3D0;
}

.cqp-results-fail .cqp-results-badge {
    background: rgba(255,255,255,0.15);
    color: #FCA5A5;
}

.cqp-results-score {
    font-family: var(--cqp-font-display);
    font-size: 72px;
    color: #fff;
    margin: 0;
    line-height: 1;
}

.cqp-results-score-label {
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    margin-top: 8px;
}

.cqp-results-body {
    padding: 32px 40px;
}

.cqp-results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px;
    background: var(--cqp-border);
    border: 1px solid var(--cqp-border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 28px;
}

.cqp-results-stat {
    background: var(--cqp-card);
    padding: 20px;
    text-align: center;
}

.cqp-results-stat-val {
    font-family: var(--cqp-font-display);
    font-size: 28px;
    color: var(--cqp-text);
}

.cqp-results-stat-label {
    font-size: 11px;
    color: var(--cqp-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.cqp-results-stat-val.cqp-color-green { color: var(--cqp-correct); }
.cqp-results-stat-val.cqp-color-red { color: var(--cqp-wrong); }

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

.cqp-btn-retry {
    background: var(--cqp-primary);
    color: #fff;
    padding: 14px 32px;
    font-size: 15px;
}
.cqp-btn-retry:hover { background: var(--cqp-primary-dark); }

.cqp-btn-review {
    background: #F1F5F9;
    color: var(--cqp-text);
    padding: 14px 32px;
    font-size: 15px;
}
.cqp-btn-review:hover { background: #E2E8F0; }

/* ─── Progress Bar ─── */
.cqp-progress-wrap {
    margin-top: 12px;
    height: 4px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
}

.cqp-progress-fill {
    height: 100%;
    background: var(--cqp-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .cqp-start { padding: 32px 20px; }
    .cqp-start h2 { font-size: 22px; }
    .cqp-question-card { padding: 24px 18px; }
    .cqp-q-text { font-size: 18px; }
    .cqp-header { padding: 12px 16px; position: static; }
    .cqp-dot { width: 28px; height: 28px; font-size: 11px; border-radius: 6px; }
    .cqp-results-hero { padding: 32px 20px; }
    .cqp-results-score { font-size: 56px; }
    .cqp-results-body { padding: 24px 20px; }
    .cqp-option { padding: 12px 14px; }
}

/* ─── SEO Fallback Content ───
   Visible to Google crawlers for indexing.
   Hidden once JavaScript loads the interactive quiz.
─── */
.cqp-seo-content {
    font-family: var(--cqp-font);
    color: var(--cqp-text);
    max-width: 860px;
    margin: 0 auto;
}

.cqp-seo-title {
    font-family: var(--cqp-font-display);
    font-size: 26px;
    margin: 0 0 8px;
}

.cqp-seo-desc {
    color: var(--cqp-text-dim);
    font-size: 15px;
    margin-bottom: 6px;
}

.cqp-seo-meta {
    color: var(--cqp-text-muted);
    font-size: 13px;
    margin-bottom: 28px;
    font-weight: 600;
}

.cqp-seo-question {
    background: var(--cqp-card);
    border: 1px solid var(--cqp-border);
    border-radius: var(--cqp-radius);
    padding: 24px 28px;
    margin-bottom: 14px;
}

.cqp-seo-question h3 {
    font-family: var(--cqp-font);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 12px;
    color: var(--cqp-text);
}

.cqp-seo-options {
    padding-left: 24px;
    margin: 0 0 14px;
    color: var(--cqp-text);
    font-size: 15px;
    line-height: 1.8;
}

.cqp-seo-options li {
    padding: 2px 0;
}

.cqp-seo-answer {
    background: var(--cqp-correct-bg);
    border: 1px solid var(--cqp-correct-border);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.65;
    color: #166534;
}

.cqp-seo-answer strong {
    color: var(--cqp-correct);
}
