/* ================================================================
   Système de design neumorphique — Famille de sites
   Dashboard · Recettes · Filament Manager
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --bg:      #e8ecf1;
  --sd:      #c5cad3;   /* ombre sombre */
  --sl:      #ffffff;   /* ombre claire */
  --text:    #4a5568;
  --muted:   #8a9ab5;
  --dark:    #2d3748;

  /* Couleur par univers */
  --dash:    #7c6ff7;   /* violet  — Dashboard       */
  --food:    #3db489;   /* vert    — Recettes         */
  --fil:     #e8834c;   /* orange  — Filament Manager */

  /* Statuts */
  --ok:      #3db489;
  --err:     #e05252;
  --warn:    #e8a84c;

  /* Alias utilitaires */
  --border:  #c5cad3;
  --text-muted: #8a9ab5;

  /* Géométrie */
  --r:       12px;
  --r-lg:    20px;

  /* Ombres réutilisables */
  --sh:      6px 6px 14px var(--sd), -6px -6px 14px var(--sl);
  --sh-sm:   3px 3px 7px var(--sd),  -3px -3px 7px var(--sl);
  --sh-in:   inset 4px 4px 9px var(--sd),  inset -4px -4px 9px var(--sl);
  --sh-in-s: inset 2px 2px 5px var(--sd),  inset -2px -2px 5px var(--sl);
}

/* ── Reset minimal ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════════════════════════════
   NAVIGATION PRINCIPALE
════════════════════════════════════════════════════════════════ */
.nm-nav {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  border-bottom: 1px solid rgba(255,255,255,.9);
}

.nm-nav-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Logo ── */
.nm-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}
.nm-brand img    { height: 38px; width: auto; }
.nm-brand-icon   { font-size: 1.7rem; line-height: 1; }
.nm-brand-name   {
  font-weight: 800; font-size: .92rem;
  color: var(--dark); white-space: nowrap;
  letter-spacing: -.01em;
}

/* ── Onglets univers ── */
.nm-tabs {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: .5rem;
}

.nm-tab {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .52rem 1.2rem;
  border-radius: var(--r);
  text-decoration: none;
  font-weight: 700;
  font-size: .87rem;
  color: var(--muted);
  transition: all .22s ease;
  box-shadow: var(--sh-sm);
  white-space: nowrap;
  user-select: none;
}
.nm-tab:hover {
  color: var(--dark);
  box-shadow: var(--sh);
  transform: translateY(-1px);
}
.nm-tab svg { width: 17px; height: 17px; flex-shrink: 0; }

/* Onglet actif par univers */
.nm-tab.active-dash { background: var(--dash); color: #fff; box-shadow: 4px 4px 12px rgba(124,111,247,.45), -3px -3px 8px #fff; }
.nm-tab.active-food { background: var(--food); color: #fff; box-shadow: 4px 4px 12px rgba(61,180,137,.45),  -3px -3px 8px #fff; }
.nm-tab.active-fil  { background: var(--fil);  color: #fff; box-shadow: 4px 4px 12px rgba(232,131,76,.45),  -3px -3px 8px #fff; }

/* ── Côté droit ── */
.nm-nav-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ── Dropdown ── */
.nm-dropdown { position: relative; }

.nm-dd-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .52rem 1.1rem;
  border-radius: var(--r);
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .87rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--sh-sm);
  transition: all .2s;
  white-space: nowrap;
}
.nm-dd-btn:hover       { box-shadow: var(--sh); }
.nm-dd-btn[aria-expanded="true"] { box-shadow: var(--sh-in-s); }

.nm-chevron {
  width: 16px; height: 16px; flex-shrink: 0;
  transition: transform .22s ease;
}
.nm-dd-btn[aria-expanded="true"] .nm-chevron { transform: rotate(180deg); }

.nm-dd-panel {
  position: absolute;
  right: 0;
  top: calc(100% + .65rem);
  min-width: 215px;
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: .55rem;
  display: none;
  z-index: 300;
}
.nm-dd-panel.is-open {
  display: block;
  animation: nmSlide .17s ease;
}
@keyframes nmSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nm-dd-label {
  padding: .3rem .8rem .1rem;
  font-size: .71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
}

.nm-dd-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .85rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: .87rem;
  font-weight: 600;
  color: var(--text);
  transition: all .15s;
}
.nm-dd-item:hover        { background: rgba(0,0,0,.04); box-shadow: var(--sh-in-s); }
.nm-dd-item.is-active    { color: var(--dash); font-weight: 700; }
.nm-dd-item .dd-icon     { font-size: .95rem; width: 18px; text-align: center; }

.nm-dd-sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sd) 25%, var(--sd) 75%, transparent);
  margin: .35rem .6rem;
}

/* ── Utilisateur ── */
.nm-username {
  font-size: .85rem; font-weight: 700;
  color: var(--dark); white-space: nowrap;
}

.nm-logout {
  display: inline-flex;
  align-items: center;
  padding: .42rem .9rem;
  border-radius: var(--r);
  background: var(--bg);
  box-shadow: var(--sh-sm);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 700;
  color: var(--err);
  transition: all .2s;
}
.nm-logout:hover { box-shadow: var(--sh); }

/* ════════════════════════════════════════════════════════════════
   BARRE MOBILE (bas de page)
════════════════════════════════════════════════════════════════ */
.nm-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  border-top: 1px solid rgba(255,255,255,.9);
  z-index: 100;
  padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom));
}
.nm-mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
}
.nm-mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .4rem .8rem;
  border-radius: var(--r);
  text-decoration: none;
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  transition: all .2s;
  flex: 1;
}
.nm-mobile-tab svg { width: 20px; height: 20px; }
.nm-mobile-tab img { width: 20px; height: 20px; object-fit: contain; opacity: .5; }
.nm-mobile-tab.active-dash { color: var(--dash); }
.nm-mobile-tab.active-food { color: var(--food); }
.nm-mobile-tab.active-fil  { color: var(--fil); }
.nm-mobile-tab.active-dash img { opacity: 1; }

/* ════════════════════════════════════════════════════════════════
   LAYOUT CONTENU
════════════════════════════════════════════════════════════════ */
.nm-content {
  max-width: 64rem;   /* ~1024px, équivalent max-w-5xl Tailwind */
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}
.nm-content.nm-content-mobile-pad {
  padding-bottom: 7rem; /* espace pour la barre mobile */
}
@media (min-width: 768px) {
  .nm-content.nm-content-mobile-pad { padding-bottom: 2rem; }
}

/* ════════════════════════════════════════════════════════════════
   COMPOSANTS COMMUNS
════════════════════════════════════════════════════════════════ */

/* Cards */
.nm-card {
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--sh);
  padding: 1.5rem;
}
.nm-card-sm {
  background: var(--bg);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  padding: 1rem;
}

/* Boutons */
.nm-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .58rem 1.4rem;
  border-radius: var(--r);
  border: none; cursor: pointer;
  font-family: inherit; font-size: .88rem; font-weight: 700;
  text-decoration: none;
  transition: all .2s;
  box-shadow: var(--sh-sm);
  background: var(--bg); color: var(--text);
}
.nm-btn:hover  { box-shadow: var(--sh); transform: translateY(-1px); }
.nm-btn:active { box-shadow: var(--sh-in-s); transform: none; }
.nm-btn-sm     { padding: .38rem .9rem; font-size: .82rem; }

.nm-btn-dash   { background: var(--dash); color: #fff; box-shadow: 4px 4px 10px rgba(124,111,247,.4), -2px -2px 6px #fff; }
.nm-btn-food   { background: var(--food); color: #fff; box-shadow: 4px 4px 10px rgba(61,180,137,.4),  -2px -2px 6px #fff; }
.nm-btn-fil    { background: var(--fil);  color: #fff; box-shadow: 4px 4px 10px rgba(232,131,76,.4),  -2px -2px 6px #fff; }
.nm-btn-err    { background: var(--err);  color: #fff; box-shadow: 4px 4px 10px rgba(224,82,82,.4),   -2px -2px 6px #fff; }
.nm-btn-dash:hover, .nm-btn-food:hover, .nm-btn-fil:hover, .nm-btn-err:hover {
  filter: brightness(1.08); transform: translateY(-1px);
  box-shadow: 6px 6px 14px rgba(0,0,0,.2), -3px -3px 8px #fff;
}

/* Champs de saisie */
.nm-input {
  padding: .6rem .9rem;
  border-radius: var(--r);
  border: none;
  background: var(--bg);
  box-shadow: var(--sh-in);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: box-shadow .2s;
}
.nm-input:focus { box-shadow: var(--sh-in-s), 0 0 0 2px rgba(124,111,247,.25); }

/* Flashs */
.nm-flash {
  border-radius: var(--r); padding: .85rem 1.2rem;
  margin-bottom: 1.2rem; font-weight: 600; font-size: .9rem;
  box-shadow: var(--sh-sm);
}
.nm-flash-ok   { background: #d4f5ec; color: #1a7a5e; }
.nm-flash-err  { background: #fde8e8; color: #c53030; }
.nm-flash-info { background: #eae8ff; color: #4338ca; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .nm-tab span    { display: none; }
  .nm-tab         { padding: .5rem .7rem; }
  .nm-username    { display: none; }
  .nm-brand-name  { display: none; }
}

@media (max-width: 640px) {
  .nm-nav-inner    { padding: 0 .75rem; gap: .35rem; }
  .nm-dd-btn       { padding: .5rem .75rem; font-size: .82rem; }
  .nm-mobile-nav   { display: block; }
  body             { padding-bottom: 72px; }
}

/* ════════════════════════════════════════════════════════════════
   JS DROPDOWN (script inline dans les headers)
════════════════════════════════════════════════════════════════ */
/* Géré par nmDropdown() — voir header.php */

/* ════════════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL (partagé Dashboard · Recettes · Filament)
════════════════════════════════════════════════════════════════ */
.main-content        { flex: 1; padding: 2rem; width: 100%; }
.main-content-narrow { max-width: 1200px; margin: 0 auto; }

/* ════════════════════════════════════════════════════════════════
   FLASH — alias pour compatibilité cross-site
════════════════════════════════════════════════════════════════ */
.flash {
  border-radius: var(--r); padding: .85rem 1.2rem;
  margin-bottom: 1.5rem; font-size: .9rem; font-weight: 600;
  box-shadow: var(--sh-sm);
}
.flash-success { background: #d4f5ec; color: #1a7a5e; }
.flash-error   { background: #fde8e8; color: #c53030; }

/* ════════════════════════════════════════════════════════════════
   EN-TÊTE DE PAGE
════════════════════════════════════════════════════════════════ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem;
}
.page-header h1 {
  font-size: 1.4rem; font-weight: 800; color: var(--dark);
  display: flex; align-items: center; gap: .5rem;
}

/* ════════════════════════════════════════════════════════════════
   CARTES GÉNÉRIQUES
════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 1.5rem;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

/* ════════════════════════════════════════════════════════════════
   STATISTIQUES
════════════════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.2rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 1.4rem; text-align: center;
}
.stat-card .stat-label {
  font-size: .75rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: .5rem;
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-card .stat-sub   { font-size: .78rem; color: var(--muted); margin-top: .3rem; }

/* ════════════════════════════════════════════════════════════════
   BOUTONS GÉNÉRIQUES (.btn)
   Couleur primaire = violet dash par défaut (override dans bambu.css)
════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .58rem 1.2rem; border-radius: var(--r);
  font-size: .88rem; font-weight: 700; cursor: pointer;
  border: none; text-decoration: none; transition: all .2s; font-family: inherit;
}
.btn-primary {
  background: var(--dash); color: #fff;
  box-shadow: 4px 4px 10px rgba(124,111,247,.4), -2px -2px 6px #fff;
}
.btn-primary:hover {
  filter: brightness(1.08); transform: translateY(-1px);
  box-shadow: 6px 6px 14px rgba(124,111,247,.5), -3px -3px 8px #fff;
}
.btn-secondary { background: var(--bg); color: var(--text); box-shadow: var(--sh-sm); }
.btn-secondary:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.btn-danger    { background: var(--bg); color: var(--err); box-shadow: var(--sh-sm); }
.btn-danger:hover    { box-shadow: 4px 4px 10px rgba(224,82,82,.3), -2px -2px 6px #fff; }
.btn-sm   { padding: .35rem .8rem; font-size: .8rem; }
.btn:active { box-shadow: var(--sh-in-s); transform: none; }

/* ════════════════════════════════════════════════════════════════
   FORMULAIRES
════════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--bg); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 2rem; max-width: 560px;
}
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block; font-size: .8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: .4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: .65rem .9rem;
  background: var(--bg); border: none; border-radius: var(--r);
  box-shadow: var(--sh-in); color: var(--text); font-size: .9rem;
  font-family: inherit; outline: none; transition: box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { box-shadow: var(--sh-in), 0 0 0 2px rgba(124,111,247,.2); }
.form-group textarea            { resize: vertical; min-height: 80px; }
.form-group input[type="color"] { padding: .3rem; height: 42px; cursor: pointer; }
.form-group small { font-size: .78rem; color: var(--muted); margin-top: .25rem; display: block; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .8rem; margin-top: 1.5rem; flex-wrap: wrap; }
.form-error   { color: var(--err); font-size: .85rem; margin-bottom: 1rem; font-weight: 600; }

/* ════════════════════════════════════════════════════════════════
   TABLEAUX
════════════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
thead th {
  text-align: left; padding: .7rem 1rem;
  font-size: .74rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); border-bottom: 2px solid var(--sd);
}
tbody td {
  padding: .82rem 1rem; border-bottom: 1px solid rgba(197,202,211,.4);
  vertical-align: middle; color: var(--text);
}
tbody tr:hover td   { background: rgba(255,255,255,.55); }
tbody tr:last-child td { border-bottom: none; }

/* ════════════════════════════════════════════════════════════════
   PAGE DE CONNEXION
════════════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 1.5rem;
}
.login-logo {
  font-size: 1.8rem; font-weight: 800;
  color: var(--dash); text-align: center;
}
.login-logo small {
  display: block; font-size: .75rem;
  color: var(--muted); margin-top: .3rem; font-weight: 500;
}
.login-card {
  background: var(--bg); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 2rem; width: 100%; max-width: 380px;
}
.login-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 1.5rem; color: var(--dark); }

/* ════════════════════════════════════════════════════════════════
   ÉTAT VIDE
════════════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 1.5rem; font-size: .95rem; }

/* ════════════════════════════════════════════════════════════════
   POINTS DE COULEUR
════════════════════════════════════════════════════════════════ */
.color-dot {
  display: inline-block; width: 13px; height: 13px;
  border-radius: 50%; vertical-align: middle; margin-right: .4rem;
  box-shadow: 2px 2px 4px rgba(0,0,0,.18), -1px -1px 3px #fff;
}

/* ════════════════════════════════════════════════════════════════
   UTILITAIRES TAILLE ICÔNES SVG (remplace Tailwind w-X h-X)
════════════════════════════════════════════════════════════════ */
svg { overflow: hidden; max-width: 100%; }
.w-3,  svg.w-3  { width: .75rem;  height: .75rem;  flex-shrink: 0; }
.w-4,  svg.w-4  { width: 1rem;    height: 1rem;    flex-shrink: 0; }
.w-5,  svg.w-5  { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.w-6,  svg.w-6  { width: 1.5rem;  height: 1.5rem;  flex-shrink: 0; }
.w-7,  svg.w-7  { width: 1.75rem; height: 1.75rem; flex-shrink: 0; }
.w-8,  svg.w-8  { width: 2rem;    height: 2rem;    flex-shrink: 0; }
.w-10, svg.w-10 { width: 2.5rem;  height: 2.5rem;  flex-shrink: 0; }
.w-12, svg.w-12 { width: 3rem;    height: 3rem;    flex-shrink: 0; }
.h-3  { height: .75rem; }  .h-4  { height: 1rem; }
.h-5  { height: 1.25rem; } .h-6  { height: 1.5rem; }
.h-7  { height: 1.75rem; } .h-8  { height: 2rem; }
.h-10 { height: 2.5rem; }  .h-12 { height: 3rem; }
/* Évite qu'un SVG sans dimensions remplisse tout son conteneur */
svg:not([width]):not([height]):not(.nm-tab svg):not(.nm-chevron) { max-height: 2rem; width: auto; }
/* Exceptions : SVGs volontairement grands */
.empty-state svg, .empty-icon svg, [class*="hero"] svg { max-height: none !important; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE (ajouts cross-site)
════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main-content { padding: 1rem; }
  .stat-grid    { grid-template-columns: 1fr 1fr; }
}
