/* ================================================================
   STATION CARBURANT — STYLE LIGHT MODERNE & PROFESSIONNEL
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- VARIABLES ---- */
:root {
  --primary:       #1a6b3a;
  --primary-light: #22c55e;
  --primary-bg:    #f0fdf4;
  --primary-glow:  rgba(26,107,58,0.15);

  --blue:          #2563eb;
  --blue-bg:       #eff6ff;
  --orange:        #f59e0b;
  --orange-bg:     #fffbeb;
  --purple:        #7c3aed;
  --purple-bg:     #f5f3ff;
  --danger:        #ef4444;
  --danger-bg:     #fef2f2;
  --success:       #16a34a;

  --bg-page:       #f0f4f8;
  --bg-white:      #ffffff;
  --bg-light:      #f8fafc;
  --bg-hover:      #f1f5f9;

  --text-dark:     #0f172a;
  --text-body:     #334155;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  --border:        #e2e8f0;
  --border-light:  #f1f5f9;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:   0 10px 40px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.05);

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;

  --sidebar-w:   220px;
  --navbar-h:    60px;
  --tr:          0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px 0 calc(var(--sidebar-w) + 20px);
  z-index: 200;
  box-shadow: var(--shadow-sm);
  gap: 8px;
}

.navbar-brand {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 11px;
  text-decoration: none;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  z-index: 201;
}

.navbar-brand .brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px var(--primary-glow);
  flex-shrink: 0;
}

.navbar-brand .brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}
.navbar-brand .brand-sub {
  font-size: 10px;
  color: var(--text-light);
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--tr);
  white-space: nowrap;
}
.nav-item a:hover  { background: var(--bg-hover); color: var(--text-dark); }
.nav-item a.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 12px;
  border-left: 1px solid var(--border-light);
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info .user-name { font-size: 12px; font-weight: 600; color: var(--text-dark); line-height: 1.2; }
.user-role {
  font-size: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 1px 7px;
  border-radius: 20px;
  display: inline-block;
  font-weight: 600;
}

.logout-btn {
  padding: 6px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--tr);
  font-family: inherit;
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.layout-wrap { display: flex; padding-top: var(--navbar-h); min-height: 100vh; }

.sidebar {
  position: fixed;
  left: 0; top: var(--navbar-h); bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 10px;
  z-index: 100;
}

.sidebar-group { margin-bottom: 20px; }

.sidebar-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--tr);
  position: relative;
}

.sidebar a:hover { background: var(--bg-hover); color: var(--text-dark); }

.sidebar a.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.sidebar a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 26px 28px;
  min-height: calc(100vh - var(--navbar-h));
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--tr), border-color var(--tr);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--text-dark); margin: 0; }

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-time {
  background: var(--bg-white);
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}

/* ================================================================
   STAT CARDS
   ================================================================ */
.row-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--tr);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.green::before  { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--blue), #38bdf8); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--orange), #fbbf24); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #a78bfa); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.stat-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-sub { font-size: 11px; color: var(--text-light); margin-top: 6px; }

/* ================================================================
   BOUTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all var(--tr);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-success {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(26,107,58,0.35); transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue), #38bdf8);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.2);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(37,99,235,0.3); transform: translateY(-1px); }

.btn-danger  { background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,0.2); }
.btn-danger:hover { box-shadow: 0 4px 16px rgba(239,68,68,0.3); transform: translateY(-1px); }

.btn-warning { background: var(--orange); color: #fff; }

.btn-secondary {
  background: var(--bg-white);
  border: 1px solid var(--border);
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success   { background: var(--primary-bg); color: var(--success); border: 1px solid #bbf7d0; }
.badge-warning   { background: var(--orange-bg);  color: #d97706; border: 1px solid #fde68a; }
.badge-danger    { background: var(--danger-bg);  color: var(--danger); border: 1px solid #fecaca; }
.badge-secondary { background: var(--bg-light);   color: var(--text-muted); border: 1px solid var(--border); }
.badge-blue      { background: var(--blue-bg);    color: var(--blue); border: 1px solid #bfdbfe; }

/* ================================================================
   TABLEAUX
   ================================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-light);
  border-bottom: 2px solid var(--border-light);
  background: var(--bg-light);
  white-space: nowrap;
}

.table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
  vertical-align: middle;
  transition: background var(--tr);
}
.table td strong { color: var(--text-dark); }
.table tbody tr:hover td { background: var(--bg-light); }
.table tbody tr:last-child td { border-bottom: none; }

td.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--text-light); padding: 40px; font-style: italic; }

/* ================================================================
   FORMULAIRES
   ================================================================ */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 6px;
}

.form-control {
  display: block;
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--tr);
  outline: none;
  box-shadow: var(--shadow-sm);
}

.form-control::placeholder { color: var(--text-light); }
.form-control:hover:not(:focus) { border-color: #cbd5e1; }
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

select.form-control {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.big-input {
  font-size: 24px; font-weight: 800; text-align: center;
  padding: 14px; color: var(--primary); letter-spacing: 1px;
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions {
  display: flex; gap: 10px; margin-top: 24px;
  padding-top: 18px; border-top: 1px solid var(--border-light);
}
.hint { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.req  { color: var(--danger); }

/* ================================================================
   LAYOUT FORMULAIRE + PANEL
   ================================================================ */
.row-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.side-panel { position: sticky; top: calc(var(--navbar-h) + 16px); }
.side-panel h3 { font-size: 14px; font-weight: 700; color: var(--text-dark); margin-bottom: 16px; }

/* ================================================================
   CUVES
   ================================================================ */
.cuves-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.cuve-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: all var(--tr);
}
.cuve-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }

.cuve-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cuve-header strong { font-size: 13px; color: var(--text-dark); }

.jauge-container {
  height: 8px;
  background: var(--bg-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}
.jauge-bar { height: 100%; border-radius: 4px; transition: width 1s ease; }

.stat-row {
  display: flex; justify-content: space-between;
  padding: 5px 0; font-size: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-muted);
}
.stat-row:last-child { border-bottom: none; }
.stat-row strong { color: var(--text-dark); }

/* ================================================================
   RECAP VENTE
   ================================================================ */
.recap-block {}
.recap-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px; color: var(--text-muted);
}
.recap-row:last-child { border-bottom: none; }
.recap-row strong { color: var(--text-dark); }
.recap-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.total-line {
  font-size: 16px !important; font-weight: 700;
  color: var(--primary) !important;
  padding: 14px 0 !important;
  border-bottom: 2px solid var(--primary) !important;
}
.total-line strong { color: var(--primary) !important; font-size: 20px; }

.quick-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-quick {
  padding: 6px 12px;
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all var(--tr);
}
.btn-quick:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }

/* ================================================================
   ALERTES
   ================================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
  margin-bottom: 16px;
  font-size: 13px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
.alert-danger  { background: #fff7ed; border-color: #f97316; color: #c2410c; }
.alert-success { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.alert-warning { background: var(--orange-bg); border-color: var(--orange); color: #92400e; }

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination { display: flex; gap: 4px; list-style: none; padding: 14px 0; flex-wrap: wrap; }
.pagination li a, .pagination li span {
  display: flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 10px;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); text-decoration: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  transition: all var(--tr); box-shadow: var(--shadow-sm);
}
.pagination li a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.pagination li.active a { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination li.disabled a { opacity: 0.4; pointer-events: none; }

/* ================================================================
   CODE
   ================================================================ */
code {
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 12px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  color: var(--primary);
}

a { color: var(--primary); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--blue); }

.quick-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* ================================================================
   LOGIN
   ================================================================ */
.login-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 14px;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text-dark); margin-bottom: 4px; }
.login-logo p  { font-size: 13px; color: var(--text-light); }

.login-btn {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-weight: 700; font-size: 15px;
  border: none; border-radius: var(--radius-md);
  cursor: pointer; font-family: inherit;
  transition: all var(--tr);
  box-shadow: 0 2px 12px var(--primary-glow);
  margin-top: 8px;
}
.login-btn:hover { box-shadow: 0 4px 24px rgba(26,107,58,0.4); transform: translateY(-1px); }
.login-btn:active { transform: scale(0.98); }

/* ================================================================
   ANIMATIONS CARTES
   ================================================================ */
.card { animation: fadeUp 0.3s ease both; }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.10s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.stat-card { animation: fadeUp 0.3s ease both; }
.stat-card:nth-child(2) { animation-delay: 0.04s; }
.stat-card:nth-child(3) { animation-delay: 0.08s; }
.stat-card:nth-child(4) { animation-delay: 0.12s; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
  .row-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .navbar { padding-left: 16px; }
  .navbar-brand { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
}
@media (max-width: 640px) {
  .cuves-grid { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .row-stats  { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}