/* DataViz AI — Style Sheet */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Sidebar Nav Buttons */
.sidebar-nav-btn {
  color: #6b7280;
  transition: all 0.15s ease;
}
.dark .sidebar-nav-btn {
  color: #9ca3af;
}
.sidebar-nav-btn:hover {
  background-color: #f3f4f6;
  color: #111827;
}
.dark .sidebar-nav-btn:hover {
  background-color: #1f2937;
  color: #f9fafb;
}
.sidebar-nav-btn.active {
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
  color: #2563eb;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}
.dark .sidebar-nav-btn.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(99, 102, 241, 0.15));
  color: #60a5fa;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.3);
}

/* KPI Cards */
.kpi-card {
  background: white;
  border-radius: 1rem;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.dark .kpi-card {
  background: #111827;
  border-color: #1f2937;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 1rem 1rem 0 0;
}
.kpi-card.blue::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.kpi-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-card.orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.kpi-card.red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.kpi-card.teal::before { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }

.kpi-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  margin: 0.5rem 0 0.25rem;
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}
.kpi-change.up { background: #dcfce7; color: #16a34a; }
.dark .kpi-change.up { background: rgba(22, 163, 74, 0.15); color: #4ade80; }
.kpi-change.down { background: #fee2e2; color: #dc2626; }
.dark .kpi-change.down { background: rgba(220, 38, 38, 0.15); color: #f87171; }

/* Chart cards hover effect */
.chart-card {
  transition: box-shadow 0.2s ease;
}
.chart-card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* Drop zone animations */
#drop-zone.drag-over {
  border-color: #3b82f6;
  background-color: #eff6ff;
  transform: scale(1.01);
}
.dark #drop-zone.drag-over {
  background-color: rgba(59, 130, 246, 0.1);
}

/* Insight cards */
.insight-card {
  background: white;
  border-radius: 1rem;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.dark .insight-card {
  background: #111827;
  border-color: #1f2937;
}
.insight-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.insight-card .insight-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  margin-bottom: 0.875rem;
}
.insight-card .insight-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 0.25rem;
}
.dark .insight-card .insight-value {
  color: #f9fafb;
}
.insight-card .insight-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}
.insight-card .insight-desc {
  font-size: 0.7rem;
  color: #9ca3af;
  line-height: 1.5;
}

/* Data table row hover */
#data-tbody tr:hover {
  background-color: #f9fafb;
}
.dark #data-tbody tr:hover {
  background-color: #1f2937;
}

/* Chat messages */
.chat-msg-user {
  display: flex;
  justify-content: flex-end;
}
.chat-msg-user .bubble {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  border-radius: 1rem;
  border-top-right-radius: 0.25rem;
  padding: 0.625rem 1rem;
  max-width: 20rem;
  font-size: 0.875rem;
}

.chat-msg-ai {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.chat-msg-ai .bubble {
  background: #f3f4f6;
  color: #111827;
  border-radius: 1rem;
  border-top-left-radius: 0.25rem;
  padding: 0.625rem 1rem;
  max-width: 24rem;
  font-size: 0.875rem;
}
.dark .chat-msg-ai .bubble {
  background: #1f2937;
  color: #f9fafb;
}

/* Loading animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

/* Progress bar */
.progress-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
.dark ::-webkit-scrollbar-thumb { background: #374151; }
.dark ::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* Sidebar visible */
#sidebar {
  display: none;
}
#sidebar.show {
  display: flex;
}

/* Responsive */
@media (max-width: 768px) {
  .kpi-value { font-size: 1.25rem; }
  #sidebar.show { width: 100%; position: fixed; z-index: 40; height: calc(100vh - 57px); top: 57px; }
}
