/* ──────────────────────────────────
   CYBER QUIZ – Frontend Styles
   ────────────────────────────────── */

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

.cq-wrapper {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    color: #202020;
}

.cq-wrapper * {
    font-family: 'Lato', sans-serif !important;
}

/* ── STEP ── */
.cq-step {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    padding: 36px 40px;
    animation: cqFadeIn .35s ease;
}

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

/* ── HEADER ── */
.cq-step-header { margin-bottom: 24px; }

.cq-step-num {
    display: inline-block;
    background: #C2D814;
    color: #202020;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    letter-spacing: .05em;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.cq-step-header h2 {
    font-size: 22px;
    font-weight: 700;
    font-family: 'Lato', sans-serif !important;
    color: #202020;
    margin: 0 0 6px;
}

.cq-subtitle {
    color: #202020;
    font-size: 15px;
    font-weight: 400;
    font-family: 'Lato', sans-serif;
    margin: 0;
}

/* ── PROGRESS BAR ── */
.cq-progress-bar {
    background: #e2e8f0;
    border-radius: 8px;
    height: 6px;
    margin-top: 10px;
    overflow: hidden;
}

.cq-progress-fill {
    background: linear-gradient(90deg, #C2D814, #a8bc0f);
    height: 100%;
    border-radius: 8px;
    transition: width .4s ease;
}

/* ── FORM GRID ── */
.cq-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.cq-field--full { grid-column: 1 / -1; }

.cq-field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: #C2D814;
    margin-bottom: 6px;
}

.cq-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    color: #202020;
    transition: border-color .2s;
    box-sizing: border-box;
    background: #f9fafb;
}

.cq-field input:focus {
    outline: none;
    border-color: #C2D814;
    background: #fff;
}

.cq-field input::placeholder { color: #9ca3af; }

/* ── DOMANDA ── */
.cq-question-text {
    font-family: 'Lato', sans-serif;
    font-size: 18px !important;
    font-weight: 700 !important;
    font-family: 'Lato', sans-serif !important;
    color: #202020 !important;
    line-height: 1.5 !important;
    margin: 0 0 24px !important;
}

/* ── OPZIONI ── */
.cq-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.cq-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    color: #202020;
    transition: border-color .2s, background .2s, transform .1s;
    line-height: 1.4;
}

.cq-option:hover {
    border-color: #C2D814;
    background: #f7fad3;
    transform: translateX(3px);
}

.cq-option.selected {
    border-color: #C2D814;
    background: #eef5a0;
}

.cq-option-key {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #C2D814;
    color: #202020;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    font-size: 13px;
}

.cq-option.selected .cq-option-key {
    background: #a8bc0f;
    color: #202020;
}

/* ── NAVIGAZIONE ── */
.cq-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* ── BOTTONI ── */
.cq-btn {
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    border: none;
    transition: background .2s, opacity .2s, transform .1s;
}

.cq-btn:active { transform: scale(.97); }

.cq-btn--primary {
    background: #C2D814;
    color: #202020;
}

.cq-btn--primary:hover { background: #a8bc0f; }

.cq-btn--ghost {
    background: transparent;
    color: #202020;
    border: 1.5px solid #d1d5db;
    font-weight: 400;
}

.cq-btn--ghost:hover { border-color: #C2D814; color: #202020; }

.cq-btn--submit {
    background: #C2D814;
    color: #202020;
}

.cq-btn--submit:hover { background: #a8bc0f; }

.cq-btn:disabled {
    cursor: not-allowed;
    transform: none;
}

/* ── ALERT ── */
.cq-alert {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    margin-bottom: 16px;
}

.cq-alert--error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ── LOADING ── */
.cq-loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.85);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    gap: 16px;
    font-size: 16px;
    font-family: 'Lato', sans-serif;
    color: #202020;
}

.cq-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eef5a0;
    border-top-color: #C2D814;
    border-radius: 50%;
    animation: cqSpin .7s linear infinite;
}

@keyframes cqSpin { to { transform: rotate(360deg); } }

/* ── RISULTATI ── */
.cq-results-badge {
    text-align: center;
    margin-bottom: 28px;
}

.cq-badge {
    display: inline-block;
    border-radius: 40px;
    padding: 14px 36px;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: #fff;
    margin-bottom: 12px;
}

.cq-badge--green  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.cq-badge--yellow { background: linear-gradient(135deg, #d97706, #f59e0b); }
.cq-badge--red    { background: linear-gradient(135deg, #b91c1c, #ef4444); }

.cq-score {
    font-size: 42px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: #202020;
    line-height: 1;
}

.cq-score-sub {
    font-size: 16px;
    font-weight: 400;
    font-family: 'Lato', sans-serif;
    color: #202020;
    margin-top: 4px;
}

/* ── MESSAGGIO RINGRAZIAMENTO ── */
.cq-thankyou-msg {
    background: linear-gradient(135deg, #C2D814 0%, #a8bc0f 100%);
    color: #202020;
    border-radius: 12px;
    padding: 18px 24px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    line-height: 1.5;
    text-align: center;
    margin: 0 0 24px;
    box-shadow: 0 4px 16px rgba(194,216,20,.30);
}

/* ── RIEPILOGO DOMANDE ── */
.cq-summary-title {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: #202020;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin: 28px 0 16px;
}

.cq-summary-item {
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1.5px solid;
}

.cq-summary-item--ok {
    background: #f0fdf4;
    border-color: #86efac;
}

.cq-summary-item--wrong {
    background: #fff7f7;
    border-color: #fca5a5;
}

.cq-summary-qtext {
    font-size: 14px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: #202020;
    margin-bottom: 6px;
}

.cq-summary-given {
    font-size: 13px;
    font-weight: 400;
    font-family: 'Lato', sans-serif;
    color: #202020;
}

.cq-summary-correct {
    font-size: 13px;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    color: #16a34a;
    margin-top: 4px;
}

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
    .cq-step { padding: 24px 20px; }
    .cq-form-grid { grid-template-columns: 1fr; }
    .cq-field--full { grid-column: 1; }
    .cq-step-header h2 { font-size: 18px; }
    .cq-question-text { font-size: 16px; }
    .cq-badge { font-size: 17px; padding: 12px 24px; }
    .cq-score { font-size: 32px; }
}