@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg-dark: #070a12;
  --bg-sidebar: rgba(10, 14, 23, 0.65);
  --bg-card: rgba(18, 25, 40, 0.45);
  --bg-card-hover: rgba(30, 42, 68, 0.65);
  
  --border-color: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(6, 182, 212, 0.45);

  --primary: #00f0ff;
  --primary-glow: rgba(0, 240, 255, 0.5);
  --primary-hover: #00d4ff;
  
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;

  --status-fluid: #10b981;
  --status-dense: #eab308;
  --status-slow: #f97316;
  --status-jammed: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --sidebar-width: 420px;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

h1, h2, h3, h4, .brand-font {
  font-family: 'Space Grotesk', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Main Container */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Sidebar Layout */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  z-index: 100;
  background: var(--bg-sidebar);
  backdrop-filter: blur(32px) saturate(150%);
  -webkit-backdrop-filter: blur(32px) saturate(150%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: 15px 0 40px rgba(0, 0, 0, 0.6);
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Minimalist Google-like Tabs */
.nav-tabs {
  display: flex;
  justify-content: space-around;
  padding: 0 1rem 1rem;
  gap: 0.2rem;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
  flex: 1;
  padding: 0.5rem 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn i {
  font-size: 1.15rem;
  margin-bottom: 0.1rem;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--primary);
  background: transparent;
  position: relative;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--primary);
  box-shadow: 0 -2px 10px var(--primary-glow);
}

/* Sidebar Scrollable Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section Title */
.section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Live Traffic Summary Cards (Ultra Minimal Glass) */
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.status-card {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.3s ease;
}
.status-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.status-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.status-val {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.status-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Filter Buttons */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.8rem;
  margin-bottom: 1.5rem;
}
.filter-bar::-webkit-scrollbar { height: 0px; }

.filter-chip {
  padding: 0.4rem 1rem;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.filter-chip.active {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid var(--border-glow);
  color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

/* Event List Cards */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.event-card {
  padding: 1.1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.event-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.event-category-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
}

.event-category-badge.accident { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.event-category-badge.traffic { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.event-category-badge.works { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.event-category-badge.weather { background: rgba(6, 182, 212, 0.15); color: #38bdf8; border: 1px solid rgba(6, 182, 212, 0.3); }
.event-category-badge.hazard { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }

.event-time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.event-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.event-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.ai-summary-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #cbd5e1;
}

.ai-summary-tag {
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}

.event-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
}

.vote-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.vote-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

/* Floating Controls Overlay */
.top-overlay {
  position: absolute;
  top: 1.25rem;
  left: calc(var(--sidebar-width) + 1.25rem);
  right: 1.25rem;
  z-index: 50;
  display: flex;
  gap: 1rem;
  align-items: center;
  pointer-events: none;
}

.search-container {
  flex: 1;
  max-width: 480px;
  pointer-events: auto;
  background: rgba(10, 14, 23, 0.5);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.92rem;
}

.map-layer-pills {
  pointer-events: auto;
  background: rgba(10, 14, 23, 0.5);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.05);
}

.layer-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.layer-pill.active {
  background: var(--primary);
  color: #070a12;
}

/* Floating Action Buttons */
.btn-floating-report {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  padding: 0.95rem 1.6rem;
  border-radius: 40px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: white;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 12px 30px rgba(239, 68, 68, 0.45);
  transition: all 0.25s ease;
}

.btn-floating-report:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 36px rgba(239, 68, 68, 0.65);
}

.btn-floating-gps {
  position: absolute;
  bottom: 6rem;
  right: 2rem;
  z-index: 50;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  color: var(--primary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.btn-floating-gps:hover {
  transform: scale(1.1);
  border-color: var(--primary);
  box-shadow: 0 0 20px var(--primary-glow);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 90%;
  max-width: 540px;
  background: #0d121f;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: white;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn-primary-action {
  width: 100%;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #070a12;
  font-weight: 800;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.btn-primary-action:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Toast Container */
.toast-stack {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Toast Notifications */
.toast-notification {
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-lg);
  background: rgba(13, 17, 28, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  color: white;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-notification.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-msg {
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-lg);
  background: rgba(13, 17, 28, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  color: white;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.3s ease;
}

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

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: rgba(13, 17, 28, 0.96);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
}

/* Form Elements */
.form-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.form-select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: white;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}
.form-select option {
  background: #0d111c;
  color: white;
}
.form-textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: white;
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Floating Buttons */
.btn-floating-gps {
  position: absolute;
  bottom: 7rem;
  right: 1.2rem;
  z-index: 800;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-glow);
  background: rgba(13, 17, 28, 0.45);
  backdrop-filter: blur(24px) saturate(180%);
  color: var(--primary);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(255, 255, 255, 0.1);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-floating-gps:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.08);
}
.btn-floating-report {
  position: absolute;
  bottom: 2.5rem;
  right: 1.2rem;
  z-index: 800;
  padding: 0.75rem 1.4rem;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--accent-indigo));
  color: white;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--primary-glow);
  transition: all 0.2s ease;
}
.btn-floating-report:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: 50vh;
    position: absolute;
    bottom: 0;
  }
  .top-overlay {
    left: 1rem;
    right: 1rem;
  }
  .map-layer-pills {
    display: none;
  }
}
