/* =========================================================
   FOANI — Back-office : thème aux couleurs du site
   Surcharge les variables du thème Velzon (aucun fichier du thème modifié).
   :root:root[...] donne une priorité supérieure aux sélecteurs du thème.
   ========================================================= */

/* ---------- Couleurs de la marque ---------- */
:root:root[data-theme] {
    --foani-leaf: #559e33;
    --foani-leaf-dark: #2a6b2a;
    --foani-forest: #163a14;
    --foani-straw: #f1c40f;
    --foani-barn: #a61c1c;
    --foani-cream: #f6f8f2;

    --vz-primary: #3d8b2f;
    --vz-primary-rgb: 61, 139, 47;
    --vz-primary-bg-subtle: rgba(61, 139, 47, .12);
    --vz-primary-border-subtle: rgba(61, 139, 47, .3);
    --vz-primary-text-emphasis: #2a6b2a;
    --vz-link-color: #2f7a23;
    --vz-link-color-rgb: 47, 122, 35;
    --vz-link-hover-color: #2a6b2a;
    --vz-link-hover-color-rgb: 42, 107, 42;

    --vz-font-sans-serif: 'Inter', 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

:root:root[data-theme]:not([data-bs-theme="dark"]) {
    --vz-body-bg: #f4f6f1;
    --vz-secondary-bg: #ffffff;
}

/* ---------- Sidebar ---------- */
:root:root[data-theme][data-sidebar="dark"] {
    --vz-vertical-menu-bg: #163a14;
    --vz-vertical-menu-border: #163a14;
    --vz-vertical-menu-item-color: rgba(255, 255, 255, .74);
    --vz-vertical-menu-item-bg: rgba(255, 255, 255, .08);
    --vz-vertical-menu-item-hover-color: #ffffff;
    --vz-vertical-menu-item-active-color: #ffffff;
    --vz-vertical-menu-item-active-bg: rgba(241, 196, 15, .16);
    --vz-vertical-menu-sub-item-color: rgba(255, 255, 255, .64);
    --vz-vertical-menu-sub-item-hover-color: #ffffff;
    --vz-vertical-menu-sub-item-active-color: #f1c40f;
    --vz-vertical-menu-title-color: rgba(241, 196, 15, .7);
    --vz-twocolumn-menu-iconview-bg: #102b0e;
    --vz-vertical-menu-box-shadow: 0 0 24px rgba(10, 30, 8, .18);
}

.navbar-menu {
    background:
        radial-gradient(circle at 0% 100%, rgba(241, 196, 15, .08), transparent 40%),
        linear-gradient(180deg, #1c4319 0%, #13310f 100%) !important;
}

/* Bloc logo */
.navbar-brand-box { padding: 0 1rem !important; }

.foani-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    height: 70px;
    text-decoration: none;
}

.foani-brand img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 0 0 2px var(--foani-straw);
    flex-shrink: 0;
}

.foani-brand__txt { display: flex; flex-direction: column; line-height: 1.15; }
.foani-brand__txt strong { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.foani-brand__txt small { color: var(--foani-straw); font-size: 11.5px; font-weight: 500; }

/* Sidebar réduite : seul le logo reste */
[data-sidebar-size="sm"] .foani-brand__txt,
[data-sidebar-size="sm-hover"] .navbar-menu:not(:hover) .foani-brand__txt { display: none; }

/* Titres de groupe */
.navbar-menu .menu-title { padding: 18px 20px 6px !important; }
.navbar-menu .menu-title span { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }

/* Liens */
.navbar-menu .navbar-nav .nav-link {
    border-radius: 10px;
    margin: 1px 12px;
    padding-left: 12px !important;
    padding-right: 12px !important;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}

.navbar-menu .navbar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); }

.navbar-menu .navbar-nav > .nav-item > .nav-link.active {
    background: var(--vz-vertical-menu-item-active-bg);
    color: #fff !important;
    box-shadow: inset 3px 0 0 var(--foani-straw);
}

.navbar-menu .navbar-nav > .nav-item > .nav-link.active i { color: var(--foani-straw) !important; }
.navbar-menu .navbar-nav .nav-link i { font-size: 18px; width: 22px; text-align: center; }
.navbar-menu .menu-dropdown .nav-link { margin-left: 22px; font-size: 13.5px; }
.navbar-menu .menu-dropdown .nav-link.active { background: rgba(255, 255, 255, .06); }

/* Badges de la sidebar (mis à jour en direct) */
.foani-badge {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--foani-straw);
    color: #1c4319;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.foani-badge--alert { background: #e5484d; color: #fff; }
.foani-badge.is-empty { display: none; }
.foani-badge.bump { animation: foani-bump .5s ease; }

@keyframes foani-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.35); } }

/* Raccourcis en bas de la sidebar */
.foani-sidebar-links { display: grid; gap: 6px; margin: 18px 16px 24px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.foani-sidebar-links a {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .8rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: rgba(255, 255, 255, .05);
}
.foani-sidebar-links a:hover { background: rgba(241, 196, 15, .14); color: #fff; }
.foani-sidebar-links a i { color: var(--foani-straw); font-size: 16px; }
[data-sidebar-size="sm"] .foani-sidebar-links { display: none; }

/* ---------- Topbar ---------- */
#page-topbar { box-shadow: 0 1px 0 rgba(0, 0, 0, .05), 0 6px 18px rgba(20, 50, 15, .05); }

.foani-quick {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    height: 38px;
    padding: 0 .9rem;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--foani-leaf-dark) !important;
    background: rgba(61, 139, 47, .1);
    transition: background-color .15s ease;
}
.foani-quick:hover { background: rgba(61, 139, 47, .18); }
.foani-quick--shop { background: var(--foani-straw); color: #1c4319 !important; }
.foani-quick--shop:hover { background: #e0b40a; }

/* Cloches de notification */
.foani-notif .btn-topbar { position: relative; }
.foani-notif .topbar-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    background: #e5484d;
    color: #fff;
}
.foani-notif .topbar-badge.is-empty { display: none; }
.foani-notif .dropdown-menu { width: 340px; padding: 0; border-radius: 14px; overflow: hidden; }
.foani-notif__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: linear-gradient(120deg, #1c4319, #3d8b2f); color: #fff; }
.foani-notif__head h6 { margin: 0; color: #fff; font-size: 14px; }
.foani-notif__head span { font-size: 12px; background: rgba(255, 255, 255, .18); padding: 2px 8px; border-radius: 999px; }
.foani-notif__list { max-height: 320px; overflow-y: auto; }
.foani-notif__item { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--vz-border-color); color: var(--vz-body-color); text-decoration: none; }
.foani-notif__item:hover { background: var(--vz-tertiary-bg); color: var(--vz-body-color); }
.foani-notif__item i { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; background: rgba(61, 139, 47, .12); color: var(--foani-leaf-dark); font-size: 16px; }
.foani-notif__item strong { display: block; font-size: 13px; }
.foani-notif__item small { display: block; color: var(--vz-secondary-color); font-size: 12px; }
.foani-notif__empty { padding: 24px 16px; text-align: center; color: var(--vz-secondary-color); font-size: 13px; }
.foani-notif__foot { display: block; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; }

/* ---------- Contenu ---------- */
.card { border-radius: 14px; border: 1px solid rgba(20, 50, 15, .06); box-shadow: 0 1px 2px rgba(20, 50, 15, .04), 0 4px 14px rgba(20, 50, 15, .04); }
.card-header { border-radius: 14px 14px 0 0 !important; }
.btn { border-radius: 10px; font-weight: 500; }
.form-control, .form-select, .select2-container--default .select2-selection--single { border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: rgba(61, 139, 47, .55); box-shadow: 0 0 0 .2rem rgba(61, 139, 47, .15); }
.table > thead.table-primary th,
.table-primary > th { background-color: rgba(61, 139, 47, .1) !important; color: #1f4d17 !important; border-color: rgba(61, 139, 47, .15) !important; }
.page-title-box h4 { font-weight: 700; }

/* Boutons en cours d'envoi (anti double clic) */
.btn.is-busy { pointer-events: none; opacity: .85; }
.btn.is-busy .foani-spin { display: inline-block; width: 1em; height: 1em; margin-right: .4em; border: .15em solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.15em; animation: foani-spin .7s linear infinite; }

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

/* ---------- Barre de progression de navigation ---------- */
#foani-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--foani-straw), var(--foani-leaf));
    box-shadow: 0 0 10px rgba(241, 196, 15, .6);
    opacity: 0;
    transition: width .3s ease, opacity .3s ease;
    pointer-events: none;
}

#foani-progress.is-loading { opacity: 1; width: 75%; transition: width 6s cubic-bezier(.1, .7, .2, 1), opacity .2s ease; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   Composants des pages (KPI, statuts, période, étapes)
   ========================================================= */

/* ---------- Cartes KPI ---------- */
.kpi {
    --kc: var(--vz-primary);
    --kc-rgb: var(--vz-primary-rgb);
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 18px;
    border-radius: 16px;
    background: var(--vz-secondary-bg);
    border: 1px solid rgba(20, 50, 15, .07);
    box-shadow: 0 1px 2px rgba(20, 50, 15, .04), 0 6px 18px rgba(20, 50, 15, .05);
    color: var(--vz-body-color);
    text-decoration: none;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(var(--kc-rgb), .07); }
.kpi--link:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(20, 50, 15, .1); color: var(--vz-body-color); }

.kpi__icon { position: relative; z-index: 1; width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; font-size: 24px; color: var(--kc); background: rgba(var(--kc-rgb), .12); }
.kpi__body { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; }
.kpi__label { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--vz-secondary-color); }
.kpi__value { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .3em; font-size: 1.55rem; font-weight: 700; line-height: 1.2; color: var(--vz-heading-color, var(--vz-body-color)); }
.kpi__num { white-space: nowrap; }
.kpi__value small { font-size: .55em; font-weight: 600; color: var(--vz-secondary-color); }
.kpi__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 2px; font-size: 12.5px; color: var(--vz-secondary-color); }
.kpi__trend { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border-radius: 999px; font-weight: 700; background: rgba(108, 117, 125, .12); color: var(--vz-secondary-color); }
.kpi__trend.is-up { background: rgba(61, 139, 47, .14); color: #2a6b2a; }
.kpi__trend.is-down { background: rgba(229, 72, 77, .12); color: #c0392b; }

.kpi--success { --kc: #2f8f3a; --kc-rgb: 47, 143, 58; }
.kpi--warning { --kc: #c98a00; --kc-rgb: 241, 180, 15; }
.kpi--danger { --kc: #d64545; --kc-rgb: 214, 69, 69; }
.kpi--info { --kc: #1e88c7; --kc-rgb: 30, 136, 199; }
.kpi--secondary { --kc: #6c757d; --kc-rgb: 108, 117, 125; }

@media (max-width: 575.98px) {
    .kpi { padding: 14px; gap: 10px; }
    .kpi__icon { width: 42px; height: 42px; font-size: 20px; border-radius: 12px; }
    .kpi__value { font-size: 1.2rem; }
}

/* ---------- Badges de statut ---------- */
.statut-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.statut-badge i { font-size: 14px; }
.statut-badge--warning { background: rgba(241, 180, 15, .18); color: #8a6100; }
.statut-badge--info { background: rgba(30, 136, 199, .13); color: #145f8c; }
.statut-badge--success { background: rgba(61, 139, 47, .15); color: #23621f; }
.statut-badge--danger { background: rgba(214, 69, 69, .13); color: #a72b2b; }
.statut-badge--secondary { background: rgba(108, 117, 125, .14); color: #495057; }

/* ---------- Onglets de statut (listes) ---------- */
.statut-tabs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.statut-tab {
    flex: 1 0 170px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--vz-secondary-bg);
    border: 1.5px solid rgba(20, 50, 15, .08);
    color: var(--vz-body-color);
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.statut-tab:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(20, 50, 15, .08); color: var(--vz-body-color); }
.statut-tab.is-active { border-color: var(--vz-primary); box-shadow: 0 0 0 3px rgba(61, 139, 47, .15); }
.statut-tab__icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }
.statut-tab__count { display: block; font-size: 1.3rem; font-weight: 700; line-height: 1.1; }
.statut-tab__label { display: block; font-size: 12.5px; color: var(--vz-secondary-color); }
.statut-tab__amount { display: block; font-size: 12px; font-weight: 600; color: var(--vz-primary); }
.statut-tab--warning .statut-tab__icon { background: rgba(241, 180, 15, .18); color: #8a6100; }
.statut-tab--info .statut-tab__icon { background: rgba(30, 136, 199, .13); color: #145f8c; }
.statut-tab--success .statut-tab__icon { background: rgba(61, 139, 47, .15); color: #23621f; }
.statut-tab--danger .statut-tab__icon { background: rgba(214, 69, 69, .13); color: #a72b2b; }
.statut-tab--all .statut-tab__icon { background: rgba(28, 67, 25, .1); color: #1c4319; }

/* ---------- Filtre de période ---------- */
.periode-filtre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.periode-filtre__presets { display: flex; flex-wrap: wrap; gap: 6px; }
.periode-filtre__pill { padding: .35rem .85rem; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--vz-body-color); background: var(--vz-secondary-bg); border: 1px solid rgba(20, 50, 15, .1); text-decoration: none; }
.periode-filtre__pill:hover { border-color: var(--vz-primary); color: var(--vz-primary); }
.periode-filtre__pill.is-active { background: var(--vz-primary); border-color: var(--vz-primary); color: #fff; }
.periode-filtre__perso { display: flex; align-items: center; gap: 6px; }
.periode-filtre__perso input { width: 150px; }

@media (max-width: 575.98px) {
    .periode-filtre__perso { width: 100%; }
    .periode-filtre__perso input { width: auto; flex: 1; }
}

/* ---------- En-tête de page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--vz-secondary-color); }

/* ---------- Classements avec barres ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { padding: 10px 0; border-bottom: 1px dashed var(--vz-border-color); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list__top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 6px; }
.rank-list__top strong { font-weight: 600; }
.rank-list__bar { height: 6px; border-radius: 999px; background: rgba(61, 139, 47, .1); overflow: hidden; }
.rank-list__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f1c40f, #3d8b2f); }
.rank-pos { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; font-size: 11px; font-weight: 700; background: rgba(61, 139, 47, .12); color: #2a6b2a; }

/* ---------- Étapes de traitement (détail commande / réservation) ---------- */
.stepper { display: flex; margin: 4px 0 6px; }
.stepper__step { flex: 1; position: relative; text-align: center; font-size: 12.5px; color: var(--vz-secondary-color); }
.stepper__step::before { content: ""; position: absolute; top: 17px; left: -50%; right: 50%; height: 3px; background: var(--vz-border-color); z-index: 0; }
.stepper__step:first-child::before { display: none; }
.stepper__dot { position: relative; z-index: 1; width: 36px; height: 36px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; background: var(--vz-secondary-bg); border: 2px solid var(--vz-border-color); }
.stepper__step.is-done { color: #23621f; font-weight: 600; }
.stepper__step.is-done::before { background: #3d8b2f; }
.stepper__step.is-done .stepper__dot { background: #3d8b2f; border-color: #3d8b2f; color: #fff; }
.stepper__step.is-current .stepper__dot { box-shadow: 0 0 0 5px rgba(61, 139, 47, .2); }
.stepper.is-cancelled .stepper__step { opacity: .45; }

.statut-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.statut-actions .btn { display: inline-flex; align-items: center; gap: .35rem; }

/* ---------- Listes d'informations (détail) ---------- */
.info-list { list-style: none; margin: 0; padding: 0; }
.info-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--vz-border-color); }
.info-list li:last-child { border-bottom: 0; }
.info-list i { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; background: rgba(61, 139, 47, .1); color: #2a6b2a; font-size: 16px; }
.info-list small { display: block; font-size: 12px; color: var(--vz-secondary-color); }
.info-list strong { font-weight: 600; }

.totaux { list-style: none; margin: 0; padding: 0; }
.totaux li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--vz-border-color); }
.totaux li.is-total { border-bottom: 0; margin-top: 4px; padding: 12px 14px; border-radius: 12px; background: linear-gradient(120deg, #1c4319, #3d8b2f); color: #fff; font-size: 1.1rem; font-weight: 700; }

/* ---------- Bandeau de nouveautés ---------- */
.new-items-banner { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; margin-bottom: 14px; border-radius: 12px; background: rgba(241, 196, 15, .16); border: 1px solid rgba(241, 196, 15, .45); color: #6b5000; font-weight: 600; }
.new-items-banner.is-visible { display: flex; animation: foani-bump .5s ease; }

/* ---------- Tableaux de listes ---------- */
.table-modern > :not(caption) > * > * { padding: .75rem .8rem; }
.table-modern thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--vz-secondary-color); background: var(--vz-tertiary-bg) !important; border-bottom-width: 1px; }
.table-modern tbody tr:hover { background: rgba(61, 139, 47, .04); }
.table-modern .cell-main { font-weight: 600; }
.table-modern .cell-sub { display: block; font-size: 12px; color: var(--vz-secondary-color); }
.empty-box { padding: 40px 16px; text-align: center; color: var(--vz-secondary-color); }
.empty-box i { font-size: 2.4rem; display: block; margin-bottom: .4rem; color: #3d8b2f; }

/* Grille d'indicateurs qui s'adapte à la largeur disponible */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }

/* Utilitaire absent de Bootstrap : permet aux textes tronqués de rétrécir dans un flex */
.min-w-0 { min-width: 0; }

/* Carte KPI étroite (5 par ligne, ou 2 par ligne sur mobile) : icône au-dessus des chiffres */
.kpi-grid > *, [class*="col-"]:has(> .kpi) { min-width: 0; container-type: inline-size; }
@container (max-width: 230px) {
    .kpi { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
    .kpi__icon { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
    .kpi__value { font-size: 1.3rem; }
    .kpi__label { font-size: 11.5px; }
}
