/* ========================================================================
   FORMULAIRE MULTI-ETAPES (wizard) — Ramoneur Bas-Rhin
   Carte autonome : s'affiche correctement sur fond clair comme sur fond
   sombre, sans dependre des styles de section.
   ======================================================================== */

.form-wizard {
    max-width: 760px;
    margin: 0 auto;
    background: var(--white, #fff);
    color: var(--text, #333);
    padding: 2rem;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    text-align: left;
    position: relative;
}

/* Sur l'accueil, le formulaire est deja pose dans une carte blanche
   (.contact-form-wrapper) : on evite la carte dans la carte. Ailleurs
   (.section-form, .section-dark, .section-primary...) le wizard fournit
   lui-meme sa carte blanche sur le fond sombre de la section. */
.contact-form-wrapper .form-wizard {
    background: transparent;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

/* ---------- Barre de progression ---------- */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
}

.wizard-progress .step-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #d9dee3;
    transition: background 0.25s ease, transform 0.25s ease;
}

.wizard-progress .step-dot.active {
    background: var(--primary, #D35400);
    transform: scale(1.25);
}

.wizard-progress .step-dot.done {
    background: var(--success, #27AE60);
}

/* ---------- Etapes ---------- */
.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
    animation: wizardFade 0.25s ease;
}

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

.wizard-step-counter {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary, #D35400);
    margin-bottom: 0.4rem;
}

.wizard-step-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--secondary, #2C3E50);
    margin-bottom: 0.35rem;
}

.wizard-step-subtitle {
    font-size: 0.95rem;
    color: var(--text-light, #666);
    margin-bottom: 1.4rem;
}

/* ---------- Options radio en cartes ---------- */
.wizard-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.wizard-options.wizard-options-single {
    grid-template-columns: 1fr;
}

.form-wizard .wizard-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    border: 2px solid #e3e7ea;
    border-radius: var(--radius-md, 8px);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.wizard-option:hover {
    border-color: var(--primary, #D35400);
    box-shadow: 0 4px 10px rgba(211, 84, 0, 0.12);
}

.wizard-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wizard-option .option-mark {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 2px solid #c7cdd2;
    border-radius: 50%;
    position: relative;
    transition: border-color 0.2s ease;
}

.wizard-option .option-mark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary, #D35400);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.18s ease;
}

.wizard-option .option-label {
    font-size: 0.98rem;
    font-weight: 500;
    color: var(--secondary, #2C3E50);
    line-height: 1.35;
}

.wizard-option input[type="radio"]:checked ~ .option-mark {
    border-color: var(--primary, #D35400);
}

.wizard-option input[type="radio"]:checked ~ .option-mark::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Classe posee par le JS : compatible avec les navigateurs sans :has() */
.wizard-option.is-selected {
    border-color: var(--primary, #D35400);
    background: rgba(211, 84, 0, 0.05);
}

.wizard-option input[type="radio"]:focus-visible ~ .option-mark {
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.3);
}

/* ---------- Champs ---------- */
.form-wizard .form-group {
    margin-bottom: 1rem;
}

.form-wizard .form-group.full-width {
    grid-column: 1 / -1;
}

/* Portee volontairement limitee aux labels de champ : la regle generique
   .form-wizard label ecraserait le display:flex des cartes .wizard-option. */
.form-wizard .form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary, #2C3E50);
}

.form-wizard input[type="text"],
.form-wizard input[type="tel"],
.form-wizard input[type="email"],
.form-wizard select,
.form-wizard textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e3e7ea;
    border-radius: var(--radius-md, 8px);
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-wizard input:focus,
.form-wizard select:focus,
.form-wizard textarea:focus {
    outline: none;
    border-color: var(--primary, #D35400);
}

.form-wizard input.has-error,
.form-wizard select.has-error,
.form-wizard textarea.has-error {
    border-color: var(--accent, #E74C3C);
}

.form-wizard textarea {
    min-height: 130px;
    resize: vertical;
}

.form-wizard .required {
    color: var(--accent, #E74C3C);
}

.wizard-fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 1rem;
}

/* ---------- Autocomplete ---------- */
.form-wizard .autocomplete-wrapper {
    position: relative;
}

.form-wizard .autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.form-wizard .autocomplete-results.active {
    display: block;
}

.form-wizard .autocomplete-item {
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    color: #333;
}

.form-wizard .autocomplete-item:last-child {
    border-bottom: none;
}

.form-wizard .autocomplete-item:hover,
.form-wizard .autocomplete-item.active {
    background: #f8f9fa;
    color: var(--primary, #D35400);
}

.form-wizard .autocomplete-item .canton-name {
    font-size: 0.82rem;
    color: #777;
    margin-left: 0.4rem;
}

/* ---------- Consentements ---------- */
.wizard-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-top: 0.9rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e3e7ea;
    border-radius: var(--radius-md, 8px);
    background: #fbfbfc;
}

.wizard-consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 0.15rem;
    accent-color: var(--primary, #D35400);
    cursor: pointer;
}

.wizard-consent label {
    margin-bottom: 0;
    font-weight: 400;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #444;
    cursor: pointer;
}

.wizard-consent a {
    color: var(--primary, #D35400);
    text-decoration: underline;
}

/* ---------- Navigation ---------- */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.4rem;
}

.wizard-nav .btn-wizard-prev {
    background: none;
    border: none;
    padding: 0.6rem 0.2rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-light, #666);
    cursor: pointer;
    transition: color 0.2s ease;
}

.wizard-nav .btn-wizard-prev:hover {
    color: var(--primary, #D35400);
}

.form-wizard .btn-wizard-next,
.form-wizard .btn-wizard-submit {
    display: inline-block;
    padding: 0.85rem 1.9rem;
    border: none;
    border-radius: var(--radius-md, 8px);
    background: var(--gradient-primary, linear-gradient(135deg, #D35400 0%, #E74C3C 100%));
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.form-wizard .btn-wizard-next:hover,
.form-wizard .btn-wizard-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(211, 84, 0, 0.3);
}

.form-wizard .btn-wizard-submit[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ---------- Messages ---------- */
.wizard-message {
    display: none;
    margin-top: 1.1rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md, 8px);
    font-size: 0.93rem;
    line-height: 1.5;
}

.wizard-message.is-visible {
    display: block;
}

.wizard-message.is-error {
    background: #fdecea;
    border: 1px solid #f5c2bd;
    color: #a4291c;
}

.wizard-success {
    display: none;
    text-align: center;
    padding: 2rem 1rem;
}

.wizard-success.is-visible {
    display: block;
}

.wizard-success h3 {
    color: var(--success, #27AE60);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.wizard-success p {
    color: var(--text-light, #666);
    margin-bottom: 0;
}

.wizard-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .form-wizard {
        padding: 1.4rem;
    }

    .wizard-options,
    .wizard-fields-grid {
        grid-template-columns: 1fr;
    }

    .wizard-step-title {
        font-size: 1.2rem;
    }

    .wizard-nav {
        flex-wrap: wrap;
    }

    .form-wizard .btn-wizard-next,
    .form-wizard .btn-wizard-submit {
        flex: 1 1 auto;
        text-align: center;
    }
}
