@import url('https://fonts.googleapis.com/css2?family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Kanit:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #080d1a;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(96, 165, 250, 0.3);
  --glass-inner-glow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-sky: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
  --accent-emerald: #34d399;
  --accent-purple: #c084fc;
}

/* ======================================================== */
/* LUXURY EXECUTIVE LIGHT THEME */
/* ======================================================== */
.light-theme {
  --bg-primary: #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --glass-border: rgba(226, 232, 240, 0.85);
  --glass-border-hover: rgba(37, 99, 235, 0.4);
  --glass-inner-glow: inset 0 1px 1px 0 rgba(255, 255, 255, 1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent-sky: #0284c7;
  --accent-blue: #2563eb;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-emerald: #059669;
  --accent-purple: #7c3aed;
}

* {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Kanit', sans-serif;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(244, 63, 94, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.light-theme body {
  background-color: #f4f6fb;
  background-image: 
    radial-gradient(at 0% 0%, rgba(219, 234, 254, 0.65) 0px, transparent 45%),
    radial-gradient(at 100% 0%, rgba(237, 233, 254, 0.55) 0px, transparent 45%),
    radial-gradient(at 50% 50%, rgba(224, 242, 254, 0.45) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(254, 226, 226, 0.4) 0px, transparent 45%);
}

/* Glassmorphism Styles */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner-glow), 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  border-radius: 1.25rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.light-theme .glass-panel {
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
}

.glass-panel:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-inner-glow), 0 12px 40px 0 rgba(0, 0, 0, 0.35);
}

.light-theme .glass-panel:hover {
  box-shadow: 0 10px 25px -4px rgba(37, 99, 235, 0.1), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

.glass-nav {
  background: rgba(10, 15, 29, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--glass-border);
}

.light-theme .glass-nav {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.glass-card-subtle {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 1.25rem;
  transition: all 0.25s ease;
}

.glass-card-subtle:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.light-theme .glass-card-subtle {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.light-theme .glass-card-subtle:hover {
  background: #ffffff;
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.08);
}

/* Category Accent Cards */
.category-hub-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner-glow), 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.light-theme .category-hub-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 25px -4px rgba(0, 0, 0, 0.05);
}

.category-hub-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glass-inner-glow), 0 20px 40px rgba(0, 0, 0, 0.35);
  border-color: var(--hub-accent, rgba(59, 130, 246, 0.4));
}

.light-theme .category-hub-card:hover {
  box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.08);
}

.category-hub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--hub-accent, #3b82f6), transparent);
  opacity: 0.9;
}

/* Navigation Tabs */
.nav-tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.25s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.light-theme .nav-tab-btn {
  color: #475569;
}

.light-theme .nav-tab-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.nav-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.light-theme .nav-tab-btn.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

/* Map Switcher Pills */
.map-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-filter-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.light-theme .map-filter-pill {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.light-theme .map-filter-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.map-filter-pill.active {
  color: #ffffff;
  background: #2563eb;
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.light-theme .map-filter-pill.active {
  color: #ffffff !important;
  background: #2563eb;
  border-color: #2563eb;
}

/* Pulse badge */
.pulse-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background-color: inherit;
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Map Containers */
.map-container {
  border-radius: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.light-theme .map-container {
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.leaflet-popup-content-wrapper {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-radius: 1rem !important;
  padding: 4px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6) !important;
}

.light-theme .leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12) !important;
}

.leaflet-popup-tip {
  background: #0f172a !important;
}

.light-theme .leaflet-popup-tip {
  background: #ffffff !important;
}

.leaflet-popup-content {
  margin: 10px 12px !important;
  line-height: 1.4 !important;
  font-family: 'Prompt', sans-serif !important;
}

/* Pins */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease;
}

.custom-pin:hover {
  transform: scale(1.25) translateY(-2px);
}

.pin-seizure { background: linear-gradient(135deg, #0284c7, #0369a1); }
.pin-general { background: linear-gradient(135deg, #d97706, #b45309); }
.pin-psychiatric { background: linear-gradient(135deg, #e11d48, #be123c); }
.pin-location { background: linear-gradient(135deg, #059669, #047857); }

/* Specialized IPB Pins (Feature 4) */
.pin-loc-gov { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #93c5fd; }
.pin-loc-hospital { background: linear-gradient(135deg, #ef4444, #b91c1c); border-color: #fca5a5; }
.pin-loc-school { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: #fde68a; }
.pin-loc-hotel { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-color: #ddd6fe; }
.pin-loc-food { background: linear-gradient(135deg, #10b981, #047857); border-color: #a7f3d0; }
.pin-loc-other { background: linear-gradient(135deg, #06b6d4, #0e7490); border-color: #a5f3fc; }

/* Custom Marker Cluster Styling (Feature 2) */
.marker-cluster-small {
  background-color: rgba(37, 99, 235, 0.35) !important;
  border-radius: 50% !important;
}
.marker-cluster-small div {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-family: 'Kanit', sans-serif !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
}

.marker-cluster-medium {
  background-color: rgba(217, 119, 6, 0.35) !important;
  border-radius: 50% !important;
}
.marker-cluster-medium div {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-family: 'Kanit', sans-serif !important;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.45) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
}

.marker-cluster-large {
  background-color: rgba(225, 29, 72, 0.35) !important;
  border-radius: 50% !important;
}
.marker-cluster-large div {
  background: linear-gradient(135deg, #e11d48, #be123c) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-family: 'Kanit', sans-serif !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.45) !important;
  border: 2px solid rgba(255, 255, 255, 0.9) !important;
}

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

.modern-table th {
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.light-theme .modern-table th {
  background: #f8fafc !important;
  color: #475569 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.modern-table td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  transition: background-color 0.15s ease;
}

.light-theme .modern-table td {
  color: #1e293b !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

.modern-table tbody tr:hover td {
  background-color: var(--bg-card-hover);
}

.light-theme .modern-table tbody tr:hover td {
  background-color: #f8fafc !important;
}

.modern-table tbody tr:last-child td {
  border-bottom: none;
}

/* Modals */
.modal-overlay {
  animation: fadeIn 0.2s ease-out forwards;
}

.modal-content {
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ApexCharts dark/light styling */
.apexcharts-legend-series {
  cursor: pointer !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: all 0.2s ease !important;
  padding: 4px 8px !important;
  border-radius: 8px !important;
}

.apexcharts-legend-series:hover,
.apexcharts-legend-series:active,
.apexcharts-legend-series.legend-item-active {
  transform: translateY(-1px) scale(1.05) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.light-theme .apexcharts-legend-series:hover,
.light-theme .apexcharts-legend-series:active,
.light-theme .apexcharts-legend-series.legend-item-active {
  background: rgba(2, 132, 199, 0.12) !important;
}

.apexcharts-tooltip {
  background: #0f172a !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

.light-theme .apexcharts-tooltip {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

/* ======================================================== */
/* SPECIFIC COMPONENT ADAPTATIONS FOR LIGHT THEME */
/* ======================================================== */
.light-theme .text-white {
  color: #0f172a !important;
}

.light-theme .text-slate-100,
.light-theme .text-slate-200,
.light-theme .text-slate-300 {
  color: #1e293b !important;
}

.light-theme .text-slate-400 {
  color: #475569 !important;
}

.light-theme .text-slate-500 {
  color: #64748b !important;
}

.light-theme .bg-slate-900\/50,
.light-theme .bg-slate-900\/60,
.light-theme .bg-slate-800\/60,
.light-theme .bg-slate-800\/50,
.light-theme .bg-slate-800\/80,
.light-theme .bg-slate-800 {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

.light-theme input,
.light-theme select {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

.light-theme input::placeholder {
  color: #94a3b8 !important;
}

.light-theme .modal-content {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15) !important;
  color: #0f172a !important;
}

.light-theme .flatpickr-calendar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

.light-theme .flatpickr-months .flatpickr-month,
.light-theme .flatpickr-current-month,
.light-theme span.flatpickr-weekday {
  background: #ffffff !important;
  color: #0f172a !important;
}

.light-theme .flatpickr-day {
  color: #1e293b !important;
}

.light-theme .flatpickr-day.prevMonthDay,
.light-theme .flatpickr-day.nextMonthDay {
  color: #94a3b8 !important;
}

.light-theme .flatpickr-day.selected,
.light-theme .flatpickr-day.startRange,
.light-theme .flatpickr-day.endRange {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

.light-theme .flatpickr-day.inRange {
  background: #eff6ff !important;
  border-color: transparent !important;
  color: #1d4ed8 !important;
}

/* ======================================================== */
/* MOBILE-FIRST RESPONSIVE OPTIMIZATIONS */
/* ======================================================== */
@media (max-width: 768px) {
  body {
    padding-bottom: 5.5rem;
    font-size: 14px;
  }
  
  .glass-nav {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.6rem !important;
    padding-bottom: 0.6rem !important;
  }

  .glass-panel {
    border-radius: 1rem;
    padding: 0.875rem !important;
  }

  .category-hub-card {
    border-radius: 1.15rem;
  }

  input, select, button {
    font-size: 13px !important;
    min-height: 38px;
  }

  .mobile-record-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
  }

  .mobile-record-card:active {
    transform: scale(0.99);
  }

  .light-theme .mobile-record-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    background: rgba(10, 15, 29, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.4rem 0.25rem env(safe-area-inset-bottom, 0.4rem);
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.4);
  }

  .light-theme .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.25rem;
    border-radius: 0.75rem;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  .mobile-nav-item i {
    font-size: 16px;
    margin-bottom: 2px;
  }

  .mobile-nav-item.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
  }

  .light-theme .mobile-nav-item.active {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
  }

  .map-container {
    height: 280px !important;
  }
}
