/* ============================================================
   SISTEM PERJALANAN & BBM KENDARAAN — BOOTSTRAP 5 MODERN THEME
   10 TEMA WARNA LENGKAP & DINAMIS
   ============================================================ */

:root {
  /* Default: 1. Royal Sapphire Blue */
  --primary: #1d4ed8;
  --primary-rgb: 29, 78, 216;
  --primary-hover: #1e40af;
  --primary-light: #eff6ff;
  --primary-subtle: #dbeafe;
  --accent: #f59e0b;
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e3a8a 60%, #172554 100%);
  --sidebar-active: #2563eb;
  --card-border-top: #2563eb;
  --table-head-bg: #1e3a8a;
  --btn-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* 2. Emerald Green (Hijau Zamrud) */
[data-theme="emerald"] {
  --primary: #059669;
  --primary-rgb: 5, 150, 105;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --primary-subtle: #d1fae5;
  --accent: #10b981;
  --sidebar-bg: linear-gradient(180deg, #064e3b 0%, #065f46 60%, #022c22 100%);
  --sidebar-active: #059669;
  --card-border-top: #059669;
  --table-head-bg: #065f46;
  --btn-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* 3. Indigo Purple (Ungu Indigo Modern) */
[data-theme="indigo"] {
  --primary: #4f46e5;
  --primary-rgb: 79, 70, 229;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-subtle: #e0e7ff;
  --accent: #ec4899;
  --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 60%, #1e1b4b 100%);
  --sidebar-active: #6366f1;
  --card-border-top: #6366f1;
  --table-head-bg: #3730a3;
  --btn-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

/* 4. Crimson Ruby (Merah Delima Berani) */
[data-theme="crimson"] {
  --primary: #dc2626;
  --primary-rgb: 220, 38, 38;
  --primary-hover: #b91c1c;
  --primary-light: #fef2f2;
  --primary-subtle: #fee2e2;
  --accent: #f59e0b;
  --sidebar-bg: linear-gradient(180deg, #450a0a 0%, #7f1d1d 60%, #2a0505 100%);
  --sidebar-active: #ef4444;
  --card-border-top: #dc2626;
  --table-head-bg: #7f1d1d;
  --btn-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

/* 5. Sunset Amber (Oranye Senja Enerjik) */
[data-theme="amber"] {
  --primary: #d97706;
  --primary-rgb: 217, 119, 6;
  --primary-hover: #b45309;
  --primary-light: #fffbeb;
  --primary-subtle: #fef3c7;
  --accent: #f59e0b;
  --sidebar-bg: linear-gradient(180deg, #451a03 0%, #78350f 60%, #2c1103 100%);
  --sidebar-active: #d97706;
  --card-border-top: #f59e0b;
  --table-head-bg: #78350f;
  --btn-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* 6. Oceanic Teal (Cyan Laut Segar) */
[data-theme="teal"] {
  --primary: #0d9488;
  --primary-rgb: 13, 148, 136;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --primary-subtle: #ccfbf1;
  --accent: #06b6d4;
  --sidebar-bg: linear-gradient(180deg, #042f2e 0%, #115e59 60%, #03201f 100%);
  --sidebar-active: #14b8a6;
  --card-border-top: #0d9488;
  --table-head-bg: #115e59;
  --btn-gradient: linear-gradient(135deg, #14b8a6 0%, #0f766e 100%);
}

/* 7. Midnight Slate (Hitam Abu Elegan) */
[data-theme="dark"] {
  --primary: #334155;
  --primary-rgb: 51, 65, 85;
  --primary-hover: #1e293b;
  --primary-light: #f8fafc;
  --primary-subtle: #e2e8f0;
  --accent: #38bdf8;
  --sidebar-bg: linear-gradient(180deg, #020617 0%, #0f172a 60%, #020617 100%);
  --sidebar-active: #475569;
  --card-border-top: #475569;
  --table-head-bg: #0f172a;
  --btn-gradient: linear-gradient(135deg, #475569 0%, #1e293b 100%);
}

/* 8. Berry Rose (Merah Muda Rose Eksklusif) */
[data-theme="rose"] {
  --primary: #e11d48;
  --primary-rgb: 225, 29, 72;
  --primary-hover: #be123c;
  --primary-light: #fff1f2;
  --primary-subtle: #ffe4e6;
  --accent: #fb7185;
  --sidebar-bg: linear-gradient(180deg, #4c0519 0%, #881337 60%, #2a030d 100%);
  --sidebar-active: #f43f5e;
  --card-border-top: #e11d48;
  --table-head-bg: #881337;
  --btn-gradient: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
}

/* 9. Luxury Gold (Emas Mewah Korporat) */
[data-theme="gold"] {
  --primary: #b45309;
  --primary-rgb: 180, 83, 9;
  --primary-hover: #92400e;
  --primary-light: #fffdf5;
  --primary-subtle: #fef3c7;
  --accent: #f59e0b;
  --sidebar-bg: linear-gradient(180deg, #291c06 0%, #573a08 60%, #1a1103 100%);
  --sidebar-active: #d97706;
  --card-border-top: #b45309;
  --table-head-bg: #573a08;
  --btn-gradient: linear-gradient(135deg, #d97706 0%, #92400e 100%);
}

/* 10. Deep Forest (Hijau Rimba Zaitun) */
[data-theme="forest"] {
  --primary: #15803d;
  --primary-rgb: 21, 128, 61;
  --primary-hover: #166534;
  --primary-light: #f0fdf4;
  --primary-subtle: #dcfce7;
  --accent: #84cc16;
  --sidebar-bg: linear-gradient(180deg, #052e16 0%, #14532d 60%, #021a0c 100%);
  --sidebar-active: #22c55e;
  --card-border-top: #15803d;
  --table-head-bg: #14532d;
  --btn-gradient: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
}

/* ============================================================
   GLOBAL STYLES & LAYOUT
   ============================================================ */

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Wrapper Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* ============================================================
   SIDEBAR NAVIGATION
   ============================================================ */
.sidebar {
  width: 270px;
  background: var(--sidebar-bg);
  color: #ffffff;
  min-height: 100vh;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.25);
}

/* Collapsed Sidebar */
.app-wrapper.sidebar-collapsed .sidebar {
  width: 80px;
}

.app-wrapper.sidebar-collapsed .sidebar .sidebar-text,
.app-wrapper.sidebar-collapsed .sidebar .user-info-text,
.app-wrapper.sidebar-collapsed .sidebar .menu-category-title {
  display: none !important;
}

.app-wrapper.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding: 14px 0;
}

.app-wrapper.sidebar-collapsed .sidebar .brand-container {
  padding: 18px 0;
  text-align: center;
  justify-content: center;
}

.app-wrapper.sidebar-collapsed .sidebar .user-profile-widget {
  padding: 12px 0;
  text-align: center;
}

.app-wrapper.sidebar-collapsed .main-content-wrapper {
  margin-left: 80px;
}

/* Main Content Area */
.main-content-wrapper {
  flex: 1;
  margin-left: 270px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: #f8fafc;
}

/* Sidebar Brand */
.brand-container {
  padding: 22px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--btn-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.4);
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

/* User Profile Widget in Sidebar */
.user-profile-widget {
  padding: 18px 20px;
  margin: 15px 15px 10px 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  object-fit: cover;
}

.user-name-label {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  line-height: 1.2;
}

.user-role-label {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 500;
}

.user-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 3px;
}

/* Sidebar Menu Items */
.menu-category-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  padding: 16px 24px 6px 24px;
  font-weight: 700;
}

.sidebar-nav {
  list-style: none;
  padding: 6px 12px;
  margin: 0;
  flex: 1;
}

.sidebar-nav .nav-item {
  margin-bottom: 5px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav .nav-link i {
  font-size: 19px;
  transition: transform 0.2s ease;
  min-width: 24px;
  text-align: center;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: translateX(4px);
}

.sidebar-nav .nav-link.active {
  background: var(--btn-gradient);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.45);
}

.sidebar-nav .nav-link.active i {
  transform: scale(1.15);
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.top-navbar {
  height: 72px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.btn-nav-toggle {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--primary);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-nav-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-actions-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-action-round {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-round:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.3);
}

.notification-badge-pulse {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #ffffff;
  animation: pulseAnim 1.8s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ============================================================
   CONTENT AREA & CARDS
   ============================================================ */
.page-content-body {
  padding: 28px;
  flex: 1;
}

.page-header-title {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header-subtitle {
  font-size: 13.5px;
  color: #64748b;
  margin-bottom: 0;
}

/* Dashboard Filter Bar */
.filter-card-bar {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  padding: 18px 24px;
  margin-bottom: 24px;
}

.filter-input-control {
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-input-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
  outline: none;
}

/* Stat KPI Cards */
.stat-kpi-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  border-top: 4px solid var(--primary);
}

.stat-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.stat-kpi-card.kpi-accent { border-top-color: var(--accent); }
.stat-kpi-card.kpi-success { border-top-color: #10b981; }
.stat-kpi-card.kpi-info { border-top-color: #06b6d4; }
.stat-kpi-card.kpi-purple { border-top-color: #8b5cf6; }

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-label-text {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #64748b;
  margin-bottom: 4px;
}

.stat-value-text {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.stat-unit-text {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  margin-left: 4px;
}

/* Highlight Gold/Crown Cards for Record Info */
.record-highlight-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--primary-light) 100%);
  border: 1.5px solid rgba(var(--primary-rgb), 0.25);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 4px 18px rgba(var(--primary-rgb), 0.08);
  position: relative;
  overflow: hidden;
}

.record-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 30px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--primary);
  color: #ffffff;
  margin-bottom: 12px;
}

/* Vehicle Hero Banner */
.vehicle-hero-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, var(--primary) 100%);
  color: #ffffff;
  border-radius: 18px;
  padding: 28px 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.vehicle-hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.vehicle-img-preview {
  max-width: 100%;
  height: auto;
  max-height: 190px;
  filter: drop-shadow(0 15px 15px rgba(0,0,0,0.45));
  transition: transform 0.3s;
}

.vehicle-img-preview:hover {
  transform: scale(1.03) translateY(-4px);
}

.nopol-badge-plate {
  display: inline-block;
  background: #000000;
  color: #ffffff;
  font-family: 'Segoe UI', monospace, sans-serif;
  font-weight: 800;
  font-size: 16px;
  padding: 4px 14px;
  border-radius: 6px;
  border: 1.5px solid #ffffff;
  letter-spacing: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Modern Tables */
.table-modern-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  margin-bottom: 28px;
}

.table-modern-card .card-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-modern thead th {
  background: var(--table-head-bg) !important;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 13px 12px;
  vertical-align: middle;
  border: none;
}

.table-modern tbody td {
  padding: 13px 12px;
  font-size: 13.5px;
  vertical-align: middle;
  border-color: #f1f5f9;
}

.table-modern tbody tr:hover {
  background-color: var(--primary-light) !important;
}

/* Buttons Modern */
.btn-modern-primary {
  background: var(--btn-gradient);
  border: none;
  color: #ffffff;
  font-weight: 600;
  border-radius: 9px;
  padding: 9px 18px;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-modern-primary:hover {
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.45);
}

/* Palette Color Picker Modal Buttons */
.theme-swatch-card {
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
}

.theme-swatch-card:hover {
  border-color: var(--primary);
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.theme-swatch-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}

.swatch-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Notification Drawer Offcanvas */
.notification-item-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  margin-bottom: 10px;
  background: #ffffff;
  transition: all 0.2s;
}

.notification-item-card:hover {
  background: var(--primary-light);
  border-color: var(--primary-subtle);
}

.notification-item-card.unread {
  border-left: 4px solid var(--primary);
  background: #f8fafc;
}

/* Responsive Rules */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .app-wrapper.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }
  .main-content-wrapper {
    margin-left: 0 !important;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1030;
  }
  .app-wrapper.mobile-sidebar-open .sidebar-backdrop {
    display: block;
  }
}

/* User & Profile Avatar Styling */
.user-avatar-img, .manager-avatar, .driver-avatar, .avatar-preview-box, img.rounded-circle {
  object-fit: cover !important;
  border-radius: 50% !important;
}
