/* ============================================================
   FleetCore — Styles complémentaires à TailwindCSS
   ============================================================ */

* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.dark * { scrollbar-color: #475569 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn .25s ease-out; }
.animate-slide-up { animation: slideUp .3s ease-out; }

/* ---- Form elements ---- */
.form-input {
  width: 100%; padding: 0.65rem 0.9rem; border-radius: 0.75rem;
  border: 1px solid rgb(226 232 240); background: #fff; font-size: 0.875rem;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.dark .form-input { background: rgb(15 23 42); border-color: rgb(51 65 85); color: #f1f5f9; }
.form-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; }

.form-label { display: block; font-size: 0.8125rem; font-weight: 500; margin-bottom: 0.375rem; color: rgb(71 85 105); }
.dark .form-label { color: rgb(148 163 184); }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.25rem;
  background: #2563eb; color: #fff; border-radius: 0.75rem; font-weight: 600; font-size: 0.875rem;
  transition: background .15s, transform .1s; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.25rem;
  background: rgb(241 245 249); color: rgb(51 65 85); border-radius: 0.75rem; font-weight: 600; font-size: 0.875rem;
  transition: background .15s;
}
.dark .btn-secondary { background: rgb(30 41 59); color: rgb(226 232 240); }
.btn-secondary:hover { background: rgb(226 232 240); }
.dark .btn-secondary:hover { background: rgb(51 65 85); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.25rem;
  background: #e11d48; color: #fff; border-radius: 0.75rem; font-weight: 600; font-size: 0.875rem;
  transition: background .15s;
}
.btn-danger:hover { background: #be123c; }

.btn-icon {
  width: 2.25rem; height: 2.25rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0.6rem; color: rgb(100 116 139); transition: background .15s, color .15s;
}
.btn-icon:hover { background: rgb(241 245 249); color: rgb(30 41 59); }
.dark .btn-icon:hover { background: rgb(30 41 59); color: rgb(241 245 249); }

/* ---- Auth tabs ---- */
.auth-tab { color: rgb(100 116 139); }
.auth-tab[aria-selected="true"] { background: #fff; color: #1d4ed8; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.dark .auth-tab[aria-selected="true"] { background: rgb(30 41 59); color: #93c5fd; }

/* ---- Nav ---- */
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; color: rgb(71 85 105); transition: background .15s, color .15s;
  cursor: pointer;
}
.dark .nav-item { color: rgb(148 163 184); }
.nav-item:hover { background: rgb(241 245 249); color: rgb(15 23 42); }
.dark .nav-item:hover { background: rgb(30 41 59); color: #fff; }
.nav-item.active { background: rgb(37 99 235 / 0.1); color: #1d4ed8; font-weight: 600; }
.dark .nav-item.active { background: rgb(37 99 235 / 0.18); color: #60a5fa; }
.nav-item i { width: 1.1rem; text-align: center; }
.nav-section-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgb(148 163 184); padding: 0.75rem 0.75rem 0.25rem; }

/* ---- User menu items ---- */
.user-menu-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left;
  padding: 0.55rem 1rem; font-size: 0.8125rem; font-weight: 500; color: rgb(51 65 85);
  transition: background .15s;
}
.dark .user-menu-item { color: rgb(226 232 240); }
.user-menu-item:hover { background: rgb(248 250 252); }
.dark .user-menu-item:hover { background: rgb(30 41 59); }

/* ---- Cards ---- */
.card { background: #fff; border-radius: 1rem; border: 1px solid rgb(226 232 240 / 0.8); box-shadow: 0 1px 3px rgba(15,23,42,0.05); }
.dark .card { background: rgb(15 23 42); border-color: rgb(30 41 59); }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.badge-success { background: rgb(220 252 231); color: rgb(21 128 61); }
.badge-danger  { background: rgb(254 226 226); color: rgb(185 28 28); }
.badge-warning { background: rgb(254 243 199); color: rgb(180 83 9); }
.badge-info    { background: rgb(219 234 254); color: rgb(29 78 216); }
.badge-muted   { background: rgb(241 245 249); color: rgb(71 85 105); }
.dark .badge-success { background: rgb(21 128 61 / 0.2); color: rgb(74 222 128); }
.dark .badge-danger  { background: rgb(185 28 28 / 0.2); color: rgb(248 113 113); }
.dark .badge-warning { background: rgb(180 83 9 / 0.2); color: rgb(251 191 36); }
.dark .badge-info    { background: rgb(29 78 216 / 0.2); color: rgb(96 165 250); }
.dark .badge-muted   { background: rgb(51 65 85 / 0.5); color: rgb(148 163 184); }

/* ---- Table ---- */
.data-table { width: 100%; font-size: 0.8125rem; border-collapse: collapse; }
.data-table th { text-align: left; padding: 0.65rem 1rem; font-weight: 600; color: rgb(100 116 139); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid rgb(226 232 240); white-space: nowrap; }
.dark .data-table th { color: rgb(148 163 184); border-color: rgb(30 41 59); }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid rgb(241 245 249); vertical-align: middle; }
.dark .data-table td { border-color: rgb(30 41 59); }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: rgb(248 250 252); }
.dark .data-table tbody tr:hover { background: rgb(30 41 59 / 0.5); }

/* ---- Toast ---- */
.toast { display: flex; align-items: start; gap: 0.6rem; padding: 0.9rem 1rem; border-radius: 0.85rem; background: #fff; box-shadow: 0 8px 24px -4px rgba(15,23,42,0.15); border-left: 4px solid #2563eb; animation: slideUp .25s ease-out; }
.dark .toast { background: rgb(30 41 59); }
.toast-success { border-color: #16a34a; }
.toast-danger { border-color: #e11d48; }
.toast-warning { border-color: #d97706; }
.toast-exit { animation: fadeOut .25s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateX(20px); } }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,0.5); padding: 1rem; backdrop-filter: blur(2px); }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 1.25rem; box-shadow: 0 24px 48px -12px rgba(15,23,42,0.3); width: 100%; max-height: 90vh; overflow-y: auto; }
.dark .modal-box { background: rgb(15 23 42); }

/* ---- Skeleton loading ---- */
.skeleton { background: linear-gradient(90deg, rgb(226 232 240) 25%, rgb(241 245 249) 50%, rgb(226 232 240) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 0.5rem; color: transparent !important; }
.dark .skeleton { background: linear-gradient(90deg, rgb(30 41 59) 25%, rgb(51 65 85) 50%, rgb(30 41 59) 75%); background-size: 200% 100%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- KPI card accent ---- */
.kpi-icon { width: 2.75rem; height: 2.75rem; border-radius: 0.85rem; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }

/* ---- Empty state ---- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1.5rem; text-align: center; color: rgb(148 163 184); }

/* ---- Responsive helpers ---- */
@media (max-width: 1023px) {
  #sidebar.open { transform: translateX(0); }
}

/* ---- RTL support (Arabic) ---- */
[dir="rtl"] #sidebar { left: auto !important; right: 0 !important; border-right: none; border-left: 1px solid rgb(226 232 240); }
.dark[dir="rtl"] #sidebar { border-left-color: rgb(30 41 59); }
[dir="rtl"] #sidebar { transform: translateX(100%); }
@media (min-width: 1024px) {
  [dir="rtl"] #sidebar { transform: translateX(0) !important; }
  [dir="rtl"] .lg\:pl-64 { padding-left: 0 !important; padding-right: 16rem !important; }
}
@media (max-width: 1023px) {
  [dir="rtl"] #sidebar.open { transform: translateX(0) !important; }
}
[dir="rtl"] .nav-item i:first-child { margin-left: 0.5rem; margin-right: 0; }
[dir="rtl"] .btn-primary i:first-child, [dir="rtl"] .btn-secondary i:first-child, [dir="rtl"] .btn-danger i:first-child { margin-left: 0.4rem; margin-right: 0; }
[dir="rtl"] .modal-box { text-align: right; }
[dir="rtl"] .form-input, [dir="rtl"] .form-label, [dir="rtl"] textarea { text-align: right; }
[dir="rtl"] input[type="number"], [dir="rtl"] input[type="date"] { text-align: left; }
[dir="rtl"] .data-table th, [dir="rtl"] .data-table td { text-align: right; }
[dir="rtl"] .data-table th.text-right, [dir="rtl"] .data-table td.text-right { text-align: left; }
[dir="rtl"] .toast { left: 1.25rem; right: auto; }

/* ---- Print (invoices / receipts) ---- */
@media print {
  body * { visibility: hidden; }
  #inv-print-area, #inv-print-area * { visibility: visible; }
  #inv-print-area { position: absolute; top: 0; left: 0; width: 100%; }
  .modal-overlay, #sidebar, #sidebar-overlay, header, .btn-primary, .btn-secondary, .modal-close { display: none !important; }
}
