/* ═══════════════════════════════════════════
   EI Jordi Ruh — Bons de dépôt
   Charte : Anthracite #1e1e1e · Orange #f97316
   ═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --anthracite: #1e1e1e;
  --orange:     #f97316;
  --orange-light: #fff7ed;
  --orange-border: #fed7aa;
  --blue:       #0070cc;
  --green:      #1a7a45;
  --green-light:#e0f5ea;
  --white:      #ffffff;
  --gray-50:    #f8f7f5;
  --gray-100:   #f0eeea;
  --gray-200:   #e4e2dc;
  --gray-400:   #a8a5a0;
  --gray-600:   #6a6860;
  --text:       #1a1a1a;
  --text-muted: #666;
  --text-light: #999;
  --border:     #e8e6e0;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg:  0 4px 24px rgba(0,0,0,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Poppins', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--gray-50);
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 60px;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between; height: 100%;
}
.nav-logo { display: flex; align-items: center; gap: 10px; }
.nav-logo img { height: 32px; }
.nav-logo-name { font-size: 14px; font-weight: 600; color: var(--anthracite); line-height: 1; }
.nav-logo-sub { font-size: 10px; color: var(--text-light); line-height: 1; margin-top: 2px; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-size: 13px; color: var(--text-muted); transition: color .15s; position: relative; }
.nav-links a:hover { color: var(--anthracite); }
.nav-links a.active { color: var(--anthracite); }
.nav-links a.active::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--orange); border-radius: 2px;
}
.nav-logout { color: var(--text-light) !important; font-size: 12px !important; }

/* ── LAYOUT ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.main { padding: 28px 0 60px; }

/* ── LOGIN ── */
.login-body { background: var(--gray-50); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.login-card { background: var(--white); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 36px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 48px; margin: 0 auto 12px; }
.login-logo h1 { font-size: 18px; font-weight: 700; }
.login-logo p { font-size: 12px; color: var(--text-muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── ALERTS ── */
.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
}
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #a3d9b5; }
.alert-error { background: #fff0f0; color: #c0392b; border: 1px solid #f5c6c6; }
.alert-info { background: #e8f2ff; color: var(--blue); border: 1px solid #b8d4f5; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--anthracite); }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--anthracite); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-orange .stat-number { color: var(--orange); }
.stat-green .stat-number { color: var(--green); }
.stat-gray .stat-number { color: var(--text-muted); }

/* ── FILTRES ── */
.filters-bar { margin-bottom: 16px; }
.filters-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-input {
  flex: 1; min-width: 200px; height: 38px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0 12px; font-size: 13px; font-family: inherit;
  background: var(--white);
}
.search-input:focus { outline: none; border-color: var(--orange); }
.select-filter {
  height: 38px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 10px; font-size: 13px; font-family: inherit; background: var(--white);
}

/* ── TABLE ── */
.table-wrap { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  background: var(--gray-50); padding: 10px 14px; font-size: 11px;
  font-weight: 600; color: var(--text-muted); text-align: left;
  border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.3px;
}
.table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }
.row-anterieur td { color: var(--text-muted); }
.bon-numero { font-weight: 600; font-size: 13px; }
.date-cell { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.panne-cell { color: var(--text-muted); font-size: 12px; }
.actions-cell { display: flex; gap: 6px; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge-en_cours { background: var(--orange-light); color: var(--orange); border: 1px solid var(--orange-border); }
.badge-termine { background: var(--green-light); color: var(--green); border: 1px solid #a3d9b5; }
.badge-annule { background: var(--gray-100); color: var(--text-muted); border: 1px solid var(--gray-200); }
.badge-green { background: var(--green-light); color: var(--green); border: 1px solid #a3d9b5; }
.badge-ant {
  display: inline-block; background: var(--orange-light); color: var(--orange);
  border: 1px solid var(--orange-border); font-size: 10px; padding: 1px 6px;
  border-radius: 4px; margin-left: 6px;
}

/* ── PAGINATION ── */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; }
.page-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; font-size: 13px; border: 1px solid var(--border);
  background: var(--white); color: var(--text); transition: all .15s;
}
.page-btn:hover { border-color: var(--orange); color: var(--orange); }
.page-btn.active { background: var(--anthracite); color: var(--white); border-color: var(--anthracite); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--anthracite); color: var(--white); }
.btn-primary:hover { background: var(--orange); }
.btn-secondary { background: var(--gray-100); color: var(--anthracite); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--gray-100); color: var(--anthracite); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-full { width: 100%; }

/* ── FORMULAIRE ── */
.form-section {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px 24px; margin-bottom: 16px;
}
.section-title { font-size: 15px; font-weight: 600; color: var(--anthracite); margin-bottom: 16px; }
.section-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.form-grid { display: grid; gap: 12px 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
input[type="text"], input[type="tel"], input[type="email"],
input[type="number"], input[type="date"], input[type="password"],
textarea, select {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--white); transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}
.input-readonly { background: var(--gray-100); color: var(--text-muted); cursor: not-allowed; }
textarea { resize: vertical; min-height: 70px; }
.required { color: var(--orange); }
.field-hint { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-group-horiz { flex-direction: row; flex-wrap: wrap; gap: 16px; }
.radio-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; }
.radio-label input { width: 15px; height: 15px; accent-color: var(--orange); }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; }
.checkbox-label input { width: 15px; height: 15px; accent-color: var(--orange); }
.form-actions { display: flex; gap: 12px; align-items: center; padding: 4px 0 20px; }

/* ── SIGNATURE ── */
.signature-bloc { margin: 12px 0; }
.sig-pad-wrap {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--white); display: inline-block; width: 100%; max-width: 520px;
}
#signature-pad { display: block; width: 100%; height: 150px; cursor: crosshair; touch-action: none; }
.sig-actions { padding: 6px 10px; background: var(--gray-50); border-top: 1px solid var(--border); display: flex; gap: 8px; }
.sig-preview { max-height: 70px; max-width: 220px; border-radius: 6px; border: 1px solid var(--border); padding: 4px; background: var(--white); }
.sig-existing { margin-bottom: 8px; }
.sig-display { margin-top: 12px; }
.sig-tech-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ── VOIR BON ── */
.statut-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 12px 18px; margin-bottom: 20px; font-size: 13px;
}
.statut-form select {
  height: 32px; padding: 0 8px; font-size: 12px; border-radius: 7px;
}
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-card {
  background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 16px 18px;
}
.detail-card-full { grid-column: 1 / -1; }
.card-title { font-size: 13px; font-weight: 600; color: var(--anthracite); margin-bottom: 12px; }
.detail-list { display: grid; gap: 4px 0; }
.detail-list dt { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 8px; }
.detail-list dt:first-child { margin-top: 0; }
.detail-list dd { font-size: 13px; color: var(--text); font-weight: 500; }
.created-at { font-size: 11px; color: var(--text-light); margin-top: 16px; text-align: right; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card-full { grid-column: 1; }
  .nav-links { gap: 14px; }
  .page-header { flex-direction: column; }
  .table-wrap { overflow-x: auto; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .radio-group-horiz { flex-direction: column; }
  .nav-logo-text { display: none; }
}
