/*
 * Simulateurs de score ISO et RSE (feuille partagée, identique dans les deux gabarits)
 * Extrait de templates/cabqual/simulator-iso.html.twig : ce fichier remplace le bloc <style> que le
 * gabarit portait en ligne. Chargé via asset() (versionné par ASSETS_VERSION).
 */

/* Garde la navbar sombre au-dessus du fond de la page simulateur */
.navbar,
.navbar.scrolled {
    background-color: rgba(12, 8, 20, 0.92) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(112, 69, 225, 0.08);
}

.cq-app {
    padding: 130px 1.5rem 5rem;
    position: relative;
    overflow: hidden;
    min-height: 80vh;
}

.cq-app::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 50% 40% at 88% 8%, rgba(72, 40, 179, 0.22) 0%, transparent 65%),
        radial-gradient(ellipse 45% 35% at 10% 55%, rgba(112, 69, 225, 0.14) 0%, transparent 65%);
    z-index: 0;
    pointer-events: none;
}

.cq-app > * {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* En-tête */
.cq-head {
    text-align: center;
    margin-bottom: 1.9rem;
}

.cq-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 1.4rem;
    border-radius: 999px;
    background: rgba(15, 10, 22, 0.6);
    border: 1px solid rgba(112, 69, 225, 0.22);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #c4b8ee;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-bottom: 1.6rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.cq-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7045e1;
    box-shadow: 0 0 0 3px rgba(112, 69, 225, 0.18), 0 0 10px rgba(112, 69, 225, 0.85);
}

.cq-head h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.035em;
    color: #fff;
    margin: 0 0 1rem;
}

.cq-head h1 .accent {
    background: linear-gradient(120deg, #9b7eed 0%, #c4b8ee 50%, #7045e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cq-head p {
    font-size: 1.02rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    max-width: 660px;
    margin: 0 auto;
}

/* Carte formulaire */
.cq-card {
    background: rgba(18, 13, 26, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 1.8rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    margin-bottom: 1.8rem;
}

.cq-row {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    align-items: center;
}

.cq-row input[type="text"] {
    flex: 1 1 320px;
    min-width: 0;
    padding: 0.9rem 1.2rem;
    background: rgba(7, 5, 11, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.cq-row input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.cq-row input[type="text"]:focus {
    outline: none;
    border-color: rgba(112, 69, 225, 0.6);
    box-shadow: 0 0 0 3px rgba(112, 69, 225, 0.18);
}

.cq-row select {
    padding: 0.9rem 1.2rem;
    background: rgba(7, 5, 11, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cq-row select:focus {
    outline: none;
    border-color: rgba(112, 69, 225, 0.6);
    box-shadow: 0 0 0 3px rgba(112, 69, 225, 0.18);
}

.cq-row select option {
    background: #14101c;
    color: #fff;
}

.cq-row button[type="submit"] {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(112, 69, 225, 0.6);
    padding: 0.9rem 2rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 0 1px rgba(112, 69, 225, 0.15), 0 8px 24px rgba(44, 23, 138, 0.35);
}

.cq-row button[type="submit"]:hover {
    border-color: #7045e1;
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(112, 69, 225, 0.35), 0 14px 32px rgba(44, 23, 138, 0.55), 0 0 30px rgba(112, 69, 225, 0.25);
}

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

/* Overlay de chargement */
.cq-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(10, 6, 24, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: cqFade 0.35s ease;
}

.cq-overlay[hidden] {
    display: none;
}

@keyframes cqFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cq-overlay-card {
    width: 100%;
    max-width: 420px;
    padding: 2.4rem 2.2rem;
    background: rgba(20, 13, 43, 0.92);
    border: 1px solid rgba(112, 69, 225, 0.35);
    border-radius: 20px;
    box-shadow: 0 24px 70px rgba(20, 10, 60, 0.6), 0 0 50px rgba(112, 69, 225, 0.18);
    text-align: center;
    animation: cqPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cqPop {
    from { opacity: 0; transform: translateY(14px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cq-overlay-orb {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 50%, rgba(112, 69, 225, 0.35), rgba(112, 69, 225, 0) 70%);
    position: relative;
}

.cq-overlay-orb::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #9b7eed;
    border-right-color: rgba(155, 126, 237, 0.4);
    animation: cqSpin 0.9s linear infinite;
    z-index: 2;
}

/* Square logo sitting behind the orb's spinner ring and core. */
.cq-overlay-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    transform: translate(-50%, -50%);
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
    opacity: 50%;
}

.cq-orb-core {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b7eed, #7045e1);
    box-shadow: 0 0 18px rgba(112, 69, 225, 0.7);
    animation: cqPulse 1.4s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

@keyframes cqPulse {
    0%, 100% { transform: scale(0.85); opacity: 0.75; }
    50% { transform: scale(1.1); opacity: 1; }
}

.cq-overlay-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff;
    margin: 0 0 1.5rem;
}

.cq-steps {
    list-style: none;
    margin: 0 0 1.6rem;
    padding: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cq-step {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.4s ease;
}

.cq-step-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    position: relative;
    transition: all 0.4s ease;
}

.cq-step.is-active {
    color: #fff;
}

.cq-step.is-active .cq-step-icon {
    border-color: rgba(112, 69, 225, 0.4);
    border-top-color: #9b7eed;
    animation: cqSpin 0.7s linear infinite;
}

.cq-step.is-done {
    color: rgba(255, 255, 255, 0.75);
}

.cq-step.is-done .cq-step-icon {
    border-color: #7045e1;
    background: #7045e1;
    animation: none;
}

.cq-step.is-done .cq-step-icon::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.cq-overlay-bar {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.cq-overlay-bar-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #7045e1, #9b7eed);
    transition: width 0.6s ease;
}

.cq-opts {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
}

.cq-opts input[type="checkbox"] {
    accent-color: #7045e1;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.cq-error {
    margin: 1.1rem 0 0;
    padding: 0.8rem 1.1rem;
    background: rgba(220, 38, 38, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: 12px;
    color: #fca5a5;
    font-size: 0.88rem;
}

/* Résultats */
.cq-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 1.2rem;
}

.cq-panel {
    background: rgba(18, 13, 26, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 1.5rem 1.6rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Panneau score : centré, côte à côte avec le radar sur desktop */
.cq-panel:first-child {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 60% 80% at 50% 0%, rgba(72, 40, 179, 0.2) 0%, transparent 70%),
        rgba(18, 13, 26, 0.78);
}

/* Borne la taille du radar pour qu'il ne gonfle pas la hauteur du panneau. */
.cq-radar-wrap {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
}

.cq-panel h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.9rem;
    letter-spacing: -0.01em;
}

.cq-ref {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    background: rgba(112, 69, 225, 0.12);
    border: 1px solid rgba(112, 69, 225, 0.35);
    color: #c4b8ee;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Jauge à arc 270° + graduations */
.cq-gauge {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0.6rem auto 0.5rem;
    /* couleur par défaut (note inconnue) — pilote l'arc, les graduations et la note */
    color: #8a72d0;
}

.cq-gauge-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.cq-gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 7;
    stroke-linecap: round;
}

.cq-gauge-fill {
    fill: none;
    stroke: currentColor;
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.cq-tick {
    stroke: rgba(255, 255, 255, 0.11);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 0.35s ease;
}

.cq-tick-on {
    stroke: currentColor;
}

.cq-gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.cq-score {
    font-family: 'Poppins', sans-serif;
    font-size: 3.1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #fff;
}

.cq-score-max {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.32);
    margin-left: 0.1rem;
}

.cq-grade-letter {
    font-family: 'Poppins', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: currentColor;
}

/* Code couleur par note (désaturé) — hérité par l'arc, les graduations et la note */
.cq-grade-a { color: #5cc08e; }
.cq-grade-b { color: #94b85c; }
.cq-grade-c { color: #d8ab48; }
.cq-grade-d { color: #d98a4e; }
.cq-grade-e,
.cq-grade-f { color: #cf6a6a; }

.cq-score-label {
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.8rem;
}

.cq-sentence {
    font-size: 0.98rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto;
}

.cq-notice {
    margin: 1rem auto 0;
    max-width: 640px;
    padding: 0.7rem 1.1rem;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.35);
    border-radius: 12px;
    color: #fde047;
    font-size: 0.85rem;
}

.cq-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1.6rem;
}

.cq-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 500;
}

.cq-chip b {
    color: #fff;
    font-weight: 700;
}

.cq-chip.ok {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(74, 222, 128, 0.35);
    color: #86efac;
}

.cq-chip.ok b {
    color: #bbf7d0;
}

.cq-chip.warn {
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(250, 204, 21, 0.35);
    color: #fde047;
}

.cq-chip.warn b {
    color: #fef08a;
}

/* Radar */
#cabqual-radar {
    display: block;
    margin: 0 auto;
    max-width: 100%;
}

.cq-axes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.cq-axes .ax {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
}

.cq-axes .ax b {
    color: #c4b8ee;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

/* Preuves */
.cq-evidence {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cq-ev {
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.cq-ev:hover {
    border-color: rgba(112, 69, 225, 0.35);
    background: rgba(112, 69, 225, 0.06);
}

.cq-ev .t {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    color: #fff;
    margin-bottom: 0.35rem;
}

.cq-ev .s {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin-bottom: 0.55rem;
}

.cq-ev a {
    font-size: 0.8rem;
    font-weight: 600;
    color: #9b7eed;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cq-ev a:hover {
    color: #c4b8ee;
}

.cq-ev-empty {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.cq-ev-toggle {
    margin-top: 0.9rem;
    align-self: flex-start;
    padding: 0.55rem 1.1rem;
    background: rgba(112, 69, 225, 0.12);
    border: 1px solid rgba(112, 69, 225, 0.35);
    border-radius: 10px;
    color: #c4b8ee;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cq-ev-toggle:hover {
    background: rgba(112, 69, 225, 0.22);
    border-color: rgba(112, 69, 225, 0.55);
}

.cq-cta {
    margin-top: 1.2rem;
    padding: 1.3rem 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(112, 69, 225, 0.18), rgba(112, 69, 225, 0.06));
    border: 1px solid rgba(112, 69, 225, 0.4);
    border-radius: 16px;
}

.cq-cta-content {
    flex: 1;
    min-width: 0;
}

.cq-cta-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 0.45rem;
}

.cq-cta-text {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.55;
    margin: 0;
    max-width: 640px;
}

.cq-cta-btn {
    flex-shrink: 0;
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: #7045e1;
    border-radius: 10px;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.cq-cta-btn:hover {
    background: #8056f0;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .cq-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .cq-cta-btn {
        width: 100%;
        text-align: center;
    }
}

.cq-scanned {
    margin: 1rem 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
}

.cq-result-note {
    margin: 0.9rem auto 0;
    text-align: center;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
    max-width: 720px;
}

.cq-disclaimer {
    margin: 1.1rem auto 0;
    text-align: center;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.5;
    max-width: 860px;
}

@media (max-width: 768px) {
    .cq-app {
        padding: 120px 1rem 4rem;
    }

    .cq-head h1 {
        font-size: 2.1rem;
    }

    .cq-results {
        grid-template-columns: 1fr;
    }

    .cq-row button[type="submit"] {
        width: 100%;
    }

    .cq-gauge {
        width: 160px;
        height: 160px;
    }

    .cq-score {
        font-size: 2.9rem;
    }

    .cq-axes {
        grid-template-columns: 1fr;
    }
}
