/*
 * Habillage KEYA du back-office (docs/backoffice/charte-keya.md §8.A, docs/backoffice/04-ui-ux.md §2),
 * chargé après les styles de Filament par AdminPanelProvider (render hook STYLES_AFTER).
 * Charte écrite pour Filament v3 : sélecteurs relus et adaptés aux classes `fi-*` de Filament 5.
 * Couleurs = rose KEYA / vert KEYA de la charte ; le rose domine, le vert ponctue.
 * Mode sombre désactivé (la charte n'a pas de palette sombre).
 */

:root {
    --keya-rose-50: #fdf2f7;
    --keya-rose-100: #fce7f1;
    --keya-rose-400: #f472ab;
    --keya-rose-500: #ec4189;
    --keya-rose-600: #e61873;
    --keya-rose-700: #c00f5c;
    --keya-rose-900: #841344;
    --keya-vert-400: #4db781;
    --keya-vert-500: #2a9c66;
    --keya-vert-600: #1c7e51;
    --keya-degrade: linear-gradient(135deg, var(--keya-rose-600) 0%, var(--keya-rose-500) 60%, var(--keya-rose-400) 100%);
    --keya-degrade-vert: linear-gradient(135deg, var(--keya-vert-600) 0%, var(--keya-vert-500) 55%, var(--keya-vert-400) 100%);
}

/* ---------- Fond général : halo rose en haut à droite, halo vert en bas à gauche ---------- */
.fi-body {
    background:
        radial-gradient(60rem 30rem at 100% -10%, rgba(230, 24, 115, 0.08), transparent 60%),
        radial-gradient(40rem 25rem at -10% 110%, rgba(42, 156, 102, 0.07), transparent 60%),
        #fdf8fb;
    background-attachment: fixed;
}

/* ---------- Pages simples (connexion, double authentification, invitation) ---------- */
.fi-simple-layout {
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.18) 0 8rem, transparent 8rem),
        radial-gradient(circle at 90% 92%, var(--keya-vert-500) 0 9rem, rgba(255, 255, 255, 0.15) 9rem 10rem, transparent 10rem),
        var(--keya-degrade);
}

.fi-simple-main {
    border-radius: 1.75rem !important;
    box-shadow: 0 30px 60px -20px rgba(132, 19, 68, 0.45) !important;
}

.fi-simple-header-heading {
    color: var(--keya-rose-600);
}

/* ---------- Barre latérale : panneau rose flottant ---------- */
@media (min-width: 1024px) {
    .fi-sidebar-nav {
        margin: 0.75rem;
        border-radius: 1.5rem;
        box-shadow: 0 20px 40px -18px rgba(230, 24, 115, 0.55);
    }
}

/* Le point vert (rappel des points du logo) est une couche de fond attachée à la fin du
   contenu défilant (background-attachment: local), dans la marge basse réservée : il ne
   chevauche jamais une entrée du menu. Aplat net : un vert flouté sur le rose virerait au gris. */
.fi-sidebar-nav {
    overflow-x: hidden;
    background:
        radial-gradient(circle at 100% 100%, var(--keya-vert-500) 0 3.25rem, rgba(255, 255, 255, 0.12) 3.25rem 4rem, transparent 4rem),
        linear-gradient(180deg, var(--keya-rose-600) 0%, var(--keya-rose-700) 100%);
    background-attachment: local;
    padding-bottom: 4.5rem !important;
    /* Filament réserve une gouttière de défilement permanente, que le fond ne couvre pas :
       elle n'apparaît que si le menu défile, avec une barre discrète */
    scrollbar-gutter: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

.fi-sidebar-nav .fi-sidebar-item-label,
.fi-sidebar-nav .fi-sidebar-item-icon,
.fi-sidebar-nav .fi-sidebar-group-btn .fi-icon {
    color: rgba(255, 255, 255, 0.92) !important;
}

.fi-sidebar-nav .fi-sidebar-group-label {
    color: rgba(255, 255, 255, 0.7) !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem !important;
}

.fi-sidebar-nav .fi-sidebar-group-collapse-btn,
.fi-sidebar-nav .fi-sidebar-group-collapse-btn .fi-icon {
    color: rgba(255, 255, 255, 0.7) !important;
}

.fi-sidebar-nav .fi-sidebar-item-btn {
    border-radius: 0.875rem !important;
}

.fi-sidebar-nav .fi-sidebar-item-btn:hover,
.fi-sidebar-nav .fi-sidebar-item-btn:focus-visible {
    background: rgba(255, 255, 255, 0.14) !important;
}

.fi-sidebar-nav .fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background: #fff !important;
    box-shadow: 0 8px 20px -8px rgba(80, 4, 37, 0.45);
}

.fi-sidebar-nav .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label,
.fi-sidebar-nav .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon {
    color: var(--keya-rose-600) !important;
}

.fi-sidebar-nav .fi-sidebar-item-grouped-border > div {
    background-color: rgba(255, 255, 255, 0.4) !important;
}

.fi-sidebar-nav .fi-badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    --tw-ring-color: rgba(255, 255, 255, 0.3) !important;
}

.fi-sidebar-nav .fi-sidebar-item.fi-active .fi-badge {
    background: var(--keya-vert-500) !important;
}

/* ---------- Titres de page : dégradé « Titre » ---------- */
.fi-header-heading {
    background: linear-gradient(90deg, var(--keya-rose-700), var(--keya-rose-500));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

/* ---------- Boutons principaux : dégradé « Bouton », s'élèvent au survol ---------- */
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-link) {
    background-image: linear-gradient(90deg, var(--keya-rose-600), var(--keya-rose-500));
    box-shadow: 0 10px 22px -10px rgba(230, 24, 115, 0.7);
    border-radius: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-link):hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px -10px rgba(230, 24, 115, 0.75);
}

/* ---------- Cartes : sections, tableaux, indicateurs ---------- */
.fi-section,
.fi-ta-ctn,
.fi-wi-stats-overview-stat {
    border-radius: 1.25rem !important;
}

.fi-section,
.fi-ta-ctn {
    box-shadow: 0 12px 30px -18px rgba(132, 19, 68, 0.25) !important;
}

/* Indicateurs du tableau de bord : par trois, rose plein / blanc liseré rose / vert plein.
   Filament 5 enveloppe chaque carte dans sa colonne de grille : l'alternance se compte sur elles. */
.fi-wi-stats-overview-stat {
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fi-wi-stats-overview-stat:hover {
    transform: translateY(-2px);
}

.fi-grid-col:nth-child(3n + 1) > .fi-sc-component > .fi-wi-stats-overview-stat,
.fi-grid-col:nth-child(3n) > .fi-sc-component > .fi-wi-stats-overview-stat {
    border: 0;
    --tw-ring-color: transparent !important;
}

.fi-grid-col:nth-child(3n + 1) > .fi-sc-component > .fi-wi-stats-overview-stat {
    background: var(--keya-degrade) !important;
    box-shadow: 0 16px 30px -16px rgba(230, 24, 115, 0.7) !important;
}

.fi-grid-col:nth-child(3n) > .fi-sc-component > .fi-wi-stats-overview-stat {
    background: var(--keya-degrade-vert) !important;
    box-shadow: 0 16px 30px -16px rgba(28, 126, 81, 0.6) !important;
}

.fi-grid-col:nth-child(3n + 1) > .fi-sc-component > .fi-wi-stats-overview-stat *,
.fi-grid-col:nth-child(3n) > .fi-sc-component > .fi-wi-stats-overview-stat * {
    color: #fff !important;
}

.fi-grid-col:nth-child(3n + 1) > .fi-sc-component > .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-label,
.fi-grid-col:nth-child(3n) > .fi-sc-component > .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-label,
.fi-grid-col:nth-child(3n + 1) > .fi-sc-component > .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-description,
.fi-grid-col:nth-child(3n) > .fi-sc-component > .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-description {
    color: rgba(255, 255, 255, 0.85) !important;
}

.fi-grid-col:nth-child(3n + 2) > .fi-sc-component > .fi-wi-stats-overview-stat {
    border-top: 4px solid var(--keya-rose-500);
}

.fi-grid-col:nth-child(3n + 2) > .fi-sc-component > .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-value {
    color: var(--keya-rose-600) !important;
}

.fi-wi-stats-overview-stat::after {
    content: '';
    position: absolute;
    top: -2.5rem;
    right: -2.5rem;
    width: 7rem;
    height: 7rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.14);
    pointer-events: none;
}

/* ---------- Aperçu d'un contenu à la largeur d'un téléphone (EditContent) ---------- */
.keya-preview {
    display: flex;
    justify-content: center;
}
.keya-preview-phone {
    width: 100%;
    max-width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    border: 8px solid #2b1d26;
    border-radius: 28px;
    background: #fff;
}
.keya-preview-cover {
    display: block;
    width: 100%;
    height: auto;
}
.keya-preview-text {
    padding: 16px;
}
.keya-preview-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #e61873;
}
.keya-preview-title {
    margin-top: 4px;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}
.keya-preview-summary {
    margin-top: 8px;
    color: #6b5b66;
}
.keya-preview-audio {
    width: 100%;
    margin-top: 12px;
}
.keya-preview-link {
    margin-top: 12px;
    font-size: 0.875rem;
    word-break: break-all;
}
.keya-preview-body {
    margin-top: 16px;
    line-height: 1.6;
}
.keya-preview-body h2 { font-size: 1.125rem; font-weight: 700; margin: 16px 0 8px; }
.keya-preview-body h3 { font-weight: 700; margin: 12px 0 6px; }
.keya-preview-body p { margin: 0 0 10px; }
.keya-preview-body ul { list-style: disc; padding-left: 20px; margin: 0 0 10px; }
.keya-preview-body ol { list-style: decimal; padding-left: 20px; margin: 0 0 10px; }
.keya-preview-body blockquote { border-left: 3px solid #e61873; padding-left: 12px; color: #6b5b66; margin: 0 0 10px; }
.keya-preview-body a { color: #e61873; text-decoration: underline; }

/* ---------- Texte légal archivé (Paramètres › Textes légaux) ---------- */
.keya-legal {
    max-height: 65vh;
    overflow-y: auto;
    line-height: 1.6;
}
.keya-legal h1, .keya-legal h2 { font-weight: 700; margin: 16px 0 8px; }
.keya-legal h1 { font-size: 1.25rem; }
.keya-legal h2 { font-size: 1.125rem; }
.keya-legal h3 { font-weight: 700; margin: 12px 0 6px; }
.keya-legal p { margin: 0 0 10px; }
.keya-legal ul { list-style: disc; padding-left: 20px; margin: 0 0 10px; }
.keya-legal ol { list-style: decimal; padding-left: 20px; margin: 0 0 10px; }
.keya-legal a { color: #e61873; text-decoration: underline; }

/* ---------- Préférences de suivi : barres de pourcentage (Utilisatrices › Préférences de suivi) ---------- */
.keya-prefs-intro { color: #6b5b66; margin-bottom: 16px; }
.keya-prefs-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.keya-prefs-select { border: 1px solid #e5d5df; border-radius: 8px; padding: 6px 10px; background: #fff; }
.keya-prefs-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.keya-prefs-row { display: grid; grid-template-columns: 1fr 90px 48px; align-items: center; gap: 8px; padding: 6px 0; }
.keya-prefs-track { height: 8px; border-radius: 4px; background: #fce7f1; overflow: hidden; }
.keya-prefs-fill { display: block; height: 100%; background: #ec4189; }
.keya-prefs-value { text-align: right; font-variant-numeric: tabular-nums; }
.keya-prefs-note { margin-top: 8px; font-size: 0.8rem; color: #6b5b66; }
