:root {
    --color-primary: #4a5a3f;
    --color-primary-dark: #333f2c;
    --color-accent: #b3843c;
    --color-accent-dark: #8f6626;
    --color-bg: #faf7f1;
    --color-bg-alt: #f1ece1;
    --color-surface: #ffffff;
    --color-text: #2c2a26;
    --color-text-light: #5f5a52;
    --color-border: #e4ddd0;
    --color-success: #3f7d4e;
    --color-danger: #a23b2f;
    --font-heading: 'Cinzel', Georgia, serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-serif: 'Lora', Georgia, serif;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 6px 18px rgba(0,0,0,0.12);
    --max-width: 1080px;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip; /* filet de sécurité anti-débordement horizontal (mobile) — n'affecte pas le sticky */
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-primary-dark);
    line-height: 1.2;
}

a { color: var(--color-accent-dark); }

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.25rem;
    box-sizing: border-box;
}

/* Sticky footer : #app en colonne pleine hauteur et main extensible → le footer reste au bas
   de la page et ne "saute" pas quand le catalogue se charge (réduit fortement le CLS). */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main {
    flex: 1 0 auto;
}

/* --- Loading splash --- */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 1rem;
    color: var(--color-text-light);
    font-family: var(--font-body);
}
.app-loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Contenu de repli indexable (SEO) affiché brièvement au chargement, avant que Blazor
   ne remplace #app. Discret mais réellement présent dans le DOM (non masqué). */
.app-seo {
    max-width: 640px;
    margin: 0.5rem auto 0;
    padding: 0 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text-light);
}
.app-seo h1 {
    font-family: var(--font-heading, var(--font-body));
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}
.app-seo p { margin: 0.4rem 0; }

/* --- Spinner (indicateur de chargement, fiable sur tous navigateurs mobiles) --- */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

/* --- Header --- */
.site-header {
    background: var(--color-primary-dark);
    color: #fff;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 20;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    gap: 1rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
}
.brand img { height: 44px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-heading); font-size: 1.15rem; letter-spacing: 0.5px; }
.brand-text span { font-size: 0.72rem; opacity: 0.8; font-family: var(--font-body); }
.header-contact { font-size: 0.82rem; opacity: 0.9; text-align: right; }
.header-contact a { color: #fff; text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 1.25rem; }
.header-auth { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; white-space: nowrap; }
.header-auth span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.header-auth a { color: #fff; text-decoration: underline; cursor: pointer; }

/* Sélecteur de langue FR/EN */
.lang-switch { display: inline-flex; align-items: center; gap: 0.2rem; }
.lang-switch button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.1rem 0.2rem;
    opacity: 0.7;
    text-decoration: none;
}
.lang-switch button.active { font-weight: 700; opacity: 1; text-decoration: underline; }
.lang-switch button:hover { opacity: 1; }
.lang-switch .lang-sep { opacity: 0.5; }
.header-auth .lang-switch span { max-width: none; }

/* --- Hero --- */
.hero {
    background: linear-gradient(rgba(51,63,44,0.72), rgba(51,63,44,0.82)),
                url('/images/2019/08/30729530_2103038863044916_1272104093996810240_o.webp') center/cover;
    color: #fff;
    padding: 3.5rem 0;
    text-align: center;
}
.hero h1 { color: #fff; font-size: 2.2rem; margin: 0 0 0.75rem; }
.hero p { max-width: 720px; margin: 0 auto; font-family: var(--font-serif); font-size: 1.05rem; opacity: 0.95; }

/* --- Sections --- */
.section { padding: 2.5rem 0; }
.section-heading { text-align: center; margin-bottom: 2rem; }
.section-heading h2 { font-size: 1.7rem; margin: 0; }

/* --- Chantier cards --- */
.chantier {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 2rem;
}
.chantier-body { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1.5rem; padding: 1.5rem; }
.chantier h3 { font-size: 1.3rem; margin: 0 0 0.75rem; }
.chantier-desc p { color: var(--color-text-light); font-size: 0.94rem; line-height: 1.65; margin: 0 0 0.7rem; }
.chantier-meta { font-size: 0.82rem; color: var(--color-accent-dark); font-weight: 600; margin-top: 0.5rem; }
.chantier-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; align-content: start; }
.chantier-gallery img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; }
.chantier-gallery img:first-child { grid-column: 1 / -1; height: 190px; }

/* Carte sans galerie (site des week-ends, ou chantier sans visuel) : le texte occupe toute la
   largeur au lieu de laisser une colonne vide, et la carte est resserrée — ces annonces sont
   courtes et se lisent d'un coup d'œil. */
.chantier--sans-images { margin-bottom: 1.25rem; }
.chantier--sans-images .chantier-body { grid-template-columns: 1fr; padding: 1.25rem 1.5rem; }
.chantier--sans-images h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.chantier--sans-images .chantier-desc p { max-width: 70ch; }
.chantier--sans-images .sessions { margin-top: 1.1rem; }

/* --- Sessions --- */
.sessions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    flex-wrap: wrap;
}
.session-dates { font-weight: 600; font-size: 0.9rem; }
.session-info { font-size: 0.8rem; color: var(--color-text-light); }
.session-right { display: flex; align-items: center; gap: 0.75rem; }

/* Session complète ou terminée : grisée dans le catalogue. */
.session-row--closed { opacity: 0.6; }
.badge { font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 999px; }
.badge-ok { background: #e5f0e6; color: var(--color-success); }
.badge-low { background: #fbeede; color: var(--color-accent-dark); }
.badge-full { background: #f4dedb; color: var(--color-danger); }
.badge-soon { background: var(--color-bg-alt); color: var(--color-text-light); }

.price { font-family: var(--font-heading); font-weight: 600; color: var(--color-primary-dark); }

/* --- Buttons (fallback, Fluent handles most) --- */
.btn-appear { text-decoration: none; }

/* --- Info cards --- */
.info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.info-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.info-card .icon { font-size: 1.8rem; }
.info-card h4 { font-family: var(--font-heading); color: var(--color-primary-dark); margin: 0.5rem 0; }
.info-card p { font-size: 0.88rem; color: var(--color-text-light); margin: 0; line-height: 1.5; }

/* --- Forms / panels --- */
.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    max-width: 640px;
    margin: 0 auto;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.summary-box {
    background: var(--color-bg-alt);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.summary-box .stage-title { font-family: var(--font-heading); color: var(--color-primary-dark); font-size: 1.1rem; }

/* --- Enfants accompagnants (stages « famille ») --- */
.children-box {
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    background: var(--color-bg-alt);
}
.children-head { display: flex; flex-direction: column; gap: 0.15rem; }
/* Chaque enfant = une sous-carte regroupant identité et données statistiques. */
.child-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.75rem 0.85rem;
    background: var(--color-surface, #fff);
    margin-top: 0.6rem;
}
.child-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.child-card-title { font-size: 0.9rem; color: var(--color-text-light); }
.child-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 0.75rem;
    align-items: end;
}
.child-full { grid-column: 1 / -1; }
.child-auto-category {
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    background: var(--color-bg-alt);
    font-size: 0.82rem;
}
@media (max-width: 520px) {
    .child-grid { grid-template-columns: 1fr; }
}

/* --- Callouts (encadrés info / succès / avertissement) — compacts et lisibles sur mobile --- */
.callout {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-alt);
    font-size: 0.9rem;
    line-height: 1.55;
    text-align: left;
}
.callout .callout-ic { flex: 0 0 auto; font-size: 1.15rem; line-height: 1.4; }
.callout-info { background: #eef2f7; border-color: #d3dce6; }
.callout-success { background: #e5f0e6; border-color: #c3dcc6; color: var(--color-success); }
.callout-warn { background: #fbeeea; border-color: #e6bfb2; }

/* --- Footer --- */
.site-footer {
    background: var(--color-primary-dark);
    color: rgba(255,255,255,0.85);
    padding: 1.75rem 0;
    margin-top: 3rem;
    font-size: 0.85rem;
}
.site-footer a { color: rgba(255,255,255,0.85); }

/* --- Status pages --- */
.status-page { text-align: center; padding: 3rem 1.75rem; }
.status-icon { font-size: 3.5rem; }

/* --- Étape d'attestation de cotisation REMPART (parcours d'inscription) --- */
.attestation-step {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary-dark);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    background: var(--color-bg-alt);
}
.attestation-step .attestation-icon { font-size: 2.5rem; line-height: 1; }
.attestation-step h3 { font-family: var(--font-heading); color: var(--color-primary-dark); margin: 0.4rem 0 0.6rem; }
.attestation-check {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    background: var(--color-bg);
}

/* --- « Mes inscriptions » : cartes homogènes, mobile-first --- */
.mes-insc-list { display: flex; flex-direction: column; gap: 0.8rem; align-items: stretch; }
.mes-insc-card {
    /* Neutralise le max-width/margin:auto de .panel qui, en flex-column, dimensionnait chaque
       carte à son contenu (largeurs inégales). Toutes les cartes occupent la pleine largeur. */
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    align-items: center;
    justify-content: space-between;
}
.mes-insc-main { flex: 1 1 220px; min-width: 0; }
.mes-insc-status { white-space: nowrap; font-weight: 600; }
.mes-insc-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Sous 560 px : la carte s'empile, les actions passent en pleine largeur. */
@media (max-width: 560px) {
    .mes-insc-card { flex-direction: column; align-items: stretch; }
    .mes-insc-status { align-self: flex-start; }
    .mes-insc-actions { width: 100%; }
    .mes-insc-actions fluent-button { width: 100%; }
    .mes-insc-actions fluent-button::part(control) { width: 100%; }
}

.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.muted { color: var(--color-text-light); }

/* --- Blazor error UI --- */
#blazor-error-ui {
    background: #fde2c8;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

@media (max-width: 820px) {
    .chantier-body { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .site-header .container { flex-wrap: wrap; }
    .header-right { flex-direction: column; align-items: flex-start; gap: 0.4rem; width: 100%; }
    .header-contact { text-align: left; }
    .header-auth { flex-wrap: wrap; white-space: normal; }
    .header-auth span { max-width: 100%; }
}
