/* ============================================================
   ELEGANCE MODE — DESIGN v3
   Palette : Bleu profond #1a1f5e + Or #c9a84c + Blanc cassé
   ============================================================ */

/* ── VARIABLES ─────────────────────────────────────────── */
:root {
  --bg:        #f4f5f9;
  --panel:     #ffffff;
  --panel2:    #f8f9fc;
  --stroke:    #e8eaf0;
  --text:      #0f1623;
  --muted:     #6b7280;
  --blue:      #2448c0;
  --blue-light:#3a5fd9;
  --blue-dark: #1a1f5e;
  --gold:      #c9a84c;
  --gold-light:#e8c96a;
  --pink:      #e8306a;
  --green:     #059669;
  --red:       #dc2626;
  --amber:     #d97706;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(15,22,35,.07);
  --shadow:    0 4px 20px rgba(15,22,35,.10);
  --shadow-lg: 0 8px 40px rgba(15,22,35,.13);
}

/* ── RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

h2, h3 { margin: 0 0 12px; color: var(--text); font-weight: 800; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.small { font-size: 12px; color: var(--muted); }

/* ── LAYOUT ─────────────────────────────────────────────── */
.container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--panel) !important;
  border: 1px solid var(--stroke) !important;
  border-radius: var(--radius) !important;
  padding: 20px !important;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow); }

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar {
  background: var(--blue-dark) !important;
  border-bottom: none !important;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(15,22,35,.25);
}

.topbar-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand-only { flex-shrink: 0; }

.brand-title {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fff 30%, var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Nav menu */
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 8px;
}

.menu {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.menu a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  color: rgba(255,255,255,.75) !important;
  transition: .15s;
  white-space: nowrap;
}

.menu a i { font-size: 14px; opacity: .8; }

.menu a:hover {
  background: rgba(255,255,255,.10);
  color: #fff !important;
}

.menu a.active {
  background: var(--gold) !important;
  color: var(--blue-dark) !important;
  font-weight: 900 !important;
}
.menu a.active i { opacity: 1; color: var(--blue-dark) !important; }

/* Déconnexion */
.topbar-actions { flex-shrink: 0; }

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85) !important;
  font-weight: 700;
  font-size: 13px;
  transition: .15s;
  text-decoration: none !important;
}
.btn-logout:hover { background: rgba(255,255,255,.15); color: #fff !important; }

/* ── FOOTER ─────────────────────────────────────────────── */
.footer, footer {
  background: var(--blue-dark);
  border-top: none;
  padding: 18px 20px;
  text-align: center;
  color: rgba(255,255,255,.45);
  font-size: 12px;
  margin-top: 40px;
  letter-spacing: .5px;
}

/* ── ACTIONS BAR ────────────────────────────────────────── */
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--blue), var(--blue-light));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none !important;
  cursor: pointer;
  transition: .18s ease;
  box-shadow: 0 3px 12px rgba(36,72,192,.30);
  white-space: nowrap;
}
.button:hover, button.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(36,72,192,.38);
  filter: brightness(1.05);
}
.button:active, button.button:active { transform: none; }

.button.secondary, button.button.secondary {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--stroke) !important;
  box-shadow: var(--shadow-sm) !important;
}
.button.secondary:hover, button.button.secondary:hover {
  background: var(--panel2) !important;
  box-shadow: var(--shadow) !important;
}

/* Bouton danger */
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  box-shadow: 0 3px 12px rgba(220,38,38,.30) !important;
}

/* ── INPUTS / SELECT / TEXTAREA ─────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]),
select, textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--stroke);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: .18s;
  width: 100%;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36,72,192,.12);
}

label {
  display: block;
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ── GRILLE FORMULAIRES ─────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field { display: flex; flex-direction: column; }
@media(max-width:640px){ .form-grid{ grid-template-columns:1fr; } }

/* ── TABLES ─────────────────────────────────────────────── */
.table-wrap { overflow: auto; border-radius: var(--radius); }

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  overflow: hidden;
}

.table thead th {
  text-align: left;
  padding: 13px 14px;
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  background: var(--panel2);
  border-bottom: 1px solid var(--stroke);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f3f8;
  color: var(--text);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8f9fc; }

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--stroke);
}
.badge-ok {
  background: #d1fae5; color: #065f46;
  border-color: #a7f3d0;
}
.badge-warn {
  background: #fee2e2; color: #991b1b;
  border-color: #fecaca;
}
.badge-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--blue-dark); border: none;
}

/* ── NOTICES / ERREURS ──────────────────────────────────── */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
  font-weight: 700;
  font-size: 13px;
}

.error {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #991b1b;
  font-weight: 700;
  font-size: 13px;
}

/* ── PILL BADGE ─────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--panel2);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

/* ── AVATAR INITIALES ───────────────────────────────────── */
.avatar {
  width: 38px; height: 38px;
  border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--pink));
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }

/* ── DASHBOARD ──────────────────────────────────────────── */
.dash { display: flex; flex-direction: column; gap: 20px; }

.dash-hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, #4a6fea) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  padding: 24px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg) !important;
  position: relative;
  overflow: hidden;
}

.dash-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
}

.dash-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 120px;
  width: 150px; height: 150px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
}

.dash-title {
  font-size: 26px;
  font-weight: 950;
  color: #fff !important;
  margin: 0;
  letter-spacing: .3px;
}

.dash-subtitle {
  margin: 6px 0 0;
  color: rgba(255,255,255,.75) !important;
  font-size: 13px;
}

.dash-quick { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }

.quick-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  font-weight: 800;
  font-size: 13px;
  transition: .18s;
  backdrop-filter: blur(4px);
}
.quick-link:hover {
  background: rgba(255,255,255,.22);
  transform: translateY(-1px);
}

/* Stats grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  display: flex;
  gap: 16px;
  align-items: center;
  transition: .2s ease;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #fff; flex: 0 0 auto;
  font-size: 20px;
}

.stat-blue  .stat-icon { background: linear-gradient(135deg, var(--blue-dark), var(--blue)); }
.stat-pink  .stat-icon { background: linear-gradient(135deg, #c026d3, var(--pink)); }
.stat-dark  .stat-icon { background: linear-gradient(135deg, #374151, #111827); }
.stat-gold  .stat-icon { background: linear-gradient(135deg, var(--gold), var(--gold-light)); }

.stat-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 24px; font-weight: 950; color: var(--text); margin-top: 3px; }
.stat-hint  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Table dashboard */
.dash-card { }
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.table-wrap { overflow: auto; border-radius: var(--radius); }
.dash-table thead th { position: sticky; top: 0; z-index: 1; }

/* ── POS COMMANDE ───────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 18px;
  align-items: start;
}
.pos-layout > .card { height: fit-content; }

/* Produit row */
.prod-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1.5px solid var(--stroke);
  border-radius: 12px;
  background: #fff;
  transition: .15s;
}
.prod-row:hover { background: #f8f9fc; border-color: var(--blue); }
.prod-row.selected { border-color: var(--blue); background: #eff4ff; }

.prod-name  { font-weight: 800; color: var(--text); font-size: 14px; }
.prod-price { font-size: 13px; color: var(--blue); font-weight: 800; margin-top: 2px; }
.prod-check { width: 18px; height: 18px; }
.prod-qty   { width: 80px; height: 36px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }

.total-box {
  display: flex; justify-content: space-between;
  gap: 10px; align-items: center;
  padding: 14px; border: 1.5px solid var(--stroke);
  border-radius: 12px; background: var(--panel2);
}
.total-amount { font-size: 22px; font-weight: 950; color: var(--blue); }

/* ── FACTURE CONFIRM ────────────────────────────────────── */
.facture-2cols {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 20px;
  align-items: start;
  margin-top: 16px;
}
.facture-summary {
  display: grid; gap: 12px;
  padding: 16px; border: 1px solid var(--stroke);
  border-radius: 12px; background: var(--panel2);
}
.facture-right { position: sticky; top: 80px; }

/* ── PAGE ACTIVE ────────────────────────────────────────── */
.menu a.active {
  background: var(--gold) !important;
  color: var(--blue-dark) !important;
  font-weight: 900 !important;
}
.menu a.active i { color: var(--blue-dark) !important; opacity: 1 !important; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media(max-width:980px) {
  .dash-hero       { flex-direction: column; align-items: flex-start; }
  .dash-grid       { grid-template-columns: 1fr 1fr; }
  .pos-layout      { grid-template-columns: 1fr; }
  .facture-2cols   { grid-template-columns: 1fr; }
  .facture-right   { position: static; }
  .topbar-inner    { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .topbar-row      { flex-direction: column; align-items: flex-start; gap: 8px; }
  .menu            { gap: 2px; }
}
@media(max-width:640px) {
  .dash-grid { grid-template-columns: 1fr; }
  .container { padding: 14px; }
}

/* ── PAGE CLIENT (2 cols) ───────────────────────────────── */
.client-2cols {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 18px;
  align-items: start;
}
.client-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.stat-box {
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px 14px;
}
.amount { font-size: 18px; font-weight: 950; }

@media(max-width:900px) {
  .client-2cols   { grid-template-columns: 1fr; }
  .client-stats   { grid-template-columns: 1fr 1fr; }
}

/* ── RECETTES ───────────────────────────────────────────── */
.recettes-2cols {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 16px;
}
@media(max-width:900px){ .recettes-2cols { grid-template-columns: 1fr; } }

/* ── SMS ────────────────────────────────────────────────── */
.sms-shell  { display: flex; flex-direction: column; gap: 16px; }

/* ── MESURES STICKY ─────────────────────────────────────── */
@media(min-width:901px) {
  .client-right { position: sticky; top: 80px; align-self: start; }
}
@media(max-width:900px) {
  .client-right { position: static; }
}

/* ── ONGLETS MESURES ────────────────────────────────────── */
.mes-tabs { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.mes-tab {
  padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--stroke);
  background: var(--panel2); cursor: pointer;
  font-size: 12px; font-weight: 800; text-decoration: none;
  color: var(--text); transition: .15s;
}
.mes-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.mes-tab:hover:not(.active) { background: #eff4ff; border-color: var(--blue); }

.mesures-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mesure-item label { font-size: 11px; }
.mes-status { font-size: 11px; height: 14px; margin-top: 2px; color: var(--muted); }
.mes-status.saved  { color: var(--green); }
.mes-status.saving { color: var(--amber); }
.mes-status.error  { color: var(--red); }

@media(max-width:900px) { .mesures-grid { grid-template-columns: 1fr; } }

/* ── GRID GÉNÉRALE ──────────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media(max-width:640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── HELPERS ────────────────────────────────────────────── */
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.text-right { text-align: right; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }
.text-blue  { color: var(--blue); }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.text-gold  { color: var(--gold); }

/* Séparateur dashed */
.sep { border-top: 1px dashed var(--stroke); margin: 12px 0; }
