/* ============================================
   DESIGN SYSTEM DE L'ÉTAT FRANÇAIS (DSFR)
   Couleurs officielles Marianne
   ============================================ */

:root {
    --blue-france: #000091;
    --blue-france-hover: #1212FF;
    --blue-france-active: #2323FF;
    --red-marianne: #E1000F;
    --white: #FFFFFF;
    --grey-50: #F6F6F6;
    --grey-100: #EEEEEE;
    --grey-200: #DDDDDD;
    --grey-300: #CECECE;
    --grey-500: #929292;
    --grey-700: #3A3A3A;
    --grey-900: #161616;
    --success: #18753C;
    --error: #CE0500;
    --info: #0063CB;
    --warning: #B34000;
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.5rem;
    --spacing-6: 2rem;
    --spacing-8: 3rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Marianne', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--grey-50);
    color: var(--grey-900);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER OFFICIEL
   ============================================ */
.fr-header {
    background: var(--white);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    position: relative;
    z-index: 100;
}

.fr-header__body {
    padding: 1rem 0;
}

.fr-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.fr-header__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.fr-header__brand-top {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.fr-logo {
    font-size: 14px;
    line-height: 1.2;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--grey-900);
    position: relative;
    padding-left: 12px;
    border-left: 3px solid;
    border-image: linear-gradient(to bottom, #000091 33%, #FFFFFF 33%, #FFFFFF 66%, #E1000F 66%) 1;
    margin: 0;
}

.fr-header__service a {
    text-decoration: none;
    color: inherit;
}

.fr-header__service-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--grey-900);
    margin: 0;
}

.fr-header__service-tagline {
    font-size: 14px;
    color: var(--grey-700);
    margin: 2px 0 0 0;
}

/* ============================================
   STEPPER (Barre de progression)
   ============================================ */
.fr-stepper {
    background: var(--grey-50);
    padding: 1.5rem 0;
    border-top: 1px solid var(--grey-200);
}

.fr-stepper__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--grey-900);
    margin-bottom: 1rem;
}

.fr-stepper__state {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--grey-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.fr-stepper__steps {
    display: flex;
    gap: 4px;
    height: 6px;
}

.fr-stepper__steps__step {
    flex: 1;
    background: var(--grey-300);
    border-radius: 3px;
    transition: background 0.3s;
}

.fr-stepper__steps__step--active {
    background: var(--blue-france);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    flex: 1;
    padding: 3rem 0;
}

.fr-container--form {
    max-width: 720px;
}

/* ============================================
   FORMULAIRE DSFR
   ============================================ */
.fr-form {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-top: 4px solid var(--blue-france);
}

.fr-form__title {
    font-size: 24px;
    font-weight: 700;
    color: var(--grey-900);
    margin-bottom: 0.5rem;
}

.fr-form__subtitle {
    font-size: 14px;
    color: var(--grey-700);
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--grey-200);
}

.fr-fieldset {
    margin-bottom: 1.5rem;
    border: none;
    padding: 0;
}

.fr-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--grey-900);
    margin-bottom: 0.5rem;
}

.fr-label--required::after {
    content: " *";
    color: var(--red-marianne);
}

.fr-hint {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--grey-500);
    margin-top: 2px;
    margin-bottom: 6px;
}

.fr-input {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 16px;
    font-family: inherit;
    color: var(--grey-900);
    background: var(--white);
    border: none;
    border-bottom: 2px solid var(--grey-500);
    border-radius: 4px 4px 0 0;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.fr-input:hover {
    border-bottom-color: var(--grey-700);
}

.fr-input:focus {
    border-bottom-color: var(--blue-france);
    box-shadow: 0 2px 0 0 var(--blue-france);
}

.fr-input--error {
    border-bottom-color: var(--error) !important;
    box-shadow: 0 2px 0 0 var(--error) !important;
}

.fr-input-group--error {
    position: relative;
}

.fr-error-text {
    display: none;
    color: var(--error);
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.fr-input-group--error .fr-error-text {
    display: block;
}

.fr-input-group--valid .fr-input {
    border-bottom-color: var(--success);
}

/* Grid */
.fr-grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .fr-grid-row {
        grid-template-columns: 1fr;
    }
    .fr-form {
        padding: 1.5rem;
    }
}

/* ============================================
   BOUTONS DSFR
   ============================================ */
.fr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-height: 40px;
}

.fr-btn--primary {
    background: var(--blue-france);
    color: var(--white);
}

.fr-btn--primary:hover:not(:disabled) {
    background: var(--blue-france-hover);
}

.fr-btn--primary:active:not(:disabled) {
    background: var(--blue-france-active);
}

.fr-btn--secondary {
    background: transparent;
    color: var(--blue-france);
    box-shadow: inset 0 0 0 1px var(--blue-france);
}

.fr-btn--secondary:hover:not(:disabled) {
    background: var(--grey-50);
}

.fr-btn:disabled {
    background: var(--grey-300);
    color: var(--grey-500);
    cursor: not-allowed;
}

.fr-btn--lg {
    padding: 0.875rem 2rem;
    font-size: 18px;
    width: 100%;
}

.fr-btn--icon {
    font-size: 14px;
}

/* ============================================
   ALERTES DSFR
   ============================================ */
.fr-alert {
    padding: 1rem 1.25rem;
    border-radius: 0;
    border-left: 4px solid;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.fr-alert--info {
    background: #E8EDFF;
    border-left-color: var(--info);
    color: var(--grey-900);
}

.fr-alert--success {
    background: #B8FEC9;
    border-left-color: var(--success);
}

.fr-alert--error {
    background: #FFE9E6;
    border-left-color: var(--error);
}

.fr-alert__title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.fr-alert__desc {
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   MONTANT
   ============================================ */
.fr-callout {
    background: var(--white);
    border-left: 4px solid var(--blue-france);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.fr-callout__title {
    font-size: 14px;
    font-weight: 400;
    color: var(--grey-700);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fr-callout__amount {
    font-size: 42px;
    font-weight: 700;
    color: var(--blue-france);
    line-height: 1;
}

.fr-callout__amount small {
    font-size: 24px;
    font-weight: 500;
}

/* ============================================
   SECURE NOTICE
   ============================================ */
.fr-secure {
    background: #FEE7FC;
    border: 1px solid #A558A1;
    padding: 1rem;
    margin: 2rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 14px;
    color: var(--grey-900);
}

.fr-secure svg {
    flex-shrink: 0;
    color: var(--success);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 2rem;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--grey-200);
    border-top-color: var(--blue-france);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--grey-900);
    text-align: center;
}

.loading-subtext {
    font-size: 14px;
    color: var(--grey-500);
    margin-top: 0.5rem;
}

.loading-progress {
    width: 300px;
    max-width: 80%;
    height: 4px;
    background: var(--grey-200);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: var(--blue-france);
    width: 0%;
    transition: width 0.3s ease;
}

/* ============================================
   MERCI PAGE
   ============================================ */
.fr-success {
    background: var(--white);
    padding: 3rem 2rem;
    text-align: center;
    border-top: 4px solid var(--success);
    max-width: 720px;
    margin: 0 auto;
}

.fr-success__icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    font-size: 40px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.fr-success__title {
    font-size: 28px;
    font-weight: 700;
    color: var(--grey-900);
    margin-bottom: 1rem;
}

.fr-success__ref {
    background: var(--grey-50);
    padding: 1.5rem;
    margin: 2rem 0;
    border-left: 4px solid var(--blue-france);
}

.fr-success__ref-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--grey-700);
    margin-bottom: 0.5rem;
}

.fr-success__ref-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--blue-france);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* ============================================
   FOOTER
   ============================================ */
.fr-footer {
    background: var(--white);
    border-top: 2px solid var(--blue-france);
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.fr-footer__body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--grey-200);
    margin-bottom: 1.5rem;
}

.fr-footer__brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.fr-footer__content {
    font-size: 14px;
    color: var(--grey-700);
    line-height: 1.6;
    max-width: 600px;
}

.fr-footer__content p {
    margin-bottom: 0.5rem;
}

.fr-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 12px;
}

.fr-footer__bottom a {
    color: var(--grey-700);
    text-decoration: none;
}

.fr-footer__bottom a:hover {
    text-decoration: underline;
}

.fr-footer__bottom-copy {
    color: var(--grey-500);
}

/* ============================================
   HELP SECTION
   ============================================ */
.fr-accordion {
    background: var(--white);
    margin-top: 2rem;
    border: 1px solid var(--grey-200);
}

.fr-accordion__title {
    padding: 1rem 1.25rem;
    font-size: 16px;
    font-weight: 600;
    color: var(--grey-900);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.fr-accordion__title::after {
    content: "+";
    font-size: 20px;
    color: var(--blue-france);
    transition: transform 0.2s;
}

.fr-accordion.open .fr-accordion__title::after {
    transform: rotate(45deg);
}

.fr-accordion__content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1.25rem;
}

.fr-accordion.open .fr-accordion__content {
    max-height: 500px;
    padding: 0 1.25rem 1.25rem;
}

.fr-accordion__content p {
    font-size: 14px;
    color: var(--grey-700);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

/* ============================================
   CARD PREVIEW (Paiement)
   ============================================ */
.card-preview {
    background: linear-gradient(135deg, #000091 0%, #6A6AF4 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1.586 / 1;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0,0,145,0.3);
}

.card-preview::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.card-chip {
    width: 40px;
    height: 30px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 4px;
    position: relative;
}

.card-chip::after {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 2px;
}

.card-number {
    font-size: 20px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    font-weight: 500;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 12px;
}

.card-label {
    font-size: 9px;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 2px;
}

.card-value {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
}

.card-brand {
    font-size: 20px;
    font-weight: 700;
    font-style: italic;
}

/* ============================================
   UTILITIES
   ============================================ */
.fr-mt-2 { margin-top: 1rem; }
.fr-mt-3 { margin-top: 1.5rem; }
.fr-mt-4 { margin-top: 2rem; }
.fr-mb-2 { margin-bottom: 1rem; }
.fr-mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--grey-500); }