/* ============================================================
   EternOne — Feuille de style
   Minimaliste, chaleureux, adapté au contexte émotionnel
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --color-bg:           #f5f4f0;
    --color-surface:      #ffffff;
    --color-primary:      #4a739b;
    --color-primary-dark: #3a5f83;
    --color-primary-light:#edf2f7;
    --color-text:         #2d3748;
    --color-text-muted:   #718096;
    --color-border:       #e2e8f0;
    --color-error:        #c53030;
    --color-error-bg:     #fff5f5;
    --color-error-border: #feb2b2;
    --color-success:      #276749;
    --color-success-bg:   #f0fff4;
    --color-success-border:#9ae6b4;
    --color-required:     #c53030;

    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  20px;

    --shadow-sm:  0 1px 4px rgba(0, 0, 0, 0.07);
    --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.09);

    --transition: 0.2s ease;
    --max-width:  680px;
    --font:       'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html                   { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: var(--font);
    background:  var(--color-bg);
    color:       var(--color-text);
    line-height: 1.65;
    min-height:  100vh;
    -webkit-font-smoothing: antialiased;
}

/* Accessibilité : focus visible */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Classe utilitaire pour lecteurs d'écran uniquement */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* ── Mise en page ───────────────────────────────────────────── */
.container {
    max-width: var(--max-width);
    margin:    0 auto;
    padding:   0 1.25rem;
}

/* ── En-tête ────────────────────────────────────────────────── */
.site-header {
    background:    var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding:       1.25rem 0;
    text-align:    center;
}

.logo {
    display:         inline-block;
    text-decoration: none;
    line-height:     0;
}

.logo__img {
    height:     56px;
    width:      auto;
    max-width:  240px;
    object-fit: contain;
    transition: opacity var(--transition);
}
.logo:hover .logo__img { opacity: 0.85; }

.header-tagline {
    font-size:  0.875rem;
    color:      var(--color-text-muted);
    margin-top: 0.2rem;
}

/* ── Contenu principal ──────────────────────────────────────── */
.main-content { padding: 2.5rem 0 5rem; }

/* ── Stepper ────────────────────────────────────────────────── */
.stepper       { margin-bottom: 2.5rem; }

.stepper__list {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    list-style:      none;
    position:        relative;
}

/* Ligne de connexion entre les cercles */
.stepper__list::before {
    content:    '';
    position:   absolute;
    top:        1.25rem;
    left:       calc(10% + 0.5rem);
    right:      calc(10% + 0.5rem);
    height:     2px;
    background: var(--color-border);
    z-index:    0;
}

.stepper__item {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    gap:             0.45rem;
    position:        relative;
    z-index:         1;
    flex:            1;
}

.stepper__number {
    width:       2.5rem;
    height:      2.5rem;
    border-radius: 50%;
    display:     flex;
    align-items: center;
    justify-content: center;
    font-size:   0.875rem;
    font-weight: 700;
    background:  var(--color-surface);
    border:      2px solid var(--color-border);
    color:       var(--color-text-muted);
    transition:  background var(--transition), border-color var(--transition), color var(--transition);
}

.stepper__label {
    font-size:   0.75rem;
    color:       var(--color-text-muted);
    font-weight: 500;
    transition:  color var(--transition);
    white-space: nowrap;
}

/* Étape active */
.stepper__item.active .stepper__number {
    background:   var(--color-primary);
    border-color: var(--color-primary);
    color:        #fff;
    box-shadow:   0 0 0 4px var(--color-primary-light);
}
.stepper__item.active .stepper__label {
    color:       var(--color-primary);
    font-weight: 700;
}

/* Étape complétée */
.stepper__item.completed .stepper__number {
    background:   var(--color-primary-light);
    border-color: var(--color-primary);
    color:        var(--color-primary);
}
.stepper__item.completed .stepper__label { color: var(--color-primary); }

/* Barre de progression */
.stepper__progress {
    margin-top:    1rem;
    height:        4px;
    background:    var(--color-border);
    border-radius: 99px;
    overflow:      hidden;
}

.stepper__progress-bar {
    height:        100%;
    background:    var(--color-primary);
    border-radius: 99px;
    transition:    width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    width:         0%;
}

/* ── Carte ──────────────────────────────────────────────────── */
.card {
    background:    var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow:    var(--shadow-md);
    border:        1px solid var(--color-border);
    overflow:      hidden;
}

.card--success {
    border-color:  var(--color-success-border);
    box-shadow:    0 4px 20px rgba(39, 103, 73, 0.1);
}

.card__header {
    padding:       2rem 2rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.card__title {
    font-size:   1.375rem;
    font-weight: 700;
    color:       var(--color-text);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.card__subtitle {
    font-size: 0.9375rem;
    color:     var(--color-text-muted);
    line-height: 1.5;
}

.card__body {
    padding:        1.75rem 2rem;
    display:        flex;
    flex-direction: column;
    gap:            1.375rem;
}

.card__footer {
    padding:         1.25rem 2rem 1.75rem;
    border-top:      1px solid var(--color-border);
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             1rem;
    background:      #fafafa;
}

.text-center { text-align: center; }

/* ── Étapes - affichage/masquage ────────────────────────────── */
.form-step         { display: none; }
.form-step.active  { display: block; }

/* ── Ligne de formulaire ─────────────────────────────────────── */
.form-row {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   1rem;
}

/* ── Groupe de champ ─────────────────────────────────────────── */
.form-group {
    display:        flex;
    flex-direction: column;
    gap:            0.4rem;
}

.form-label {
    font-size:   0.9375rem;
    font-weight: 600;
    color:       var(--color-text);
}

.required { color: var(--color-required); margin-left: 2px; }

.optional {
    font-size:   0.8125rem;
    font-weight: 400;
    color:       var(--color-text-muted);
}

/* ── Inputs & textarea ──────────────────────────────────────── */
.form-input,
.form-textarea {
    width:       100%;
    padding:     0.8125rem 1rem;
    font-size:   1rem;
    font-family: inherit;
    line-height: 1.5;
    border:      1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background:  #fff;
    color:       var(--color-text);
    transition:  border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline:     none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: #a0aec0; }

.form-input:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(74, 115, 155, 0.15);
}

.form-input.error,
.form-textarea.error {
    border-color: var(--color-error);
    background:   var(--color-error-bg);
}
.form-input.error:focus,
.form-textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.12);
}

/* Forcer la date à pleine largeur (certains navigateurs la réduisent) */
input[type="date"].form-input { width: 100%; }

.form-textarea {
    resize:     vertical;
    min-height: 130px;
}

.form-error {
    font-size:   0.8125rem;
    color:       var(--color-error);
    font-weight: 500;
    min-height:  1.1em;
    display:     block;
}

.form-hint {
    font-size: 0.8125rem;
    color:     var(--color-text-muted);
}

.char-count {
    font-size:  0.8125rem;
    color:      var(--color-text-muted);
    text-align: right;
}

/* ── Groupe d'input avec préfixe (URL) ──────────────────────── */
.input-group {
    display:      flex;
    align-items:  stretch;
    border:       1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow:     hidden;
    transition:   border-color var(--transition), box-shadow var(--transition);
}

.input-group:focus-within {
    border-color: var(--color-primary);
    box-shadow:   0 0 0 3px rgba(74, 115, 155, 0.15);
}

.input-group.error              { border-color: var(--color-error); }
.input-group.error:focus-within { box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.12); }

.input-group__prefix,
.input-group__suffix {
    padding:         0.8125rem 0.9rem;
    background:      #f7f8fa;
    color:           var(--color-text-muted);
    font-size:       0.9375rem;
    white-space:     nowrap;
    user-select:     none;
    display:         flex;
    align-items:     center;
    flex-shrink:     0;
}

.input-group__prefix { border-right: 1.5px solid var(--color-border); }
.input-group__suffix { border-left:  1.5px solid var(--color-border); }

.input-group .form-input {
    border:        none;
    border-radius: 0;
    box-shadow:    none;
    flex:          1;
    min-width:     0;
}

.input-group .form-input:focus { box-shadow: none; border-color: transparent; }

/* ── Cases à cocher ─────────────────────────────────────────── */
fieldset.checkboxes {
    border:  none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap:     0.25rem;
}

.checkbox-item {
    display:        flex;
    flex-direction: column;
    gap:            0.2rem;
    padding-bottom: 0.75rem;
    border-bottom:  1px solid var(--color-border);
}
.checkbox-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.checkbox-label {
    display:     flex;
    align-items: flex-start;
    gap:         0.75rem;
    cursor:      pointer;
    padding:     0.25rem 0;
}

.checkbox-input { display: none; }

.checkbox-custom {
    flex-shrink:   0;
    width:         1.25rem;
    height:        1.25rem;
    border-radius: 4px;
    border:        2px solid var(--color-border);
    background:    #fff;
    margin-top:    0.15rem;
    transition:    background var(--transition), border-color var(--transition);
    position:      relative;
}

.checkbox-input:checked + .checkbox-custom {
    background:   var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-input:checked + .checkbox-custom::after {
    content:      '';
    position:     absolute;
    top:          2px;
    left:         5px;
    width:        5px;
    height:       9px;
    border:       2px solid #fff;
    border-top:   none;
    border-left:  none;
    transform:    rotate(45deg);
}

.checkbox-custom.error { border-color: var(--color-error); }
.checkbox-text         { font-size: 0.9375rem; line-height: 1.55; }
.form-link             { color: var(--color-primary); text-decoration: underline; font-weight: 500; }
.form-link:hover       { color: var(--color-primary-dark); }

/* ── Boutons ────────────────────────────────────────────────── */
.card__actions {
    display:         flex;
    gap:             0.75rem;
    align-items:     center;
    justify-content: flex-end;
    flex-wrap:       wrap;
}

.btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             0.35rem;
    padding:         0.75rem 1.75rem;
    border-radius:   var(--radius-sm);
    font-size:       0.9375rem;
    font-weight:     600;
    font-family:     inherit;
    cursor:          pointer;
    border:          none;
    transition:      background var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
    white-space:     nowrap;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

/* Primaire (bleu) */
.btn--primary            { background: var(--color-primary); color: #fff; }
.btn--primary:hover      { background: var(--color-primary-dark); box-shadow: 0 2px 8px rgba(74,115,155,0.35); }

/* Fantôme (gris) */
.btn--ghost              { background: transparent; color: var(--color-text-muted); border: 1.5px solid var(--color-border); }
.btn--ghost:hover        { background: #f7f8fa; color: var(--color-text); }

/* Envoi final (vert) */
.btn--submit             { background: #276749; color: #fff; padding: 0.85rem 2rem; font-size: 1rem; }
.btn--submit:hover       { background: #1e5036; box-shadow: 0 2px 8px rgba(39,103,73,0.3); }

.btn:disabled            { opacity: 0.6; cursor: not-allowed; pointer-events: none; }

/* ── Texte rassurant ────────────────────────────────────────── */
.reassurance {
    display:     flex;
    align-items: center;
    gap:         0.45rem;
    font-size:   0.8125rem;
    color:       var(--color-text-muted);
    max-width:   55%;
    line-height: 1.45;
}
.reassurance__icon { font-size: 1rem; flex-shrink: 0; }

/* ── Récapitulatif (étape 5) ─────────────────────────────────── */
.summary {
    background:    var(--color-primary-light);
    border:        1px solid #bee3f8;
    border-radius: var(--radius-md);
    padding:       1.25rem 1.5rem;
    font-size:     0.9375rem;
    margin-bottom: 0.5rem;
}

.summary-section { margin-bottom: 1rem; }
.summary-section:last-child { margin-bottom: 0; }

.summary-section h3 {
    font-size:       0.75rem;
    text-transform:  uppercase;
    letter-spacing:  0.8px;
    color:           var(--color-primary-dark);
    margin-bottom:   0.35rem;
    font-weight:     700;
}

.summary-section p       { color: var(--color-text); margin: 0.1rem 0; }
.summary-section .muted  { color: var(--color-text-muted); font-size: 0.875rem; }

/* ── Erreur globale ──────────────────────────────────────────── */
#globalError {
    color:         var(--color-error);
    background:    var(--color-error-bg);
    border:        1px solid var(--color-error-border);
    border-radius: var(--radius-sm);
    padding:       0.75rem 1rem;
    font-size:     0.9375rem;
    width:         100%;
}

/* ── Message de succès ───────────────────────────────────────── */
.form-success[hidden] { display: none; }
.form-success         { display: block; }

.success-icon {
    width:           3.75rem;
    height:          3.75rem;
    background:      var(--color-success-bg);
    border:          2px solid var(--color-success-border);
    border-radius:   50%;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       1.75rem;
    color:           var(--color-success);
    margin:          0 auto 1.25rem;
}

.form-success h2 {
    font-size:     1.375rem;
    margin-bottom: 0.6rem;
    color:         var(--color-success);
}
.form-success p       { color: var(--color-text-muted); max-width: 460px; margin: 0 auto 0.5rem; }
.form-success .success-note {
    font-size:   0.875rem;
    color:       var(--color-text-muted);
    font-style:  italic;
    margin-top:  0.75rem;
}

/* ── Pied de page ───────────────────────────────────────────── */
.site-footer {
    text-align:  center;
    padding:     1.5rem 0;
    font-size:   0.875rem;
    color:       var(--color-text-muted);
    border-top:  1px solid var(--color-border);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .card__header  { padding: 1.5rem 1.25rem 1.25rem; }
    .card__body    { padding: 1.25rem; gap: 1.125rem; }
    .card__footer  { padding: 1.125rem 1.25rem 1.5rem; flex-direction: column; align-items: stretch; }
    .card__actions { justify-content: stretch; }
    .btn           { width: 100%; justify-content: center; }

    .reassurance   { max-width: 100%; }
    .stepper__label { display: none; }
    .stepper__list::before {
        left:  calc(10% + 0.3rem);
        right: calc(10% + 0.3rem);
    }
}
