/* ═══════════════════════════════════════════════════════════════════════════
   S45 Contact Modal — Demande de rappel
   Templates : Multi-step (1) & Accordion (2)
   ═══════════════════════════════════════════════════════════════════════════ */

/* === Base overlay + modal === */

.s45-contact-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.s45-contact-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.s45-contact-modal {
    background: var(--color-creme, #FAF9F5);
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    padding: 28px 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Close */
.s45-contact-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--color-rose, #C4AFA6);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.s45-contact-close:hover {
    color: var(--color-brun, #3A2E26);
}

/* Title */
.s45-contact-title {
    font-family: "V2";
    font-size: 18px;
    font-weight: 500;
    color: var(--color-brun, #3A2E26);
    margin: 0 0 4px;
}

.s45-contact-cours-name {
    font-size: 13px;
    color: var(--color-rose, #C4AFA6);
    margin: 0 0 20px;
}

/* === Form base === */

.s45-contact-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.s45-contact-form label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-brun, #3A2E26);
    margin-bottom: -10px;
    letter-spacing: 0.02em;
}

.s45-contact-form input[type="text"],
.s45-contact-form input[type="email"],
.s45-contact-form input[type="tel"],
.s45-contact-form select,
.s45-contact-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 0.5px solid var(--color-sable, #E4D8C8);
    border-radius: 8px;
    background: #fff;
    color: var(--color-brun, #3A2E26);
    box-sizing: border-box;
    transition: border-color 150ms ease;
    font-family: inherit;
}

.s45-contact-form textarea {
    resize: vertical;
    min-height: 60px;
}

.s45-contact-form input:focus,
.s45-contact-form select:focus,
.s45-contact-form textarea:focus {
    outline: none;
    border-color: var(--color-sauge, #8AA68A);
}

/* Optional tag */
.s45-optional {
    font-weight: 400;
    color: var(--color-rose, #C4AFA6);
}

/* Disponibilités fieldset */
.s45-dispos-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.s45-dispos-fieldset legend {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-brun, #3A2E26);
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}

.s45-dispos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

/* Dispos card-style checkboxes */
.s45-dispos-grid .s45-check-label {
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--color-sable, #D8D3C8);
    border-radius: 6px;
    align-items: center;
    transition: border-color 150ms ease, background 150ms ease;
    margin-bottom: 0;
    font-size: 13px;
}

.s45-dispos-grid .s45-check-label:hover {
    border-color: var(--color-sauge, #8AA68A);
}

.s45-dispos-grid .s45-check-label:has(input:checked) {
    border-color: var(--color-sauge, #8AA68A);
    background: color-mix(in srgb, var(--color-sauge, #8AA68A) 8%, white);
}

.s45-dispos-grid .s45-check-label:last-child:nth-child(odd) {
    grid-column: span 2;
}

/* Checkbox labels (base) */
.s45-check-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--color-brun, #3A2E26);
    cursor: pointer;
    line-height: 1.4;
    margin-bottom: 0;
}

.s45-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
    accent-color: var(--color-sauge, #8AA68A);
}

/* RGPD */
.s45-rgpd-label {
    font-size: 11px;
    color: var(--color-rose, var(--s45-text-secondary));
}

.s45-rgpd-label a {
    color: var(--color-sauge, #8AA68A);
    text-decoration: underline;
}

/* === Field validation errors === */

.s45-dispos-fieldset.s45-field-error legend {
    color: #a94442;
}

.s45-contact-form input.s45-field-error,
.s45-contact-form select.s45-field-error,
.s45-contact-form textarea.s45-field-error {
    border-color: #a94442;
}

.s45-check-label.s45-field-error {
    color: #a94442;
}

/* === Submit === */

.s45-contact-form .s45-contact-submit {
    width: 100%;
    padding: 12px;
    background: var(--color-sauge, #8AA68A);
    color: #fff;
    border: none;
    border-radius: var(--btn-radius, 8px);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 200ms ease;
    margin-top: 4px;
    font-family: inherit;
}

.s45-contact-form .s45-contact-submit:hover {
    background: var(--color-sauge-d, #5C7A5E);
}

.s45-contact-form .s45-contact-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success */
/* ── Loader ──────────────────────────────────────────── */
.s45-modal-loader {
    position: absolute;
    inset: 0;
    background: var(--color-creme, #FAF9F5);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    animation: s45FadeIn 150ms ease;
}
.s45-modal-loader[hidden] { display: none; }
.s45-modal-loader p {
    font-size: 13px;
    color: var(--color-rose, #C4AFA6);
    margin: 0;
}
.s45-spinner {
    width: 44px;
    height: 44px;
    animation: s45Rotate 900ms linear infinite;
}
.s45-spinner circle {
    stroke: var(--color-sauge, #8AA68A);
    stroke-dasharray: 90;
    stroke-dashoffset: 60;
    stroke-linecap: round;
}
@keyframes s45Rotate { to { transform: rotate(360deg); } }

/* ── Success screen ──────────────────────────────────── */
.s45-modal-success-screen {
    text-align: center;
    padding: 16px 8px 8px;
    animation: s45FadeIn 250ms ease;
}
.s45-modal-success-screen[hidden] { display: none; }
.s45-check-circle {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: block;
}
.s45-check-circle circle {
    stroke: var(--color-sauge, #8AA68A);
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: s45DrawCircle 500ms ease forwards 100ms;
}
.s45-check-path {
    stroke: var(--color-sauge, #8AA68A);
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: s45DrawCheck 350ms ease forwards 550ms;
}
@keyframes s45DrawCircle { to { stroke-dashoffset: 0; } }
@keyframes s45DrawCheck  { to { stroke-dashoffset: 0; } }

.s45-modal-success-screen h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-brun, #3A2E26);
    margin: 0 0 8px;
}
.s45-success-sub {
    font-size: 14px;
    color: var(--color-rose, #C4AFA6);
    margin: 0 0 24px;
    line-height: 1.5;
}
/* ── Success steps (confirmations) ──────────────────── */
.s45-success-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 16px 0;
    text-align: left;
}

.s45-success-step {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--color-brun, #3A2E26);
    background: color-mix(in srgb, var(--color-sauge, #8AA68A) 8%, white);
    border: 1px solid color-mix(in srgb, var(--color-sauge, #8AA68A) 22%, white);
    border-radius: 7px;
    padding: 9px 12px;
    opacity: 0;
    transform: translateY(5px);
    animation: s45StepReveal 280ms ease forwards;
}

.s45-success-step:nth-child(2) { animation-delay: 280ms; }

@keyframes s45StepReveal {
    to { opacity: 1; transform: translateY(0); }
}

.s45-success-step-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.s45-success-step-body {
    flex: 1;
    min-width: 0;
}

.s45-success-step-body span {
    display: block;
    line-height: 1.3;
}

.s45-wa-bar {
    height: 2px;
    background: rgba(37, 211, 102, 0.18);
    border-radius: 1px;
    margin-top: 6px;
    overflow: hidden;
}

.s45-wa-bar-fill {
    height: 100%;
    width: 0;
    background: #25D366;
    border-radius: 1px;
    transition: width 1800ms linear;
}

.s45-contact-close-btn {
    background: none;
    border: 1.5px solid var(--color-sauge, #8AA68A);
    color: var(--color-sauge-d, #5C7A5E);
    padding: 10px 28px;
    border-radius: 50px;
    font-size: 14px;
    cursor: pointer;
    transition: background 150ms, color 150ms;
}
.s45-contact-close-btn:hover {
    background: var(--color-sauge, #8AA68A);
    color: #fff;
    padding: 10px 28px;
    border-radius: 5px;
}

/* ── Fail screen ─────────────────────────────────────── */
.s45-modal-fail-screen {
    text-align: center;
    padding: 16px 8px 8px;
    animation: s45FadeIn 250ms ease;
}
.s45-modal-fail-screen[hidden] { display: none; }
.s45-fail-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fef2f2;
    border: 2px solid #fca5a5;
    color: #ef4444;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.s45-modal-fail-screen h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-brun, #3A2E26);
    margin: 0 0 8px;
}
.s45-modal-fail-screen > p {
    font-size: 13px;
    color: var(--color-rose, #C4AFA6);
    margin: 0 0 20px;
    line-height: 1.5;
}
.s45-fail-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.s45-fail-btn {
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 150ms;
}
.s45-fail-btn:hover { opacity: .8; }
.s45-fail-btn--primary {
    background: var(--color-sauge, #8AA68A);
    color: #fff;
}
.s45-fail-btn--secondary {
    background: none;
    border: 1.5px solid var(--color-sauge, #8AA68A);
    color: var(--color-sauge-d, #5C7A5E);
}
.s45-fail-retry {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--color-rose, #C4AFA6);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.s45-fail-retry:hover { color: var(--color-brun, #3A2E26); }

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

/* Error */
.s45-contact-error {
    color: #a94442;
    font-size: 12px;
    margin: -6px 0 0;
    padding: 0;
}

/* === Canal de contact === */
.s45-send-channel {
    margin-top: 2px;
}

.s45-send-channel-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-brun, #3A2E26);
    letter-spacing: 0.02em;
    margin: 0 0 8px;
}

.s45-channel-choices {
    display: flex;
    gap: 8px;
}

.s45-channel-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 10px;
    background: #fff;
    border: 1.5px solid var(--color-sable, #D8D3C8);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-rose, #9A8F87);
    transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
    user-select: none;
    margin-bottom: 0;
}

.s45-channel-pill input[type="checkbox"] {
    display: none;
}

.s45-channel-pill-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 150ms ease;
}

.s45-channel-pill:hover {
    border-color: var(--color-sauge, #8AA68A);
    color: var(--color-brun, #3A2E26);
}

.s45-channel-pill:hover .s45-channel-pill-icon {
    opacity: 1;
}

.s45-channel-pill:has(input:checked) {
    border-color: var(--color-sauge, #7A8B6F);
    background: color-mix(in srgb, var(--color-sauge, #8AA68A) 10%, white);
    color: var(--color-sauge-d, #4A6B4C);
}

.s45-channel-pill:has(input:checked) .s45-channel-pill-icon {
    opacity: 1;
}

/* RGPD notice */
.s45-rgpd-notice {
    font-size: 11px;
    color: var(--color-rose, #C4AFA6);
    text-align: center;
    margin: 8px 0 0;
    line-height: 1.4;
}

.s45-rgpd-notice a {
    color: var(--color-sauge, #8AA68A);
    text-decoration: underline;
}


/* ═══════════════════════════════════════════════════════════════════════════
   TEMPLATE 1 — MULTI-STEP
   ═══════════════════════════════════════════════════════════════════════════ */

/* Progress dots */
.s45-step-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.s45-step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-sable, #E5E1D8);
    color: var(--color-rose, #8A857D);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease;
    flex-shrink: 0;
}

.s45-step-dot.active {
    background: var(--color-sauge, #7A8B6F);
    color: #fff;
}

.s45-step-dot.completed {
    background: var(--color-sauge, #7A8B6F);
    color: #fff;
    opacity: 0.7;
    cursor: pointer;
}

.s45-step-line {
    flex: 1;
    height: 2px;
    background: var(--color-sable, #E5E1D8);
    transition: background 200ms ease;
}

.s45-step-line.completed {
    background: var(--color-sauge, #7A8B6F);
}

/* Step label */
.s45-step-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-rose, #8A857D);
    margin: 0 0 16px;
}

/* Step panels */
.s45-step-panel {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.s45-step-panel.active {
    display: flex;
    animation: s45StepFadeIn 250ms ease;
}

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

/* Step recap */
.s45-step-recap {
    background: color-mix(in srgb, var(--color-sable, #E5E1D8) 40%, white);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--color-brun, #5F5C56);
}

.s45-step-recap:empty {
    display: none;
}

/* Step navigation — reset theme bleed */
.s45-step-nav {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.s45-step-prev,
.s45-step-next {
    font-family: inherit;
    font-size: 13px !important;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.s45-step-prev {
    flex: 0 0 auto;
    padding: 11px 16px;
    background: transparent;
    color: var(--color-brun, #5F5C56);
    border: 1px solid var(--color-sable, #D8D3C8);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 150ms ease, background 150ms ease;
}

.s45-step-prev:hover {
    border-color: var(--color-brun, #3A2E26);
    background: rgba(0,0,0,0.02);
}

.s45-step-next {
    flex: 1;
    padding: 11px 16px;
    background: var(--color-sauge, #7A8B6F);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px !important;
    cursor: pointer;
    transition: background 200ms ease;
}

.s45-step-next:hover {
    background: var(--color-sauge-d, #5C7A5E);
}

.s45-step-next:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ═══════════════════════════════════════════════════════════════════════════
   TEMPLATE 2 — ACCORDION
   ═══════════════════════════════════════════════════════════════════════════ */

[data-form-template="accordion"] .s45-contact-form {
    gap: 8px;
}


.s45-acc-section {
    border: 1px solid var(--color-rose);
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
    transition: opacity 250ms ease, border-color 250ms ease;
}

.s45-acc-section.active {
    border-color: var(--color-sauge, #7A8B6F);
    border-width: 1.5px;
}

.s45-acc-section.completed {
    border-color: var(--color-sable, #D8D3C8);
}

.s45-acc-section:not(.active):not(.completed) {
    opacity: 0.55;
    pointer-events: none;
}

/* Accordion header */
.s45-acc-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.s45-acc-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.s45-acc-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-sable, #E5E1D8);
    color: var(--color-rose, #8A857D);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
    transition: background 200ms ease, color 200ms ease;
}

.s45-acc-section.active .s45-acc-dot {
    background: var(--color-sauge, #7A8B6F);
    color: #fff;
}

.s45-acc-dot.completed {
    background: var(--color-sauge, #7A8B6F);
    color: #fff;
}

.s45-acc-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-brun, #2C2A26);
    margin: 0;
}

.s45-acc-summary {
    font-size: 11px;
    color: var(--color-rose, #8A857D);
    margin: 2px 0 0;
}

.s45-acc-summary:empty {
    display: none;
}

.s45-acc-chevron {
    color: var(--color-rose, #8A857D);
    font-size: 14px;
    transition: transform 200ms ease;
    flex-shrink: 0;
}

.s45-acc-section.active .s45-acc-chevron {
    transform: rotate(180deg);
}

/* Accordion body */
.s45-acc-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 0;
    overflow: hidden;
    padding: 0 14px;
    opacity: 0;
    transition: max-height 300ms ease, padding 300ms ease, opacity 200ms ease;
}

.s45-acc-section.active .s45-acc-body {
    max-height: 600px;
    padding: 4px 14px 14px;
    opacity: 1;
}

/* Accordion continue button */
button.s45-acc-continue {
    width: 100%;
    padding: 10px;
    background: var(--color-sauge, #7A8B6F)!important;;
    color: #fff!important;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 200ms ease;
    margin-top: 2px;
}

.s45-acc-continue:hover {
    background: var(--color-sauge-d, #5C7A5E);
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .s45-contact-modal {
        padding: 24px 18px;
        border-radius: 6px;
    }

    .s45-dispos-grid {
        grid-template-columns: 1fr;
    }

    .s45-step-nav {
        flex-direction: column-reverse;
    }

    .s45-step-prev {
        text-align: center;
    }
}
