/*
 * Thème « CMS officiel » : repris du thème par défaut des pages de profil du CMS (pm.ggio.link) —
 * bleu Material #42A5F5, Roboto, carte surélevée, boutons à 2px, ombres en couches, fond en dégradé
 * avec des points flottants.
 *
 * C'est le SEUL endroit où sont définis couleurs, polices, rayons et ombres. Les autres feuilles
 * (nav.css, dossier.css, form.css) n'utilisent que var(--…) : pour changer de thème, on ne touche qu'ici.
 *
 * Roboto est hébergée localement (assets/fonts) : aucune requête vers un site tiers.
 */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/roboto-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/roboto-latin-500-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/roboto-latin-700-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Couleurs du CMS */
    --color-primary: #42A5F5;
    --color-primary-hover: #2196F3;
    --color-primary-dark: #1E88E5;
    --color-primary-light: #64B5F6;
    --color-primary-lighter: #90CAF9;
    --color-primary-lightest: #BBDEFB;
    --color-on-primary: #FFFFFF;
    --color-text: #212121;
    --color-text-muted: #757575;
    --color-surface: #FFFFFF;
    --color-divider: #EEEEEE;

    /* Ajouts pour ce projet (même famille de bleus). Le #42A5F5 du CMS ne fait que 2,5:1 sur blanc :
       pour du TEXTE bleu (liens, libellés) on utilise #1976D2 (4,6:1, norme WCAG AA). */
    --color-primary-text: #1976D2;
    --color-surface-tint: #F7FAFD;
    --color-hover-bg: rgba(66, 165, 245, 0.12);
    --color-field-border: #BDBDBD;
    --color-focus-ring: rgba(66, 165, 245, 0.35);
    --color-danger: #D32F2F;
    --color-danger-hover: #C62828;
    --color-on-danger: #FFFFFF;
    --color-danger-bg: #FDECEA;
    --color-danger-text: #B71C1C;
    --color-danger-border: #EF9A9A;
    --color-icon-disabled: #BDBDBD;
    --color-highlight: #E3F2FD;

    /* Fonds */
    --gradient-page: linear-gradient(160deg, #EAF3FC 0%, #F7FAFD 55%, #FFFFFF 100%);
    --gradient-banner: linear-gradient(120deg, #1E88E5, #42A5F5 55%, #64B5F6);

    /* Menu en tuiles de l'accueil (personne connectée) : un fond par grande tuile, une couleur d'en-tête par carte.
       Le texte blanc reste lisible (au moins 4,5:1) sur chacune. */
    --gradient-tile-espace: linear-gradient(120deg, #0D47A1, #1E88E5);
    --gradient-tile-sante: linear-gradient(120deg, #8F3A00, #C75B00);
    --color-card-gerer: #00796B;
    --color-card-partages: #6A4C93;
    --color-card-compte: #455A64;
    --color-on-tile: #FFFFFF;

    /* Formes */
    --radius-card: 24px;
    --radius-tile: 12px;
    --radius-button: 2px;
    --radius-field: 4px;

    /* Ombres (carte et boutons du CMS) */
    --shadow-card: 0 2px 4px rgba(33, 33, 33, 0.06), 0 12px 24px rgba(33, 33, 33, 0.08), 0 32px 64px rgba(33, 150, 243, 0.12);
    --shadow-button: 0 2px 5px rgba(66, 165, 245, 0.4), 0 1px 2px rgba(33, 33, 33, 0.12);
    --shadow-button-hover: 0 8px 16px rgba(66, 165, 245, 0.45), 0 2px 4px rgba(33, 33, 33, 0.14);
    --shadow-button-active: 0 1px 3px rgba(66, 165, 245, 0.4);
    --shadow-bar: 0 -8px 16px rgba(33, 33, 33, 0.06);
    --shadow-tile: 0 1px 3px rgba(33, 33, 33, 0.08);
    --shadow-tile-hover: 0 6px 14px rgba(66, 165, 245, 0.25), 0 2px 4px rgba(33, 33, 33, 0.1);

    /* Texte */
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Base ---------------------------------------------------------------------- */

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 32px 16px;
    background: var(--gradient-page);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: 500;
    color: var(--color-text);
}

a {
    color: var(--color-primary-text);
}

a:hover {
    color: var(--color-primary-dark);
}

/* ---- Points flottants en arrière-plan (comme le CMS) ----------------------------- */

.dots-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.dot {
    position: absolute;
    border-radius: 50%;
    opacity: 0.35;
    animation: dotFloat 9s infinite ease-in-out;
}

.dot--1 { width: 140px; height: 140px; top: 8%; left: 6%; background: var(--color-primary-lighter); animation-delay: 0s; }
.dot--2 { width: 90px; height: 90px; top: 65%; left: 10%; background: var(--color-primary); animation-delay: 1.2s; }
.dot--3 { width: 60px; height: 60px; top: 20%; left: 85%; background: var(--color-primary-light); animation-delay: 2.4s; }
.dot--4 { width: 180px; height: 180px; top: 72%; left: 82%; background: var(--color-primary-lightest); animation-delay: 0.6s; }
.dot--5 { width: 40px; height: 40px; top: 45%; left: 92%; background: var(--color-primary); animation-delay: 3s; }
.dot--6 { width: 70px; height: 70px; top: 85%; left: 40%; background: var(--color-primary-lighter); animation-delay: 1.8s; }

@keyframes dotFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-22px) scale(1.06); }
}

/* ---- Carte principale ------------------------------------------------------------ */

.page {
    max-width: 960px;
    margin: 0 auto;
}

.page-card {
    background: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

/* La carte ne coupe plus ce qui dépasse (liste déroulante des langues) : le contenu garde ses coins arrondis ici */
.page-content {
    overflow: hidden;
    overflow: clip; /* comme hidden, mais ne crée pas de zone de défilement : la barre d'actions des formulaires peut rester collée à l'écran */
    border-radius: 0 0 var(--radius-card) var(--radius-card);
}

/* Bandeau dégradé en haut de la carte (rappel du bandeau du profil CMS) */
.page-card::before {
    content: '';
    display: block;
    height: 8px;
    background: var(--gradient-banner);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

/* Contenu simple (page d'accueil, messages…) */
.page-section {
    padding: 48px 24px;
}

/* ---- Boutons (Bootstrap) : boutons « surélevés » Material du CMS -------------------- */

.btn {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.4;
    padding: 0.65rem 1.1rem;
    border: 0;
    border-radius: var(--radius-button);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:focus-visible {
    outline: 3px solid var(--color-primary-text);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: transparent;
    color: var(--color-on-primary);
    box-shadow: var(--shadow-button);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-hover);
    border-color: transparent;
    color: var(--color-on-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-button-hover);
}

.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.btn-primary:not(:disabled):not(.disabled):active:focus {
    background-color: var(--color-primary-dark);
    border-color: transparent;
    color: var(--color-on-primary);
    transform: none;
    box-shadow: var(--shadow-button-active);
}

.btn-danger {
    background-color: var(--color-danger);
    border-color: transparent;
    color: var(--color-on-danger);
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:not(:disabled):not(.disabled):active {
    background-color: var(--color-danger-hover);
    border-color: transparent;
    color: var(--color-on-danger);
}

.btn-link {
    color: var(--color-primary-text);
}

/* ---- Formulaires ------------------------------------------------------------------ */

label,
.form-label {
    font-weight: 500;
    color: var(--color-text);
}

.form-control {
    font-family: var(--font-family);
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-field-border);
    border-radius: var(--radius-field);
}

.form-control:focus {
    color: var(--color-text);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
    outline: 0;
}

.form-control::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.alert-inline {
    display: inline-block;
}

.alert-danger {
    color: var(--color-danger-text);
    background-color: var(--color-danger-bg);
    border: 0;
    border-left: 4px solid var(--color-danger);
    border-radius: var(--radius-field);
}

/* ---- Fil d'Ariane ------------------------------------------------------------------ */

.breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--color-text-muted);
}

.breadcrumb-item.active {
    color: var(--color-text);
    font-weight: 500;
}

/* ---- Page d'accueil ----------------------------------------------------------------- */

.home-hero {
    padding: 56px 24px 32px;
    text-align: center;
}

.home-hero h1 {
    margin: 0 0 12px;
    font-size: 2.625rem;
    font-weight: 700;
    line-height: 1.15;
}

.home-lead {
    margin: 0 0 24px;
    font-size: 1.125rem;
    color: var(--color-text-muted);
}

.home-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.home-cta .btn {
    min-width: 220px;
    padding: 0.75rem 2rem;
    font-size: 1.0625rem;
}

.btn-outline-primary {
    background-color: transparent;
    border: 2px solid var(--color-primary-text);
    color: var(--color-primary-text);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--color-hover-bg);
    border-color: var(--color-primary-text);
    color: var(--color-primary-text);
}

.home-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 24px 56px;
}

.home-tile {
    padding: 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-tile);
    box-shadow: var(--shadow-tile);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-tile-hover);
}

.home-tile img,
.home-tile svg {
    display: block;
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    color: var(--color-primary-dark);
}

.home-tile h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 500;
}

.home-tile p {
    margin: 0;
    color: var(--color-text-muted);
}

@media (max-width: 576px) {
    .home-hero h1 {
        font-size: 2rem;
    }

    .home-tiles {
        grid-template-columns: 1fr;
    }
}

/* ---- Mobile ------------------------------------------------------------------------ */

@media (max-width: 576px) {
    body {
        padding: 12px 8px;
    }

    .page-card {
        border-radius: 16px;
    }

    .dot { opacity: 0.22; }
}

/* ---- Animations : désactivées si l'utilisateur le demande ------------------------------ */

@media (prefers-reduced-motion: reduce) {
    .dot {
        animation: none;
    }

    .btn,
    .btn-primary:hover,
    .btn-primary:focus,
    .picto-et-texte,
    .picto-et-texte:hover,
    .home-tile,
    .home-tile:hover {
        transition: none;
        transform: none;
    }
}
