/* =====================================================
   LEH · Formulaire Devis - CSS
   ===================================================== */

.leh-devis-form-wrapper {
    position: relative;
    box-sizing: border-box;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px;
    background-color: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 16px 50px rgba(27,77,46,0.12);
    --leh-green-dark: #1B4D2E;
    --leh-green: #4A7C3B;
    --leh-green-light: #7AB55C;
}

.leh-devis-form-wrapper *,
.leh-devis-form-wrapper *::before,
.leh-devis-form-wrapper *::after {
    box-sizing: border-box;
}

.leh-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================
   EN-TÊTE
   ===================================================== */
.leh-devis-header {
    text-align: center;
    margin-bottom: 32px;
}

.leh-devis-pretitle {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-size: 12px;
    font-weight: 700;
    color: var(--leh-green);
    margin-bottom: 12px;
    padding: 4px 14px;
    background-color: rgba(74,124,59,0.1);
    border-radius: 100px;
}

.leh-devis-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--leh-green-dark);
    margin: 0 0 10px 0;
}

.leh-devis-subtitle {
    font-size: 15px;
    line-height: 1.6;
    color: #5A5A5A;
    margin: 0;
}

/* =====================================================
   BARRE DE PROGRESSION
   ===================================================== */
.leh-progress-wrapper {
    margin-bottom: 32px;
}

/* Mode "bar" simple */
.leh-progress-track {
    width: 100%;
    height: 6px;
    background-color: rgba(74,124,59,0.15);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 16px;
}

.leh-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1B4D2E 0%, #4A7C3B 100%);
    border-radius: 100px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 33.33%;
}

/* Mode "steps" */
.leh-step-indicator {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 16px;
}

.leh-step-item {
    flex: 1 1 0%;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.leh-step-circle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background-color: rgba(74,124,59,0.15);
    color: #5A5A5A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    transition: background 0.4s ease, color 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.leh-step-circle .leh-step-check {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: none;
}

.leh-step-item.is-active .leh-step-circle {
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
    color: #FFFFFF;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(27,77,46,0.25);
}

.leh-step-item.is-done .leh-step-circle {
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
    color: #FFFFFF;
}

.leh-step-item.is-done .leh-step-circle .leh-step-number { display: none; }
.leh-step-item.is-done .leh-step-circle .leh-step-check { display: block; }

.leh-step-label {
    font-size: 12px;
    font-weight: 600;
    color: #5A5A5A;
    line-height: 1.3;
    transition: color 0.3s ease;
    padding: 0 4px;
}

.leh-step-item.is-active .leh-step-label {
    color: var(--leh-green-dark);
}

/* Connecteurs entre étapes */
.leh-step-connector {
    position: absolute;
    top: 20px;
    left: calc(50% + 22px);
    right: calc(-50% + 22px);
    height: 2px;
    background-color: rgba(74,124,59,0.15);
    z-index: 1;
    overflow: hidden;
}

.leh-step-connector-fill {
    position: absolute;
    inset: 0;
    background-color: var(--leh-green);
    width: 0%;
    transition: width 0.5s ease;
}

.leh-step-item.is-done .leh-step-connector-fill {
    width: 100%;
}

.leh-step-counter {
    text-align: center;
    font-size: 13px;
    color: #888;
}

.leh-current-step {
    color: var(--leh-green-dark);
    font-weight: 700;
}

/* =====================================================
   ÉTAPES (transitions)
   ===================================================== */
.leh-step {
    display: none;
    animation: leh-fade-in 0.4s ease;
}

.leh-step.is-active {
    display: block;
}

@keyframes leh-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.leh-step-header {
    margin-bottom: 24px;
}

.leh-step-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--leh-green-dark);
    margin: 0 0 6px 0;
}

.leh-step-subtitle {
    font-size: 14px;
    color: #5A5A5A;
    margin: 0;
}

/* =====================================================
   ÉTAPE 1 : CARDS PRESTATIONS
   ===================================================== */
.leh-prestation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 8px;
}

.leh-prestation-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 12px;
    background-color: #FFFFFF;
    border: 2px solid rgba(74,124,59,0.18);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    min-height: 120px;
}

.leh-prestation-card:hover {
    border-color: var(--leh-green);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(27,77,46,0.1);
}

.leh-prestation-card.is-selected {
    border-color: var(--leh-green);
    box-shadow: 0 0 0 3px rgba(74,124,59,0.18);
}

.leh-prestation-icon-wrap {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    border-radius: 50%;
    background-color: rgba(74,124,59,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: background 0.3s ease;
}

.leh-prestation-card.is-selected .leh-prestation-icon-wrap {
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
}

.leh-prestation-icon {
    color: var(--leh-green);
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.leh-prestation-icon i { line-height: 1; }
.leh-prestation-icon svg { width: 28px; height: 28px; fill: currentColor; }

.leh-prestation-card.is-selected .leh-prestation-icon,
.leh-prestation-card.is-selected .leh-prestation-icon svg {
    color: #FFFFFF;
    fill: #FFFFFF;
}

.leh-prestation-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--leh-green-dark);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.leh-prestation-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--leh-green);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.leh-prestation-check svg { width: 14px; height: 14px; fill: currentColor; }

.leh-prestation-card.is-selected .leh-prestation-check {
    opacity: 1;
    transform: scale(1);
}

/* Pills d'urgence */
.leh-urgence-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.leh-urgence-pill {
    cursor: pointer;
    padding: 10px 18px;
    border: 2px solid rgba(74,124,59,0.2);
    border-radius: 100px;
    background-color: #FFFFFF;
    color: #1B4D2E;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.leh-urgence-pill:hover {
    border-color: var(--leh-green);
}

.leh-urgence-pill:has(input:checked),
.leh-urgence-pill.is-checked {
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
    color: #FFFFFF;
    border-color: var(--leh-green);
    box-shadow: 0 4px 12px rgba(27,77,46,0.2);
}

.leh-mt-24 { margin-top: 24px; }

/* =====================================================
   CHAMPS DE FORMULAIRE
   ===================================================== */
.leh-fields-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.leh-fields-grid.leh-cols-2 {
    grid-template-columns: 1fr 1fr;
}

.leh-field-group {
    position: relative;
    margin-bottom: 14px;
}

.leh-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--leh-green-dark);
    margin-bottom: 6px;
}

.leh-field-icon {
    color: var(--leh-green);
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.leh-field-input,
.leh-field-textarea,
.leh-field-select {
    width: 100%;
    padding: 12px 16px;
    background-color: #FFFFFF;
    color: var(--leh-green-dark);
    border: 2px solid rgba(74,124,59,0.2);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.leh-field-input::placeholder,
.leh-field-textarea::placeholder {
    color: #999;
}

.leh-field-input:focus,
.leh-field-textarea:focus,
.leh-field-select:focus {
    outline: none;
    border-color: var(--leh-green);
    box-shadow: 0 0 0 3px rgba(74,124,59,0.18);
}

.leh-field-input.has-error,
.leh-field-textarea.has-error,
.leh-field-select.has-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.12);
}

.leh-field-textarea {
    resize: vertical;
    min-height: 100px;
}

.leh-field-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.leh-form-error {
    color: #dc3545;
    background-color: rgba(220,53,69,0.08);
    border: 1px solid rgba(220,53,69,0.2);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

/* RGPD */
.leh-rgpd-group {
    margin-top: 20px;
    padding: 16px;
    background-color: rgba(74,124,59,0.04);
    border-radius: 10px;
}

.leh-rgpd-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.5;
    color: #5A5A5A;
}

.leh-rgpd-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.leh-rgpd-check {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(74,124,59,0.3);
    border-radius: 6px;
    background-color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, border-color 0.3s ease;
    position: relative;
    margin-top: 1px;
}

.leh-rgpd-check::after {
    content: '';
    width: 12px;
    height: 6px;
    border-left: 2px solid #FFFFFF;
    border-bottom: 2px solid #FFFFFF;
    transform: rotate(-45deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.leh-rgpd-label input:checked ~ .leh-rgpd-check {
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
    border-color: var(--leh-green);
}

.leh-rgpd-label input:checked ~ .leh-rgpd-check::after {
    opacity: 1;
}

.leh-rgpd-text {
    flex: 1 1 0%;
    min-width: 0;
}

.leh-rgpd-link {
    color: var(--leh-green);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.leh-rgpd-link:hover {
    color: var(--leh-green-dark);
}

/* =====================================================
   ACTIONS (boutons précédent / suivant / envoyer)
   ===================================================== */
.leh-step-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 28px;
    gap: 12px;
}

.leh-btn-prev,
.leh-btn-next,
.leh-btn-submit {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.leh-btn-prev {
    background-color: rgba(74,124,59,0.1);
    color: var(--leh-green-dark);
}

.leh-btn-prev:hover {
    background-color: rgba(74,124,59,0.2);
}

.leh-btn-next,
.leh-btn-submit {
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
    color: #FFFFFF;
    box-shadow: 0 6px 18px rgba(27,77,46,0.2);
    margin-left: auto;
}

.leh-btn-next:hover,
.leh-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(27,77,46,0.3);
}

.leh-btn-submit[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Bouton submit : par défaut, texte visible, loading caché */
.leh-btn-submit .leh-btn-submit-text { display: inline-flex; }
.leh-btn-submit .leh-btn-submit-loading { display: none; }

/* En mode loading : on inverse */
.leh-btn-submit.is-loading .leh-btn-submit-text { display: none; }
.leh-btn-submit.is-loading .leh-btn-submit-loading { display: inline-flex; }

.leh-btn-submit-loading {
    align-items: center;
    gap: 8px;
}

.leh-spinner {
    width: 18px;
    height: 18px;
    animation: leh-spin 0.8s linear infinite;
}

@keyframes leh-spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   SUCCÈS
   ===================================================== */
.leh-success-box {
    text-align: center;
    padding: 40px 24px;
    background-color: rgba(74,124,59,0.08);
    border-radius: 14px;
    animation: leh-fade-in 0.5s ease;
}

.leh-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--leh-green-dark) 0%, var(--leh-green) 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    animation: leh-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 12px 32px rgba(27,77,46,0.25);
}

@keyframes leh-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

.leh-success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--leh-green-dark);
    margin: 0 0 10px 0;
}

.leh-success-message {
    font-size: 15px;
    line-height: 1.7;
    color: var(--leh-green-dark);
    margin: 0;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 767px) {
    html body .leh-devis-form-wrapper {
        padding: 24px 18px !important;
        margin-left: 16px;
        margin-right: 16px;
        max-width: calc(100% - 32px);
    }

    html body .leh-devis-form-wrapper .leh-devis-title {
        font-size: 22px !important;
    }

    html body .leh-devis-form-wrapper .leh-step-title {
        font-size: 18px !important;
    }

    html body .leh-devis-form-wrapper .leh-step-indicator {
        gap: 4px;
    }

    html body .leh-devis-form-wrapper .leh-step-circle {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        font-size: 12px !important;
    }

    html body .leh-devis-form-wrapper .leh-step-label {
        font-size: 10px !important;
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }

    html body .leh-devis-form-wrapper .leh-step-connector {
        top: 16px;
        left: calc(50% + 18px);
        right: calc(-50% + 18px);
    }

    html body .leh-devis-form-wrapper .leh-prestation-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    html body .leh-devis-form-wrapper .leh-prestation-card {
        padding: 16px 8px;
        min-height: 100px;
    }

    html body .leh-devis-form-wrapper .leh-prestation-icon-wrap {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    html body .leh-devis-form-wrapper .leh-prestation-icon {
        font-size: 22px;
    }
    html body .leh-devis-form-wrapper .leh-prestation-icon svg {
        width: 22px;
        height: 22px;
    }

    html body .leh-devis-form-wrapper .leh-prestation-label {
        font-size: 12px !important;
    }

    html body .leh-devis-form-wrapper .leh-fields-grid.leh-cols-2 {
        grid-template-columns: 1fr !important;
    }

    html body .leh-devis-form-wrapper .leh-step-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    html body .leh-devis-form-wrapper .leh-btn-prev,
    html body .leh-devis-form-wrapper .leh-btn-next,
    html body .leh-devis-form-wrapper .leh-btn-submit {
        width: 100%;
        margin-left: 0;
    }

    html body .leh-devis-form-wrapper .leh-urgence-pill {
        font-size: 12px;
        padding: 8px 14px;
    }
}

/* =====================================================
   ACCESSIBILITÉ
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .leh-step,
    .leh-prestation-card,
    .leh-prestation-check,
    .leh-step-circle,
    .leh-progress-fill,
    .leh-step-connector-fill,
    .leh-btn-next,
    .leh-btn-submit,
    .leh-success-icon,
    .leh-spinner {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
}
