/* ============================================
   ARTIZENCE MARITIME INTELLIGENCE
   Design System & Global Styles
   Blue-White Premium Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  /* Primary Blues */
  --primary-900: #0A1628;
  --primary-800: #0F2140;
  --primary-700: #142D58;
  --primary-600: #1A3A6E;
  --primary-500: #2563EB;
  --primary-400: #3B82F6;
  --primary-300: #60A5FA;
  --primary-200: #93C5FD;
  --primary-100: #DBEAFE;
  --primary-50: #EFF6FF;

  /* Accent */
  --accent-cyan: #06B6D4;
  --accent-teal: #14B8A6;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;
  --accent-violet: #8B5CF6;
  --accent-orange: #F97316;

  /* Neutrals */
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Functional */
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #0A1628 0%, #1E3A5F 50%, #2563EB 100%);
  --gradient-card: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(241,245,249,0.9) 100%);
  --gradient-blue: linear-gradient(135deg, #2563EB 0%, #06B6D4 100%);
  --gradient-dark: linear-gradient(180deg, #0A1628 0%, #1E293B 100%);
  --gradient-hero: linear-gradient(135deg, #0A1628 0%, #142D58 40%, #1A3A6E 70%, #2563EB 100%);
  --gradient-sidebar: linear-gradient(180deg, #0A1628 0%, #0F2140 50%, #142D58 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
  --shadow-blue: 0 4px 14px rgba(37,99,235,0.25);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.04);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary-900);
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

img { max-width: 100%; }

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  transition: var(--transition-base);
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  transition: var(--transition-fast);
  background: var(--white);
  color: var(--gray-800);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ============================================
   LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gradient-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow);
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 72px;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: var(--gradient-blue);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--shadow-blue);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand h2 {
  color: white;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.sidebar-brand span {
  color: var(--primary-300);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  color: var(--primary-300);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 8px 12px 6px;
  opacity: 0.7;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition-fast);
  margin-bottom: 2px;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-item.active {
  background: rgba(37,99,235,0.2);
  color: white;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary-400);
  border-radius: 0 4px 4px 0;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-rose);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.ai {
  background: var(--gradient-blue);
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-info p {
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-user-info span {
  color: var(--gray-400);
  font-size: 11px;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Top Header ---- */
.top-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.92);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-400);
}

.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--primary-500); }
.breadcrumb .current { color: var(--primary-600); font-weight: 600; }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-search {
  position: relative;
}

.header-search input {
  width: 260px;
  padding: 8px 14px 8px 36px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 13px;
}

.header-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}

.header-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  font-size: 16px;
  position: relative;
}

.header-btn:hover {
  background: var(--primary-50);
  color: var(--primary-500);
  border-color: var(--primary-200);
}

.header-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--accent-rose);
  border-radius: 50%;
  border: 2px solid white;
}

/* ---- Page Content ---- */
.page-content {
  flex: 1;
  padding: 24px 28px;
}

/* ============================================
   COMPONENTS
   ============================================ */

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-card);
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
}

.kpi-card.blue::before { background: var(--gradient-blue); }
.kpi-card.green::before { background: linear-gradient(90deg, #10B981, #14B8A6); }
.kpi-card.amber::before { background: linear-gradient(90deg, #F59E0B, #F97316); }
.kpi-card.rose::before { background: linear-gradient(90deg, #F43F5E, #EC4899); }
.kpi-card.violet::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.kpi-card.cyan::before { background: linear-gradient(90deg, #06B6D4, #22D3EE); }

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-icon.blue { background: var(--primary-50); color: var(--primary-500); }
.kpi-icon.green { background: #ECFDF5; color: var(--accent-emerald); }
.kpi-icon.amber { background: #FFFBEB; color: var(--accent-amber); }
.kpi-icon.rose { background: #FFF1F2; color: var(--accent-rose); }
.kpi-icon.violet { background: #F5F3FF; color: var(--accent-violet); }
.kpi-icon.cyan { background: #ECFEFF; color: var(--accent-cyan); }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.kpi-trend.up { background: #ECFDF5; color: #059669; }
.kpi-trend.down { background: #FEF2F2; color: #DC2626; }

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-900);
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--primary-400);
}

.card-body {
  padding: 20px;
}

.card-body.no-padding {
  padding: 0;
}

/* ---- Grid Layouts ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.grid-1-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  background: var(--gray-50);
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: var(--primary-50);
}

.data-table .ship-name {
  font-weight: 600;
  color: var(--primary-900);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.active { background: #ECFDF5; color: #059669; }
.badge.inactive { background: #FEF2F2; color: #DC2626; }
.badge.transit { background: #EFF6FF; color: #2563EB; }
.badge.loading { background: #FFFBEB; color: #D97706; }
.badge.idle { background: #F1F5F9; color: #64748B; }
.badge.aframax { background: #DBEAFE; color: #1D4ED8; }
.badge.mr { background: #E0E7FF; color: #4338CA; }
.badge.lr2 { background: #ECFDF5; color: #059669; }
.badge.vlcc { background: #FEF3C7; color: #B45309; }
.badge.suezmax { background: #FCE7F3; color: #BE185D; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: var(--transition-base);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-blue);
  color: white;
  box-shadow: var(--shadow-blue);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-500);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--primary-50);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

/* ---- Status Dots ---- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.status-dot.offline { background: var(--gray-300); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px rgba(245,158,11,0.2); }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--gray-100);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-fast);
  background: none;
}

.tab:hover {
  color: var(--primary-500);
  background: var(--primary-50);
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}

.tab.active {
  color: var(--primary-600);
  font-weight: 600;
  border-bottom-color: var(--primary-500);
}

/* ---- AI Glow Effect ---- */
.ai-glow {
  position: relative;
}

.ai-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #3B82F6, #06B6D4, #8B5CF6, #3B82F6);
  background-size: 300% 300%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s;
  animation: gradient-rotate 4s ease infinite;
}

.ai-glow:hover::after {
  opacity: 1;
}

@keyframes gradient-rotate {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---- AI Feature Card ---- */
.ai-feature-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.ai-feature-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(59,130,246,0.06) 0%, transparent 70%);
  transition: var(--transition-slow);
}

.ai-feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-200);
}

.ai-feature-card:hover::before {
  top: -30%;
  right: -30%;
}

.ai-feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
  background: var(--gradient-blue);
  color: white;
  box-shadow: var(--shadow-blue);
}

.ai-feature-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.ai-feature-card p {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
}

/* ---- Floating AI Assistant ---- */
.ai-assistant-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
}

.ai-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gradient-blue);
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,99,235,0.4);
  transition: var(--transition-base);
  position: relative;
}

.ai-fab-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(37,99,235,0.5);
}

.ai-fab-btn .pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary-400);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ---- AI Chat Panel ---- */
.ai-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 400px;
  max-height: 560px;
  background: var(--white);
  border-radius: var(--border-radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: var(--transition-slow);
}

.ai-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.ai-chat-header {
  padding: 16px 20px;
  background: var(--gradient-hero);
  border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ai-chat-header-info h4 {
  color: white;
  font-size: 14px;
}

.ai-chat-header-info span {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chat-header-info span .status-dot {
  width: 6px;
  height: 6px;
}

.ai-chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.ai-chat-close:hover {
  background: rgba(255,255,255,0.25);
}

.ai-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
}

.chat-msg {
  display: flex;
  gap: 8px;
  animation: msg-in 0.3s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.ai .chat-bubble {
  background: var(--primary-50);
  color: var(--gray-800);
  border-radius: 4px 14px 14px 14px;
  border: 1px solid var(--primary-100);
}

.chat-msg.user {
  flex-direction: row-reverse;
}

.chat-msg.user .chat-bubble {
  background: var(--gradient-blue);
  color: white;
  border-radius: 14px 4px 14px 14px;
}

.chat-bubble {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 80%;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  background: var(--primary-100);
  color: var(--primary-600);
}

.chat-msg.user .chat-msg-avatar {
  background: var(--gray-200);
  color: var(--gray-600);
}

.ai-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-input-area input {
  flex: 1;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13px;
}

.ai-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ai-chat-send:hover {
  transform: scale(1.08);
}

/* ---- Quick Suggestions ---- */
.quick-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.quick-suggestion {
  padding: 6px 12px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: 20px;
  font-size: 11.5px;
  color: var(--primary-600);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.quick-suggestion:hover {
  background: var(--primary-100);
  border-color: var(--primary-200);
}

/* ---- Map Container ---- */
.map-container {
  width: 100%;
  height: 400px;
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
}

.map-container #fleet-map {
  width: 100%;
  height: 100%;
}

/* ---- Notification Panel ---- */
.notification-dot {
  position: relative;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  display: none;
  z-index: 999;
}

.notification-dropdown.show {
  display: block;
  animation: dropdown-in 0.2s ease;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- OCR Zone ---- */
.ocr-drop-zone {
  border: 2px dashed var(--primary-300);
  border-radius: var(--border-radius-lg);
  padding: 48px;
  text-align: center;
  transition: var(--transition-base);
  background: var(--primary-50);
  cursor: pointer;
}

.ocr-drop-zone:hover, .ocr-drop-zone.dragover {
  border-color: var(--primary-500);
  background: var(--primary-100);
  transform: scale(1.01);
}

.ocr-drop-zone i {
  font-size: 48px;
  color: var(--primary-300);
  margin-bottom: 16px;
}

.ocr-drop-zone h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.ocr-drop-zone p {
  font-size: 13px;
  color: var(--gray-500);
}

/* ---- Progress Bar ---- */
.progress-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--gradient-blue);
  transition: width 0.6s ease;
}

/* ---- Select Dropdown ---- */
.select-wrapper {
  position: relative;
}

.select-wrapper select {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

.select-wrapper::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

/* ---- Charts ---- */
.chart-container {
  position: relative;
  width: 100%;
}

/* ---- Typing Indicator ---- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: typing-bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ---- Loading Shimmer ---- */
.shimmer {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---- Report Cards ---- */
.report-template {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 20px;
  transition: var(--transition-base);
  cursor: pointer;
  background: var(--white);
}

.report-template:hover {
  border-color: var(--primary-300);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.report-template.selected {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ---- Toggle Switch ---- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary-500);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.animate-in {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-in-delay-1 { animation-delay: 0.1s; opacity: 0; }
.animate-in-delay-2 { animation-delay: 0.2s; opacity: 0; }
.animate-in-delay-3 { animation-delay: 0.3s; opacity: 0; }
.animate-in-delay-4 { animation-delay: 0.4s; opacity: 0; }
.animate-in-delay-5 { animation-delay: 0.5s; opacity: 0; }

/* ---- Responsive ---- */
@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }
  .main-content {
    margin-left: var(--sidebar-collapsed);
  }
  .sidebar-brand, .nav-section-title, .nav-item span, .sidebar-user-info, .nav-badge {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .grid-2-1, .grid-1-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  .ai-chat-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 88px;
  }
  .page-content {
    padding: 16px;
  }
}

/* ---- Tooltip ---- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--gray-900);
  color: white;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state i {
  font-size: 48px;
  color: var(--gray-300);
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13px;
  color: var(--gray-400);
  max-width: 360px;
  margin: 0 auto 20px;
}

/* ---- Section Header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 20px;
}

.section-header .actions {
  display: flex;
  gap: 8px;
}

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-100);
}

.filter-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-bar select, .filter-bar input {
  padding: 8px 12px;
  font-size: 13px;
}
