/* =========================================================
   ACTIA — REFONTE « INDUSTRIEL CLAIR » (TEST)
   ---------------------------------------------------------
   S'appuie sur pro.css (chargé avant) et change toute
   l'apparence : menu en haut, typographie forte, formes
   droites, look logiciel d'entreprise.
   - Ordinateur : barre de navigation sombre en haut.
   - Téléphone : barre d'onglets en bas de l'écran.
   - Mode clair = ambiance principale ; le bouton 🌙/☀️
     bascule vers une variante sombre assortie.
   Pour revenir en arrière : Paramètres → Style de l'interface.
   ========================================================= */

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

/* ---------- 1. Couleurs & mesures ---------- */
:root {
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Barlow Condensed', 'Inter', sans-serif;

  /* Variante sombre (bouton 🌙) */
  --bg: #12161b;
  --bg2: #181d24;
  --surface: #1b2129;
  --surface-2: #222a34;
  --input: #141920;
  --border: #2c3540;
  --border-strong: #3b4653;
  --text: #e6eaef;
  --muted: #8d98a6;

  --bar: #0d1116;
  --bar-text: #a9b3bf;
  --bar-border: #262e38;

  --radius: 6px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .25);
  --shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

body.light {
  --bg: #eef1f4;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --input: #ffffff;
  --border: #d8dee5;
  --border-strong: #b9c2cc;
  --text: #121820;
  --muted: #5d6874;

  --bar: #171c22;
  --bar-text: #aab3bd;
  --bar-border: #2a323c;

  --shadow-sm: 0 1px 0 rgba(18, 24, 32, .04);
  --shadow: 0 2px 10px rgba(18, 24, 32, .08);
}

body { font-size: 14px; }

/* ---------- 2. Mise en page : menu en haut ---------- */
.app { flex-direction: column; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  height: 58px;
  flex-direction: row;
  align-items: stretch;
  gap: 28px;
  padding: 0 28px;
  background: var(--bar);
  border: none;
  border-bottom: 3px solid var(--accent);
  transform: none;
}

.brand {
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: none;
}
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: transparent;
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
}
.brand span {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--bar-text);
}

.nav {
  flex: 1;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav-btn {
  height: auto;
  flex: none;
  padding: 0 14px;
  gap: 8px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--bar-text);
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
  position: relative;
}
.nav-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-btn.active {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  box-shadow: none;
}
.nav-btn.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: #fff;
}
.nav-btn > span { width: 16px; height: 16px; }
.nav-btn.active > span { background: var(--accent); }

/* Pages secondaires : icône seule (le nom s'affiche au survol) */
.nav-btn[data-view="settings"],
.nav-btn[data-view="faire-suggestion"],
.nav-btn[data-view="suggestions"] {
  font-size: 0;
  gap: 0;
  padding: 0 13px;
}
.nav-btn[data-view="settings"] { margin-left: auto; }
.nav-btn[data-view="settings"] > span,
.nav-btn[data-view="faire-suggestion"] > span,
.nav-btn[data-view="suggestions"] > span { width: 18px; height: 18px; }

.sidebar .btn.logout {
  align-self: center;
  flex: none;
  width: auto;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--bar-border);
  color: var(--bar-text);
  font-size: 12.5px;
  box-shadow: none;
}
.sidebar .btn.logout:hover { color: #fff; border-color: #fff; background: transparent; }

/* ---------- 3. Contenu ---------- */
.main {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px 56px;
}

/* La barre d'outils (recherche + actions) devient une simple ligne */
.topbar {
  position: static;
  margin: 22px 0 22px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
}
.burger { display: none !important; }

.search {
  max-width: 520px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}

/* Titres de page */
.view-head {
  align-items: flex-end;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.view-head h2 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
  line-height: 1;
}
.view-head .muted { margin-top: 6px; font-size: 13.5px; }

/* ---------- 4. Boutons ---------- */
.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .01em;
}
.btn.primary {
  background: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 75%, #000);
  box-shadow: none;
}
.btn.ghost,
.btn:not(.primary):not(.danger):not(.ghost) {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}

/* ---------- 5. Chiffres clés ---------- */
.stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-card {
  position: relative;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 18px 20px 16px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}
.stat-card:last-child { border-right: none; }
.stat-card:hover { border-color: var(--border); box-shadow: none; background: var(--surface-2); }
.stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
}
.stat-card:has(.stat-icon.blue)::before { background: var(--blue); }
.stat-card:has(.stat-icon.green)::before { background: var(--green); }
.stat-card:has(.stat-icon.orange)::before { background: var(--orange); }
.stat-card:has(.stat-icon.purple)::before { background: #8b5cf6; }

.stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  opacity: .9;
}
.stat-card > div:last-child { display: flex; flex-direction: column-reverse; }
.stat-card h3 {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  margin-top: 6px;
}
.stat-card p {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  padding-right: 36px;
}

/* ---------- 6. Cartes & listes ---------- */
.card,
.note,
.plan-folder,
.contact-card,
.monthly-bars-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card { padding: 0; overflow: hidden; }
.card > h3 {
  margin: 0;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.card:not(.table-card) > :not(h3) { padding-left: 18px; padding-right: 18px; }
.card:not(.table-card) > :last-child { padding-bottom: 14px; }
.card > .list { padding-top: 4px; }
.card > .field:first-of-type { margin-top: 16px; }
.card > p.muted:first-of-type,
.card > .btn-row { margin-top: 14px; }

.table-card { padding: 0 !important; }

.list-item { padding: 11px 0; }

/* ---------- 7. Filtres : onglets soulignés ---------- */
.filters {
  display: flex;
  gap: 4px;
  padding: 0;
  margin-bottom: 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.chip {
  padding: 10px 14px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.chip:hover { color: var(--text); background: transparent; }
.chip.active,
body.light .chip.active {
  background: transparent;
  color: var(--text);
  border: none;
  border-bottom: 3px solid var(--accent);
  box-shadow: none;
}

/* ---------- 8. Tableau ---------- */
.table th {
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--border-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
}
.table td { padding: 11px 14px; }
#recBody .rec-row:nth-child(4n+1) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table tr:hover td,
#recBody .rec-row:hover td { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
#recBody .rec-row td:nth-child(3) {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 13px;
}

/* Statuts : étiquettes droites avec liseré */
.badge {
  padding: 3px 8px 3px 7px;
  border-radius: 3px;
  border: none;
  border-left: 3px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.badge::before { display: none; }

/* ---------- 9. Notes, plans, contacts ---------- */
.note,
.plan-folder,
.contact-card { border-left-width: 4px; padding: 16px 18px; }
.note h4,
.plan-head h4,
.contact-card h4 { font-size: 15px; font-weight: 700; }
.tag { border-radius: 3px; font-size: 11px; font-weight: 600; }
.act { border-radius: var(--radius-sm); }

/* ---------- 10. Formulaires & fenêtres ---------- */
.field input,
.field select,
#modalForm input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
#modalForm select,
#modalForm textarea,
.inline-form input,
.supplier-search-box {
  border-radius: var(--radius-sm);
  border-color: var(--border-strong);
  box-shadow: none;
}
.field,
#modalForm label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
#modalForm label > *,
.field > * { text-transform: none; letter-spacing: normal; }

.modal-box {
  border-radius: 8px;
  padding: 0 24px 22px;
  border: none;
  border-top: 4px solid var(--accent);
}
.modal-head {
  margin: 0 -24px 20px;
  padding: 16px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.supplier-item,
.supplier-new-btn { border-radius: var(--radius-sm); }
.modal-box .photo-slot,
.modal-box .photo-slot .photo-btn { border-radius: var(--radius-sm); }

/* ---------- 11. Divers ---------- */
.toast { border-radius: var(--radius-sm); border-left: 4px solid var(--accent); }
.monthly-bars-header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.monthly-bars-total strong { font-family: var(--font-display); }

.auth-box {
  border-radius: 8px;
  border-top: 4px solid var(--accent);
}
.auth-box h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* ---------- 12. Écrans moyens : menu en icônes ---------- */
@media (max-width: 1180px) and (min-width: 861px) {
  .sidebar { gap: 16px; padding: 0 16px; }
  .brand > div:last-child { display: none; }
  .nav-btn { padding: 0 11px; font-size: 12.5px; }
}

/* ---------- 13. Téléphone : onglets en bas ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 70;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
    gap: 0;
    border-bottom: none;
    border-top: 3px solid var(--accent);
    transform: none !important;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, .25);
  }
  .brand { display: none; }

  .nav-btn {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 72px;
    max-width: 84px;
    padding: 0 6px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
  }
  .nav-btn > span { width: 20px; height: 20px; }
  .nav-btn.active::after { top: -3px; bottom: auto; }

  /* Sur téléphone, tous les onglets gardent leur nom */
  .nav-btn[data-view="settings"],
  .nav-btn[data-view="faire-suggestion"],
  .nav-btn[data-view="suggestions"] { font-size: 10.5px; gap: 4px; padding: 0 8px; margin-left: 0; }

  /* Déconnexion : icône seule au bout de la barre */
  .sidebar .btn.logout {
    align-self: stretch;
    width: 52px;
    height: auto;
    margin: 0;
    padding: 0;
    justify-content: center;
    border: none;
    border-left: 1px solid var(--bar-border);
    border-radius: 0;
    font-size: 0;
  }
  .sidebar .btn.logout::before { content: '⏻'; font-size: 19px; }

  .main { padding: 0 14px calc(90px + env(safe-area-inset-bottom)); }
  .topbar { margin: 14px 0 16px; }
  .view-head h2 { font-size: 26px; }

  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  #backToTopBtn { bottom: calc(84px + env(safe-area-inset-bottom)) !important; }
}

@media (max-width: 700px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .stat-card {
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
  }
  .stat-card:nth-child(2n) { border-right: none; }
  .stat-card h3 { font-size: 36px; }
  .stat-icon { top: 12px; right: 12px; width: 26px; height: 26px; font-size: 13px; }
  .modal-box { border-radius: 10px 10px 0 0; padding: 0 16px 20px; }
  .modal-head { margin: 0 -16px 16px; padding: 14px 16px; }
}
