/* ==========================================================================
   Page « Configurateur »
   À charger après css/style.css et css/options.css
   (réutilise .page-hero, .opt-section, .sr-only, .media…).
   ========================================================================== */

.page-hero--short {
    min-height: clamp(300px, 46svh, 480px);
}

.cfg-section {
    padding-top: clamp(40px, 6vw, 72px);
}

.cfg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
    gap: clamp(32px, 5vw, 72px);
    align-items: start;
}

/* ---------- Étapes ---------- */

.cfg-steps {
    min-width: 0;
}

.cfg-step {
    padding: 0 0 clamp(28px, 4vw, 44px);
    margin-bottom: clamp(28px, 4vw, 44px);
    border-bottom: 1px solid var(--line);
}

.cfg-step:last-of-type {
    border-bottom: 0;
    margin-bottom: 0;
}

.cfg-step-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 20px;
    font-size: clamp(1.3rem, 2.4vw, 1.7rem);
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.cfg-step-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--white);
    background: var(--black);
    border-radius: 50%;
}

.cfg-hint {
    font-size: 0.95rem;
    color: var(--muted);
}

.cfg-hint[hidden] {
    display: none;
}

/* ---------- Choix ---------- */

.cfg-choices {
    display: grid;
    gap: 12px;
}

.cfg-choices--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cfg-choice {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 18px 20px;
    font: inherit;
    text-align: left;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.cfg-choice strong {
    font-size: 1.1rem;
    line-height: 1.25;
}

.cfg-choice span {
    font-size: 0.88rem;
    color: var(--muted);
}

.cfg-choice:hover {
    border-color: var(--black);
}

.cfg-choice[aria-pressed="true"] {
    color: var(--white);
    background: var(--black);
    border-color: var(--black);
}

.cfg-choice[aria-pressed="true"] span {
    color: #c9ced6;
}

.cfg-choice:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Finitions : groupes par pôle */

.cfg-pole+.cfg-pole {
    margin-top: 28px;
}

.cfg-pole-name {
    margin: 0 0 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

.cfg-choices--grades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Motorisations : groupes par énergie */

.cfg-fuel+.cfg-fuel {
    margin-top: 24px;
}

.cfg-fuel-name {
    margin: 0 0 12px;
    font-size: 0.95rem;
    font-weight: 700;
}

.cfg-choices--engines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------- Récapitulatif ---------- */

.cfg-summary {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    padding: 24px;
    background: var(--grey);
    border-radius: 12px;
}

.cfg-visual {
    aspect-ratio: 5 / 4;
    margin-bottom: 20px;
    border-radius: 8px;
}

.cfg-visual img[hidden] {
    display: none;
}

.cfg-summary h3 {
    margin: 0 0 14px;
    font-size: 1.4rem;
    font-weight: 700;
}

.cfg-recap {
    margin: 0;
}

.cfg-recap div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.cfg-recap dt {
    font-size: 0.85rem;
    color: var(--muted);
}

.cfg-recap dd {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: right;
}

.cfg-recap dd.is-empty {
    font-weight: 400;
    color: var(--muted);
}

.cfg-specs {
    display: flex;
    gap: 24px;
    margin: 16px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.cfg-specs[hidden],
.cfg-link[hidden] {
    display: none;
}

.cfg-specs strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
}

.cfg-specs span {
    display: block;
    margin-top: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.cfg-link {
    margin-top: 18px;
}

.cfg-reset {
    display: block;
    margin-top: 20px;
    padding: 0;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.cfg-reset:hover {
    color: var(--accent);
}

.cfg-note {
    margin-top: 14px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--muted);
}

/* ---------- Adaptation ---------- */

@media (max-width: 960px) {
    .cfg-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .cfg-summary {
        position: static;
    }
}

@media (max-width: 560px) {

    .cfg-choices--grades,
    .cfg-choices--engines {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Options ---------- */

.cfg-optgroup {
    margin: 0 0 24px;
    padding: 0;
    border: 0;
    min-width: 0;
}

.cfg-optgroup legend {
    padding: 0;
    margin-bottom: 12px;
}

.cfg-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 10px;
    padding: 14px 18px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.cfg-option:hover,
.cfg-option:has(input:checked) {
    border-color: var(--black);
}

.cfg-option input {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--black);
    cursor: pointer;
}

.cfg-option-text {
    flex: 1;
    min-width: 0;
}

.cfg-option-text strong {
    display: block;
    font-size: 1rem;
    line-height: 1.3;
}

.cfg-option-text small {
    display: block;
    margin-top: 2px;
    font-size: 0.85rem;
    color: var(--muted);
}

.cfg-option-price {
    flex: none;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- Prix et facture ---------- */

.cfg-price {
    margin: 16px 0 0;
    padding-top: 4px;
    border-top: 1px solid var(--black);
}

.cfg-price[hidden] {
    display: none;
}

.cfg-price div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
}

.cfg-price dt {
    font-size: 0.9rem;
    color: var(--muted);
}

.cfg-price dd {
    margin: 0;
    font-weight: 600;
}

.cfg-price .cfg-price-total {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.cfg-price-total dt {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}

.cfg-price-total dd {
    font-size: 1.4rem;
    font-weight: 700;
}

.cfg-invoice {
    margin-top: 20px;
}

.cfg-invoice label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.cfg-invoice label small {
    font-weight: 400;
    color: var(--muted);
}

.cfg-invoice input {
    width: 100%;
    padding: 11px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.cfg-invoice input:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 1px;
}

.cfg-invoice-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px 20px;
    font: inherit;
    font-weight: 700;
    color: var(--white);
    background: var(--black);
    border: 1px solid var(--black);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.cfg-invoice-btn:hover:not(:disabled) {
    color: var(--black);
    background: transparent;
}

.cfg-invoice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cfg-invoice-msg {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--accent);
}

.cfg-invoice-msg:empty {
    display: none;
}

@media (max-width: 560px) {
    .cfg-option {
        flex-wrap: wrap;
    }

    .cfg-option-price {
        margin-left: 34px;
    }
}

/* ---------- Équipements inclus (verrouillés) ---------- */

.cfg-legend {
    margin: -8px 0 20px;
}

.cfg-hint:not([hidden])+.cfg-legend {
    display: none;
}

.cfg-option.is-locked {
    background: var(--grey);
    border-color: var(--line);
    cursor: default;
}

.cfg-option.is-locked input {
    cursor: not-allowed;
}

.cfg-option.is-orphan {
    opacity: 0.55;
    cursor: not-allowed;
}

.cfg-option-note {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
}

.cfg-option-price.is-included {
    padding: 4px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--white);
    background: var(--black);
    border-radius: 999px;
}

.cfg-base {
    margin-top: 8px;
}

.cfg-base summary {
    padding: 12px 0;
    font-weight: 700;
    cursor: pointer;
}

.cfg-option--compact {
    align-items: center;
    margin-bottom: 6px;
    padding: 8px 14px;
}

.cfg-option--compact .cfg-option-text strong {
    font-size: 0.9rem;
    font-weight: 600;
}

.cfg-base-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
}

@media (max-width: 560px) {
    .cfg-base-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Fiche complète d'une option ---------- */

.cfg-more {
    margin-top: 6px;
}

.cfg-more summary {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.cfg-more p {
    margin-top: 8px;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--muted);
}

/* ---------- Fenêtre de confirmation ---------- */

.cfg-dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 28px;
    color: var(--ink);
    background: var(--white);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(1, 2, 5, 0.35);
}

.cfg-dialog::backdrop {
    background: rgba(1, 2, 5, 0.55);
}

.cfg-dialog h3 {
    margin: 0 0 14px;
    font-size: 1.3rem;
    line-height: 1.25;
}

.cfg-dialog-body p {
    margin: 0 0 10px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.cfg-dialog-list {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.cfg-dialog-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    margin-bottom: 6px;
    font-weight: 600;
    background: var(--grey);
    border-radius: 8px;
}

.cfg-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.cfg-dialog-actions button {
    padding: 12px 22px;
    font: inherit;
    font-weight: 700;
    border: 1px solid var(--black);
    border-radius: 999px;
    cursor: pointer;
}

.cfg-dialog-cancel {
    color: var(--black);
    background: transparent;
}

.cfg-dialog-ok {
    color: var(--white);
    background: var(--black);
}

.cfg-dialog-actions button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}