/* =========================================================
   MOORE CLUB — Compta : design system partagé
   Thème nightclub : noir profond, néon crimson, chrome argenté.
   NB : on conserve les NOMS de variables historiques (--brun…)
   pour ne pas toucher aux styles inline des pages ; seules
   leurs VALEURS changent. --brun = crimson, --brun-d = chrome.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@300;400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a090d;
  --surface:   #15131a;
  --surface-2: #1c1925;
  --border:    #2a2533;
  --border-2:  #383040;

  /* Marque : crimson néon + chrome argenté */
  --brun:      #e11d33;            /* crimson — accent principal */
  --brun-l:    rgba(225,29,51,.15);/* tint crimson (pastilles)   */
  --brun-d:    #d9dee8;            /* CHROME argenté — titres     */
  --crimson-d: #8e1020;            /* crimson profond (ombres)    */

  --text:      #eceaf0;
  --text-muted:#8f8a9c;

  /* Statuts — base = texte vif sur sombre, -l = tint translucide */
  --green:     #2ecc71;  --green-l:  rgba(46,204,113,.15);  --green-d: #15803d;
  --red:       #e5484d;  --red-l:    rgba(229,72,77,.16);
  --blue:      #38bdf8;  --blue-l:   rgba(56,189,248,.15);
  --orange:    #f5a623;  --orange-l: rgba(245,166,35,.15);
  --purple:    #a78bfa;  --purple-l: rgba(167,139,250,.16);
  --grey-l:    rgba(255,255,255,.05);

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.45);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.6);
  --glow:      0 0 18px rgba(225,29,51,.45);
  --sidebar-w: 244px;

  --font-display: 'Oswald', "Segoe UI", sans-serif;
  --font-ui: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(820px circle at 88% -8%, rgba(225,29,51,.14), transparent 58%),
    radial-gradient(680px circle at 0% 108%, rgba(225,29,51,.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars sombres */
* { scrollbar-color: var(--border-2) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #4a4255; background-clip: padding-box; }

/* ---------- Shell : sidebar + main ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #16121b 0%, #0c0a10 100%);
  border-right: 1px solid var(--border);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 24px 20px 20px;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--border);
  /* lettrage chrome */
  background: linear-gradient(180deg, #ffffff 0%, #c7ccd6 45%, #8b909c 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.sidebar-brand i { font-size: 24px; color: var(--brun); -webkit-text-fill-color: var(--brun); }
.sidebar-brand .brand-logo {
  width: 40px; height: 40px; object-fit: contain; flex-shrink: 0;
  border-radius: 9px;
  filter: drop-shadow(0 0 9px rgba(225,29,51,.5));
}
.sidebar-nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.66);
  text-decoration: none;
  font-size: 14.5px; font-weight: 600;
  position: relative;
  transition: background .15s, color .15s, box-shadow .15s;
}
.nav-link i { font-size: 19px; width: 20px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(225,29,51,.92), rgba(178,18,40,.92));
  color: #fff;
  box-shadow: var(--glow);
}
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--brun); box-shadow: 0 0 10px var(--brun);
}
.sidebar-foot {
  padding: 14px 18px;
  font-size: 11.5px;
  color: rgba(255,255,255,.4);
  border-top: 1px solid var(--border);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(14,12,18,.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 17px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  position: sticky; top: 0; z-index: 9;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 500; letter-spacing: .8px;
  color: var(--brun-d);
  display: flex; align-items: center; gap: 11px;
}
.topbar h1 i { color: var(--brun); font-size: 22px; filter: drop-shadow(0 0 6px rgba(225,29,51,.5)); }
.topbar .clock { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.content {
  padding: 32px; max-width: 1240px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 26px;
}
/* Rythme vertical homogène : le gap de .content gère l'espace entre blocs,
   on neutralise les marges propres pour éviter les écarts doublés/incohérents. */
.content > .card, .content > .grid { margin-bottom: 0; }

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: column; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-link { margin-bottom: 0; }
  .nav-link.active::before { display: none; }
  .sidebar-foot { display: none; }
}

/* ---------- Cartes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 500; color: var(--brun);
  text-transform: uppercase; letter-spacing: 1.4px;
  margin-bottom: 18px; display: flex; align-items: center; gap: 8px;
}
.card-title i { font-size: 16px; }
.card-title .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-muted); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-main { grid-template-columns: 1fr 360px; }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4, .grid-main { grid-template-columns: 1fr; } }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 19px 21px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.stat::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--brun), transparent 70%);
  opacity: .8;
}
.stat:hover { border-color: var(--border-2); transform: translateY(-2px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-family: var(--font-display); font-size: 13px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-ico { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 19px; }
.stat-val { font-size: 29px; font-weight: 800; margin-top: 10px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

.i-green  { background: var(--green-l);  color: var(--green); }
.i-red    { background: var(--red-l);    color: var(--red); }
.i-blue   { background: var(--blue-l);   color: var(--blue); }
.i-orange { background: var(--orange-l); color: var(--orange); }
.i-brun   { background: var(--brun-l);   color: var(--brun); }
.i-purple { background: var(--purple-l); color: var(--purple); }
.t-green { color: var(--green); } .t-red { color: var(--red); } .t-muted { color: var(--text-muted); }

/* ---------- Formulaires ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
select, input[type=date], input[type=number], input[type=text], input[type=time] {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text); background: var(--surface-2);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
select { cursor: pointer; }
::placeholder { color: #6b6678; }
select:focus, input:focus { border-color: var(--brun); box-shadow: 0 0 0 3px rgba(225,29,51,.22); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; font-size: 14px; font-weight: 700; font-family: inherit;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: filter .15s, transform .1s, background .15s, box-shadow .15s, border-color .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #ec2a40, var(--brun)); color: #fff; box-shadow: 0 2px 12px rgba(225,29,51,.35); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: var(--glow); }
.btn-green { background: var(--green); color: #04140a; }
.btn-green:hover:not(:disabled) { filter: brightness(1.08); }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn-ghost { background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brun); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  font-family: var(--font-display);
  font-size: 12.5px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .9px;
  padding: 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--grey-l); }
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table td { padding: 11px 12px; vertical-align: middle; font-size: 14px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .bold { font-weight: 700; }

.del-btn { background: none; border: none; cursor: pointer; color: var(--red); padding: 4px 8px; border-radius: 6px; font-size: 17px; line-height: 1; transition: background .12s; }
.del-btn:hover { background: var(--red-l); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.b-green { background: var(--green-l); color: var(--green); }
.b-red { background: var(--red-l); color: var(--red); }
.b-blue { background: var(--blue-l); color: var(--blue); }
.b-orange { background: var(--orange-l); color: var(--orange); }
.b-brun { background: var(--brun-l); color: var(--brun); }
.b-grey { background: var(--grey-l); color: var(--text-muted); }
.count-badge { display: inline-flex; align-items: center; justify-content: center; background: var(--brun); color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; margin-left: 6px; box-shadow: 0 0 10px rgba(225,29,51,.5); }

/* ---------- Bar chart maison ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, #f23a4f, var(--crimson-d)); border-radius: 6px 6px 0 0; transition: height .4s ease, filter .15s; min-height: 2px; position: relative; box-shadow: 0 0 14px rgba(225,29,51,.3); }
.bar:hover { filter: brightness(1.18); }
.bar-val { font-size: 11px; font-weight: 700; color: var(--brun-d); }
.bar-lab { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* mini barre de progression (stock, répartition) */
.pbar { height: 8px; border-radius: 5px; background: var(--grey-l); overflow: hidden; }
.pbar > i { display: block; height: 100%; border-radius: 5px; }

/* ---------- Divers ---------- */
.empty-msg { text-align: center; color: var(--text-muted); font-size: 14px; padding: 30px 0; }
.empty-msg i { font-size: 32px; display: block; margin-bottom: 8px; opacity: .35; }
.flash { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--green-d); color: #fff; padding: 12px 20px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 700; z-index: 100; opacity: 0; transition: opacity .25s, transform .25s; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.flash.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.section-h { font-family: var(--font-display); font-size: 19px; font-weight: 500; letter-spacing: .5px; color: var(--brun-d); margin: 6px 0 16px; }
.hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-muted); margin-top: 12px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Modale de confirmation ---------- */
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); box-shadow: 0 0 16px rgba(229,72,77,.5); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5,4,8,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity .18s ease;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 390px; padding: 28px 26px; text-align: center;
  transform: translateY(10px) scale(.97); transition: transform .18s ease;
}
.modal-overlay.show .modal { transform: none; }
.modal-ico { width: 56px; height: 56px; border-radius: 15px; display: flex;
  align-items: center; justify-content: center; font-size: 29px; margin: 0 auto 15px; }
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: .4px; color: var(--text); margin-bottom: 8px; }
.modal-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 22px; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 124px; }
@media (max-width: 440px) { .modal-actions { flex-direction: column-reverse; } .modal-actions .btn { width: 100%; } }

/* ---------- Visibilité selon le rôle ---------- */
/* Par défaut on suppose "employé" (le plus restrictif) jusqu'à confirmation du rôle. */
body.role-employe .patron-only { display: none !important; }

/* ---------- Champs invalides ---------- */
.invalid, .invalid:focus { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(229,72,77,.25) !important; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }
.shake { animation: shake .32s ease; }

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