/* ============================================================
   EmiFroid — Design system professionnel
   Inspiration : univers industriel testo (orange signature,
   bleu marine profond, blanc, gris technique, orange signature, typographie sobre)
   Aucune dépendance : une seule feuille de style.
   ============================================================ */

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

:root {
  /* Marque */
  --red:        #ee8432;
  --red-dark:   #c96414;
  --red-light:  #fdf0e5;
  --red-ring:   rgba(238, 132, 50, .28);

  /* Neutres */
  --ink:        #0f2a4a;   /* bleu marine testo */
  --ink-2:      #16406b;
  --graphite:   #3a4a5e;
  --body:       #3c4653;
  --muted:      #7b8592;
  --line:       #e3e8ed;
  --line-soft:  #eef1f4;
  --bg:         #f4f6f8;
  --card:       #ffffff;
  --header-bg:  #f8fafb;

  /* Sémantique */
  --success:     #1e9e5a;
  --success-bg:  #e2f6ec;
  --success-ink: #0c5c33;
  --warning:     #c07a00;
  --warning-bg:  #fdf3e0;
  --warning-ink: #7a4d00;
  --danger:      #e2001a;
  --danger-bg:   #fdeaea;
  --danger-ink:  #8f1017;
  --info:        #1f5fd6;
  --info-bg:     #e8f0fe;
  --info-ink:   #113a85;

  /* Ombres */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .25);

  /* Rayons testo : volontairement fermes / industriels */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); text-decoration: underline; }
h1, h2, h3 { color: var(--ink); font-weight: 700; letter-spacing: -.01em; }

::selection { background: var(--red); color: #fff; }

/* Scrollbar discrète */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c6cdd5; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #aeb6bf; }

/* ============================================================
   STRUCTURE : sidebar + contenu
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  background: linear-gradient(180deg, var(--ink) 0%, #0a1d35 100%);
  display: flex;
  flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  box-shadow: 1px 0 0 rgba(255,255,255,.04);
}

.brand {
  padding: 22px 20px 18px;
  font-size: 1.18rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
  display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand b { color: #ffa663; font-weight: 800; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 10px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: var(--r-md);
  color: #aab4bf;
  font-size: .87rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #e8edf2; text-decoration: none; }
.sidebar nav a.active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 10px -2px rgba(238,132,50,.5);
}
.ico { width: 20px; text-align: center; font-size: 1rem; }

.notif-count {
  margin-left: auto;
  background: #fff; color: var(--red);
  border-radius: 999px; font-size: .7rem; font-weight: 700;
  padding: 1px 7px;
}
.sidebar nav a.active .notif-count { background: #fff; color: var(--red); }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.user-box { margin-bottom: 10px; display: flex; flex-direction: column; }
.user-box strong { color: #fff; font-size: .87rem; }
.user-box small { color: #8b96a2; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ============================================================
   CONTENU
   ============================================================ */
.content { flex: 1; min-width: 0; padding: 26px 32px 70px; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.3rem; font-weight: 800; }
.topbar .spacer { flex: 1; }

.app-footer {
  text-align: center; padding: 20px;
  color: var(--muted); font-size: .78rem;
  background: var(--bg);
}

/* ============================================================
   CARTES / STATS
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card h2 {
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--graphite);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }

.stat {
  position: relative;
  display: flex; flex-direction: column; gap: 5px;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--line);
}
.stat.success::before { background: var(--success); }
.stat.warning::before { background: var(--warning); }
.stat.danger::before  { background: var(--danger); }
.stat .num {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.15;
}
.stat.success .num { color: var(--success); }
.stat.warning .num { color: var(--warning); }
.stat.danger .num  { color: var(--danger); }
.stat .lbl {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ============================================================
   TABLEAUX
   ============================================================ */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.tbl th {
  text-align: left;
  padding: 10px 12px;
  background: var(--header-bg);
  border-bottom: 2px solid var(--line);
  color: var(--graphite);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--body);
}
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl tr:last-child td { border-bottom: 0; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: #eef1f4;
  color: var(--graphite);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success-ink); }
.badge-warning { background: var(--warning-bg); color: var(--warning-ink); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-ink); }
.badge-info    { background: var(--info-bg);    color: var(--info-ink); }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--red-ring); outline-offset: 1px; }

.btn-outline {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--graphite);
  box-shadow: none;
}
.btn-outline:hover { background: var(--header-bg); border-color: #c9d2da; color: var(--ink); box-shadow: none; }

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #17794a; border-color: #17794a; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #a9121b; border-color: #a9121b; }

.btn-sm { padding: 5px 12px; font-size: .78rem; border-radius: var(--r-sm); }

/* ============================================================
   FORMULAIRES
   ============================================================ */
form .field { margin-bottom: 15px; }
form label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
  color: var(--graphite);
}
form input, form select, form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: .9rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
form input::placeholder, form textarea::placeholder { color: #a6aeb8; }
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-ring);
}
form textarea { resize: vertical; }

form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline input, form.inline select { width: auto; }
form.inline label { text-transform: none; letter-spacing: 0; font-size: .82rem; margin: 0; }

hr { border: none; border-top: 1px solid var(--line-soft); }

/* ============================================================
   ALERTES
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid transparent;
  display: flex; align-items: center; gap: 9px;
}
.alert::before { font-size: 1rem; }
.alert-success { background: var(--success-bg); color: var(--success-ink); border-color: #bfe9d2; }
.alert-success::before { content: '✓'; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-ink);  border-color: #f6c6c9; }
.alert-danger::before { content: '✕'; }
.alert-warning { background: var(--warning-bg); color: var(--warning-ink); border-color: #f3ddba; }
.alert-warning::before { content: '⚠'; }
.alert-info    { background: var(--info-bg);    color: var(--info-ink);    border-color: #c9dbfb; }
.alert-info::before { content: 'ℹ'; }

/* ============================================================
   UTILITAIRES
   ============================================================ */
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
small, .muted { font-size: inherit; }
.card small.muted { font-size: .8rem; }

/* ============================================================
   PAGE DE CONNEXION
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1100px 600px at 88% -12%, rgba(238,132,50,.14), transparent 60%),
    radial-gradient(900px 500px at -8% 112%, rgba(15,42,74,.10), transparent 55%),
    #f6f7f9;
  padding: 24px;
}
.login-card {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 40px 40px 34px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 30px -6px rgba(16, 24, 40, .10);
}
.login-card h1 { font-size: 1.45rem; font-weight: 800; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: .88rem; margin-bottom: 26px; }
.login-card .brand {
  display: flex; flex-direction: column; gap: 2px;
  padding: 0 0 22px;
  margin-bottom: 22px;
}
.login-card .brand { justify-content: center; align-items: center; padding: 0 0 20px; }
.login-card .brand .logo-img { display: block; height: auto; }
.login-card .field { margin-bottom: 18px; }
.login-card .field label { font-size: .85rem; font-weight: 500; }
.login-card input { border-radius: 8px; padding: 12px 14px; font-size: .95rem; }
.login-card .btn {
  width: 100%; padding: 12px; font-size: .95rem; font-weight: 600;
  border-radius: 8px; margin-top: 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; padding: 6px; }
  .sidebar nav a { margin: 3px; padding: 8px 10px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; }
  .user-box { margin: 0; }
  .content { padding: 16px 14px 50px; }
  .topbar h1 { font-size: 1.1rem; }
  .tbl { display: block; overflow-x: auto; }
  .tbl th, .tbl td { white-space: nowrap; }
  .stat .num { font-size: 1.5rem; }
}
