/* ============================================
   FLEET MANAGER VG - Styles Principaux
   Couleurs : Vert & Bleu
   ============================================ */

:root {
  --primary-blue: #1565c0;
  --primary-green: #2e7d32;
  --accent-blue: #1976d2;
  --accent-green: #43a047;
  --light-blue: #e3f2fd;
  --light-green: #e8f5e9;
  --dark-bg: #0a1628;
  --sidebar-bg: #0d2137;
  --sidebar-hover: #1565c0;
  --text-white: #ffffff;
  --text-muted: #90caf9;
  --border-color: #1e3a5f;
  --card-bg: #ffffff;
  --success: #43a047;
  --warning: #f57c00;
  --danger: #c62828;
  --info: #0277bd;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f4f8;
  color: #1a237e;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a1628 0%, #1b5e20 50%, #0d47a1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 48px 40px;
  width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  text-align: center;
}

.login-logo { width: 100px; margin: 0 auto 16px; }
.login-title { font-size: 26px; font-weight: 800; color: #1565c0; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: #43a047; font-weight: 600; margin-bottom: 32px; letter-spacing: 1px; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #1565c0; margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 13px 16px; border: 2px solid #bbdefb;
  border-radius: 10px; font-size: 15px; transition: all 0.3s;
  background: #f8fbff;
}
.form-group input:focus { outline: none; border-color: #1565c0; background: white; box-shadow: 0 0 0 4px rgba(21,101,192,0.15); }

.btn-login {
  width: 100%; padding: 14px; background: linear-gradient(135deg, #1565c0, #2e7d32);
  color: white; border: none; border-radius: 10px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.3s; letter-spacing: 1px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(21,101,192,0.4); }

.login-error { color: #c62828; font-size: 13px; margin-top: 12px; padding: 10px; background: #ffebee; border-radius: 8px; }

/* ---- LAYOUT PRINCIPAL ---- */
.app-container { display: flex; height: 100vh; overflow: hidden; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: 260px; min-width: 260px;
  background: linear-gradient(180deg, #0a1628 0%, #0d2137 60%, #0a2e0a 100%);
  color: white; display: flex; flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.4); z-index: 100;
  transition: width 0.3s;
}

.sidebar-header {
  padding: 20px 16px 16px; border-bottom: 1px solid #1e3a5f;
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo { width: 44px; height: 44px; }
.sidebar-brand { line-height: 1.2; }
.sidebar-brand h2 { font-size: 15px; font-weight: 800; color: #ffffff; }
.sidebar-brand p { font-size: 10px; color: #81c784; font-weight: 600; letter-spacing: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 12px 16px 4px; font-size: 10px; color: #4fc3f7; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; cursor: pointer; transition: all 0.25s;
  color: #b0bec5; font-size: 14px; font-weight: 500; border: none; background: none; width: 100%;
  text-align: left; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(21,101,192,0.3); color: white; border-left-color: #43a047; }
.nav-item.active { background: linear-gradient(90deg, rgba(21,101,192,0.5), rgba(67,160,71,0.2)); color: white; border-left-color: #43a047; font-weight: 700; }
.nav-item i { width: 20px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 16px; border-top: 1px solid #1e3a5f;
  font-size: 12px; color: #546e7a;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; background: linear-gradient(135deg, #1565c0, #2e7d32);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: white; font-weight: 700;
}
.user-name { font-size: 13px; color: #cfd8dc; font-weight: 600; }
.user-role { font-size: 11px; color: #546e7a; }

/* ---- MAIN CONTENT ---- */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: white; padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); z-index: 50;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, #1565c0, #43a047) 1;
}
.topbar-title { font-size: 20px; font-weight: 700; color: #0d47a1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ---- CARDS ---- */
.card {
  background: white; border-radius: 14px; box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  overflow: hidden; margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px; background: linear-gradient(135deg, #1565c0, #1976d2);
  color: white; display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }

/* ---- KPI CARDS ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: white; border-radius: 14px; padding: 20px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08); border-left: 5px solid;
  transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-4px); }
.kpi-card.blue { border-left-color: #1565c0; }
.kpi-card.green { border-left-color: #2e7d32; }
.kpi-card.orange { border-left-color: #f57c00; }
.kpi-card.red { border-left-color: #c62828; }
.kpi-card.teal { border-left-color: #00695c; }
.kpi-value { font-size: 32px; font-weight: 800; color: #1a237e; }
.kpi-label { font-size: 13px; color: #607d8b; font-weight: 600; margin-top: 4px; }
.kpi-icon { font-size: 28px; float: right; opacity: 0.2; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.25s; text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, #1565c0, #1976d2); color: white; }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(21,101,192,0.4); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, #2e7d32, #43a047); color: white; }
.btn-success:hover { box-shadow: 0 4px 16px rgba(46,125,50,0.4); transform: translateY(-1px); }
.btn-warning { background: linear-gradient(135deg, #e65100, #f57c00); color: white; }
.btn-warning:hover { box-shadow: 0 4px 16px rgba(230,81,0,0.4); }
.btn-danger { background: linear-gradient(135deg, #c62828, #e53935); color: white; }
.btn-danger:hover { box-shadow: 0 4px 16px rgba(198,40,40,0.4); }
.btn-info { background: linear-gradient(135deg, #0277bd, #0288d1); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: transparent; border: 2px solid #1565c0; color: #1565c0; }
.btn-logout { background: rgba(198,40,40,0.1); border: 1px solid #e53935; color: #c62828; }
.btn-logout:hover { background: #c62828; color: white; }

/* ---- TABLE ---- */
.table-container { overflow-x: auto; border-radius: 12px; box-shadow: 0 2px 16px rgba(0,0,0,0.07); }
table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
thead { background: linear-gradient(135deg, #1565c0, #1976d2); color: white; }
thead th { padding: 14px 12px; text-align: left; font-weight: 700; white-space: nowrap; font-size: 12px; letter-spacing: 0.5px; }
tbody tr { border-bottom: 1px solid #e8f4fd; transition: background 0.15s; }
tbody tr:hover { background: #e8f4fd; }
tbody td { padding: 11px 12px; vertical-align: middle; }

/* ---- SEARCH & FILTER BAR ---- */
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  background: white; padding: 16px 20px; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07); margin-bottom: 20px;
}
.search-input {
  flex: 1; min-width: 200px; padding: 10px 16px;
  border: 2px solid #bbdefb; border-radius: 8px; font-size: 14px;
  transition: all 0.3s;
}
.search-input:focus { outline: none; border-color: #1565c0; }
.filter-select {
  padding: 10px 14px; border: 2px solid #bbdefb; border-radius: 8px;
  font-size: 13px; background: white; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #1565c0; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: white; border-radius: 18px; padding: 0; width: 700px; max-width: 95vw;
  max-height: 90vh; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(0.9) translateY(20px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-header {
  padding: 20px 24px; background: linear-gradient(135deg, #1565c0, #2e7d32);
  color: white; display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: rgba(255,255,255,0.2); border: none; color: white; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px; transition: background 0.2s; }
.modal-close:hover { background: rgba(255,255,255,0.4); }
.modal-body { padding: 24px; overflow-y: auto; max-height: calc(90vh - 130px); }
.modal-footer { padding: 16px 24px; border-top: 1px solid #e0e7ef; display: flex; gap: 10px; justify-content: flex-end; }

/* ---- FORM ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-full { grid-column: 1 / -1; }
.form-group-modal label { display: block; font-size: 12px; font-weight: 700; color: #1565c0; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group-modal input, .form-group-modal select, .form-group-modal textarea {
  width: 100%; padding: 10px 14px; border: 2px solid #bbdefb; border-radius: 8px;
  font-size: 14px; transition: all 0.3s; background: #f8fbff;
}
.form-group-modal input:focus, .form-group-modal select:focus, .form-group-modal textarea:focus {
  outline: none; border-color: #1565c0; background: white; box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
}

/* ---- BADGES ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-default { background: #eceff1; color: #546e7a; }

/* ---- CHARTS ---- */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card { background: white; border-radius: 14px; padding: 20px; box-shadow: 0 2px 16px rgba(0,0,0,0.08); }
.chart-title { font-size: 14px; font-weight: 700; color: #1565c0; margin-bottom: 16px; }
canvas { max-height: 280px; }

/* ---- AI PANEL ---- */
.ai-panel {
  background: linear-gradient(135deg, #e8f4fd, #e8f5e9);
  border-radius: 14px; padding: 24px; border: 2px solid #bbdefb;
}
.ai-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ai-icon { font-size: 28px; }
.ai-title { font-size: 18px; font-weight: 700; color: #1565c0; }
.ai-subtitle { font-size: 13px; color: #43a047; }
.ai-insights { background: white; border-radius: 10px; padding: 16px; font-size: 14px; line-height: 1.7; color: #1a237e; }
.ai-insight-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid #e8f4fd; }
.ai-insight-item:last-child { border-bottom: none; }
.ai-dot { width: 8px; height: 8px; background: #43a047; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

/* ---- DETAIL VIEW ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item { }
.detail-label { font-size: 11px; font-weight: 700; color: #90a4ae; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.detail-value { font-size: 15px; font-weight: 600; color: #1a237e; }

/* ---- TOAST ---- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast {
  padding: 12px 20px; border-radius: 10px; color: white; font-size: 14px;
  font-weight: 600; margin-bottom: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease; display: flex; align-items: center; gap: 10px;
}
@keyframes toastIn { from { opacity:0; transform:translateX(100px); } to { opacity:1; transform:translateX(0); } }
.toast.success { background: linear-gradient(135deg, #2e7d32, #43a047); }
.toast.error { background: linear-gradient(135deg, #c62828, #e53935); }
.toast.info { background: linear-gradient(135deg, #1565c0, #1976d2); }
.toast.warning { background: linear-gradient(135deg, #e65100, #f57c00); }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px; }
.page-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 2px solid #bbdefb;
  background: white; cursor: pointer; font-size: 13px; font-weight: 600; color: #1565c0;
  transition: all 0.2s;
}
.page-btn:hover, .page-btn.active { background: #1565c0; color: white; border-color: #1565c0; }

/* ---- IMPORT ZONE ---- */
.import-zone {
  border: 3px dashed #bbdefb; border-radius: 14px; padding: 32px;
  text-align: center; cursor: pointer; transition: all 0.3s; background: #f8fbff;
}
.import-zone:hover { border-color: #1565c0; background: #e3f2fd; }
.import-zone i { font-size: 40px; color: #1976d2; margin-bottom: 12px; }
.import-zone p { color: #1565c0; font-weight: 600; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .sidebar.open { width: 260px; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f4f8; }
::-webkit-scrollbar-thumb { background: #bbdefb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #1565c0; }

/* ---- UTILS ---- */
.hidden { display: none !important; }
.flex { display: flex; }
.gap-10 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-muted { color: #607d8b; }
.text-success { color: #2e7d32; }
.text-danger { color: #c62828; }
.p-0 { padding: 0; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
