/*
 * Menu latéral clair + barre du haut (maquette A choisie le 2/12).
 * Remplace l'en-tête bleu et le menu sombre d'AdminLTE. Chargé après theme.css.
 * Menu réduisible aux icônes (body.ftj-mini, mémorisé), tiroir sur mobile (body.ftj-menu-open).
 */
:root { --sb-w: 252px; --sb-mini: 68px; --m-ink: #1f2d3d; --m-text: #3b4a5a; --m-text2: #5d6876; --m-mute: #9aa6b2;
  --m-line: #e3e8ee; --m-hover: #f1f4f7; --m-on: #eaf3f9; --m-blue: #3c8dbc; --m-blue-d: #2a6f97; }

body.skin-blue, .skin-blue .wrapper.ftj-shell { background: #eef1f5; }
.ftj-shell { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ---------- Menu latéral ---------- */
.ftj-sb { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sb-w); background: #fff; border-right: 1px solid var(--m-line);
  display: flex; flex-direction: column; z-index: 1030; transition: width .2s ease, transform .25s ease; }
.ftj-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; color: var(--m-ink); text-decoration: none; min-height: 64px; }
.ftj-brand:hover, .ftj-brand:focus { color: var(--m-ink); text-decoration: none; }
.ftj-brand img { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.ftj-brand b { display: block; font-size: 15px; line-height: 1.2; }
.ftj-brand small { display: block; color: var(--m-text2); font-size: 11.5px; white-space: nowrap; }
.ftj-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 10px 12px; }
.ftj-menu, .ftj-menu ul { list-style: none; margin: 0; padding: 0; }
.ftj-menu .ftj-sec { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--m-mute); padding: 14px 10px 4px; white-space: nowrap; }
.ftj-menu .ftj-it > a, .ftj-menu .ftj-group-toggle { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: 9px; color: var(--m-text); font-weight: 500; font-size: 14px; white-space: nowrap; text-decoration: none; transition: background .15s, color .15s; }
.ftj-menu .ftj-it > a:hover, .ftj-menu .ftj-group-toggle:hover, .ftj-menu .ftj-it > a:focus-visible, .ftj-menu .ftj-group-toggle:focus-visible { background: var(--m-hover); color: var(--m-ink); text-decoration: none; }
.ftj-menu .ftj-ic { flex: none; color: #7b8794; }
.ftj-menu .ftj-it.active > a { background: var(--m-on); color: var(--m-blue-d); font-weight: 600; }
.ftj-menu .ftj-it.active > a::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--m-blue); }
.ftj-menu .ftj-it.active .ftj-ic, .ftj-menu .ftj-group.has-active > .ftj-group-toggle .ftj-ic { color: var(--m-blue); }
.ftj-menu .ftj-group.has-active > .ftj-group-toggle { color: var(--m-ink); font-weight: 600; }
.ftj-menu .ftj-group-caret { margin-left: auto; color: var(--m-mute); transition: transform .2s; }
.ftj-menu .ftj-group.is-open > .ftj-group-toggle .ftj-group-caret { transform: rotate(180deg); }
.ftj-menu .ftj-group-items { display: none; margin: 2px 0 6px 19px; padding-left: 12px; border-left: 1px solid var(--m-line); }
.ftj-menu .ftj-group.is-open > .ftj-group-items { display: block; }
.ftj-menu .ftj-group-items > li > a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--m-text2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.ftj-menu .ftj-group-items > li > a:hover { background: var(--m-hover); color: var(--m-ink); }
.ftj-menu .ftj-group-items > li.active > a { background: var(--m-on); color: var(--m-blue-d); font-weight: 600; }
.ftj-menu .ftj-flyout-title { display: none; }

.ftj-me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--m-line); }
.ftj-av { width: 32px; height: 32px; border-radius: 50%; background: var(--m-on); color: var(--m-blue-d); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.ftj-me-mail { flex: 1; min-width: 0; font-size: 12.5px; color: var(--m-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftj-iconbtn { border: 0; background: none; color: var(--m-text2); width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; padding: 0; }
.ftj-iconbtn:hover, .ftj-iconbtn:focus-visible { background: var(--m-hover); color: var(--m-ink); outline: none; }

/* ---------- Barre du haut ---------- */
.ftj-shell .content-wrapper, .ftj-shell .main-footer { margin-left: var(--sb-w); transition: margin-left .2s ease; }
.ftj-shell .content-wrapper { padding-top: 0; }
/* pas collée en haut : les barres de filtres des pages (Statistiques, Contenu…) restent collées, elles */
.ftj-top { position: relative; z-index: 20; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 20px 0 14px;
  border-bottom: 1px solid var(--m-line); }
.ftj-crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--m-text2); min-width: 0; white-space: nowrap; overflow: hidden; }
.ftj-crumb b { color: var(--m-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ftj-crumb svg { flex: none; color: var(--m-mute); }

/* Barre « Enregistrer » collée en bas des fiches : alignée sur le menu */
.ftj-shell .ftj-savebar { left: var(--sb-w); }
body.ftj-mini .ftj-shell .ftj-savebar { left: var(--sb-mini); }

/* ---------- Menu réduit aux icônes ---------- */
@media (min-width: 768px) {
  body.ftj-mini .ftj-sb { width: var(--sb-mini); }
  body.ftj-mini .ftj-shell .content-wrapper, body.ftj-mini .ftj-shell .main-footer { margin-left: var(--sb-mini); }
  body.ftj-mini .ftj-sb .ftj-lbl, body.ftj-mini .ftj-menu .ftj-group-caret { display: none; }
  body.ftj-mini .ftj-brand { padding: 16px 0 8px; justify-content: center; }
  body.ftj-mini .ftj-nav { overflow: visible; padding: 0 10px 12px; }
  body.ftj-mini .ftj-menu .ftj-sec { font-size: 0; padding: 0; height: 1px; background: var(--m-line); margin: 10px 6px; }
  body.ftj-mini .ftj-menu .ftj-it > a, body.ftj-mini .ftj-menu .ftj-group-toggle { justify-content: center; padding: 0; height: 40px; }
  body.ftj-mini .ftj-menu .ftj-it.active > a::before { left: -10px; }
  body.ftj-mini .ftj-me { flex-direction: column; padding: 10px 0; gap: 6px; }
  /* Bulle du libellé au survol */
  body.ftj-mini .ftj-menu .ftj-it > a::after { content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    background: var(--m-ink); color: #fff; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5; }
  body.ftj-mini .ftj-menu .ftj-it > a:hover::after, body.ftj-mini .ftj-menu .ftj-it > a:focus-visible::after { opacity: 1; }
  /* Sous-menus en panneau flottant au survol */
  body.ftj-mini .ftj-menu .ftj-group { position: relative; }
  body.ftj-mini .ftj-menu .ftj-group > .ftj-group-items { display: none !important; position: absolute; left: calc(100% + 8px); top: -6px; margin: 0; padding: 6px;
    min-width: 220px; background: #fff; border: 1px solid var(--m-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(31, 45, 61, .16); z-index: 5; }
  body.ftj-mini .ftj-menu .ftj-group > .ftj-group-items::before { content: ""; position: absolute; left: -12px; top: 0; bottom: 0; width: 12px; }
  body.ftj-mini .ftj-menu .ftj-group:hover > .ftj-group-items, body.ftj-mini .ftj-menu .ftj-group:focus-within > .ftj-group-items { display: block !important; }
  body.ftj-mini .ftj-menu .ftj-flyout-title { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--m-mute); padding: 6px 10px 4px; }
  body.ftj-mini .ftj-menu .ftj-group-items > li > a { padding: 7px 10px; }
}

/* ---------- Mobile : tiroir ---------- */
.ftj-scrim { display: none; }
@media (max-width: 767px) {
  .ftj-sb { transform: translateX(-100%); width: 280px; box-shadow: 0 20px 50px rgba(31, 45, 61, .2); }
  body.ftj-menu-open .ftj-sb { transform: none; }
  body.ftj-menu-open .ftj-scrim { display: block; position: fixed; inset: 0; background: rgba(31, 45, 61, .35); z-index: 1025; }
  .ftj-shell .content-wrapper, .ftj-shell .main-footer, body.ftj-mini .ftj-shell .content-wrapper, body.ftj-mini .ftj-shell .main-footer { margin-left: 0; }
  .ftj-shell .ftj-savebar, body.ftj-mini .ftj-shell .ftj-savebar { left: 0; }
  .ftj-top { padding: 0 12px 0 8px; }
}
@media (prefers-reduced-motion: reduce) { .ftj-sb, .ftj-shell .content-wrapper, .ftj-shell .main-footer, .ftj-menu .ftj-group-caret { transition: none; } }
@media print { .ftj-sb, .ftj-top, .ftj-scrim { display: none !important; } .ftj-shell .content-wrapper, .ftj-shell .main-footer { margin-left: 0 !important; } }

/* ---------- Messages après une action (Enregistré, erreur…) ---------- */
.content-wrapper .alert.ftj-flash { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px 13px 16px; margin-bottom: 16px;
  border-radius: 14px; border: 1px solid transparent; box-shadow: 0 4px 14px rgba(31, 45, 61, .05); font-size: 14px; line-height: 1.45;
  animation: ftj-flash-in .35s ease both; }
.content-wrapper .alert.ftj-flash .ftj-flash-ic { flex: none; margin-top: 1px; }
.content-wrapper .alert.ftj-flash .ftj-flash-text { flex: 1; min-width: 0; }
.content-wrapper .alert.ftj-flash .ftj-flash-text a { color: inherit; font-weight: 600; text-decoration: underline; }
.content-wrapper .alert.ftj-flash .close { position: static; float: none; order: 3; width: 28px; height: 28px; margin: -4px -4px -4px 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 400; line-height: 1; opacity: .55; text-shadow: none; }
.content-wrapper .alert.ftj-flash .close:hover { opacity: 1; background: rgba(31, 45, 61, .06); }
.content-wrapper .alert-success.ftj-flash { background: #ecf7f0 !important; border-color: #cfe8d9; color: #24563a !important; }
.content-wrapper .alert-success.ftj-flash .ftj-flash-ic { color: #2f8a55; }
.content-wrapper .alert-warning.ftj-flash { background: #fff6e8 !important; border-color: #f3dcb5; color: #6e470f !important; }
.content-wrapper .alert-warning.ftj-flash .ftj-flash-ic { color: #c77d12; }
.content-wrapper .alert-danger.ftj-flash { background: #fdf0ee !important; border-color: #f0cdc7; color: #8a2116 !important; }
.content-wrapper .alert-danger.ftj-flash .ftj-flash-ic { color: #c23321; }
@keyframes ftj-flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .content-wrapper .alert.ftj-flash { animation: none; } }
