/* ==========================================================================
   TOPLIVO MVP STYLESHEET
   Clean, modern, high-contrast dashboard with orange brand accent.
   ========================================================================== */

:root {
  --color-brand-orange: #fe7f2d;
  --color-brand-orange-hover: #ea6b17;
  --color-brand-orange-glow: rgba(254, 127, 45, 0.2);
  
  --color-bg-app: #0c151c;
  --color-bg-sidebar: #0e1821;
  --color-bg-card: #13222e;
  --color-bg-card-hover: #1b2d3d;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-card: rgba(35, 61, 77, 0.6);
  --color-border-subtle: rgba(255, 255, 255, 0.05);

  --color-text-main: #f4f8fb;
  --color-text-muted: #9ab2c4;
  --color-text-dim: #6f889c;

  --color-ai-92: #38bdf8;
  --color-ai-95: #4ade80;
  --color-ai-100: #c084fc;
  --color-dt: #fbbf24;
  --color-gas: #2dd4bf;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Outfit', var(--font-family);
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --spring-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  height: 56px;
  background: var(--color-brand-orange);
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  user-select: none;
}

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

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

.logo-drop-icon {
  fill: #0f172a;
}

.logo-image {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease;
}

.logo-image:hover {
  transform: scale(1.05);
}

.logo-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.badge-region {
  background: rgba(15, 23, 42, 0.15);
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.2);
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.status-dot.pulse {
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.status-text {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.btn-icon {
  background: rgba(15, 23, 42, 0.15);
  border: none;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(15, 23, 42, 0.3);
  transform: rotate(30deg);
}

/* ==========================================================================
   MAIN LAYOUT
   ========================================================================== */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-main {
  display: flex;
  flex: 1;
  height: calc(100vh - 56px);
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   MAP SECTION (LEFT)
   ========================================================================== */
.map-section {
  flex: 1;
  position: relative;
  height: 100%;
  background: #0b1120;
}

.map-canvas {
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Floating Controls Bar over Map */
.map-controls-bar {
  position: absolute;
  top: 14px;
  left: 56px;
  right: 14px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--color-border);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  min-width: 240px;
  flex: 1;
}

.search-icon {
  color: var(--color-text-dim);
}

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

.search-box input::placeholder {
  color: var(--color-text-dim);
}

.fuel-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.chip-filter {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.chip-filter:hover {
  background: rgba(51, 65, 85, 0.9);
  color: var(--color-text-main);
}

.chip-filter.active {
  background: var(--color-brand-orange);
  color: #ffffff;
  border-color: var(--color-brand-orange);
  font-weight: 600;
  box-shadow: 0 0 10px var(--color-brand-orange-glow);
}

.bases-count-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-dim);
  padding: 4px 8px;
  border-left: 1px solid var(--color-border);
  white-space: nowrap;
}

/* Map Loader */
.map-loader {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--color-text-main);
  font-size: 14px;
}

.map-loader.hidden {
  display: none;
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-brand-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   CUSTOM MAP MARKERS & POPUP
   ========================================================================== */
.custom-map-pin {
  background: transparent;
  border: none;
}

.pin-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin-badge {
  background: #0f172a;
  color: #f8fafc;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--color-brand-orange);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  margin-bottom: 2px;
  letter-spacing: 0.2px;
}

.pin-drop {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle at 35% 35%, #f97316 0%, #c2410c 100%);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  border: 2px solid #ffffff;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-drop svg {
  transform: rotate(45deg);
}

.pin-wrapper:hover .pin-drop {
  transform: scale(1.15) rotate(-45deg);
}

/* Popup styling */
.leaflet-popup-content-wrapper {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5) !important;
  border: 1px solid var(--color-border-subtle) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 14px 16px !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  background: #1e293b !important;
}

.leaflet-control-attribution svg {
  display: none !important;
}

.popup-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.popup-title {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.popup-city {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 12px;
  white-space: nowrap;
}

.popup-address {
  font-size: 12px;
  color: var(--color-text-muted);
}

.popup-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-dim);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 4px;
  margin-top: 4px;
}

.popup-fuels-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

.popup-fuel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 23, 42, 0.5);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.pf-name {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.pf-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, rgb(249, 115, 22) 0%, rgb(234, 88, 12) 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 1px 3px rgba(234, 88, 12, 0.25);
  display: inline-flex;
  align-items: center;
}

.pf-92,
.pf-95,
.pf-100,
.pf-dt,
.pf-gas,
.pf-other {
  background: linear-gradient(135deg, rgb(249, 115, 22) 0%, rgb(234, 88, 12) 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.pf-title {
  font-size: 11px;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.pf-price {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  white-space: nowrap;
}

.popup-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 6px;
}

.popup-accuracy-badge, .base-accuracy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.popup-accuracy-badge.is-approx, .base-accuracy-badge.is-approx, .cdb-badge.is-approx {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.popup-accuracy-badge.is-exact, .base-accuracy-badge.is-exact, .cdb-badge.is-exact {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-popup {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: var(--font-family);
}

.btn-popup svg {
  flex-shrink: 0;
}

.btn-contact {
  background: var(--color-brand-orange);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(254, 127, 45, 0.3);
}

.btn-contact:hover {
  background: var(--color-brand-orange-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(254, 127, 45, 0.45);
}

.btn-route {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-route:hover {
  background: #334155;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-source {
  background: #334155;
  color: #cbd5e1;
}

.btn-source:hover {
  background: #475569;
  color: #ffffff;
}

/* ==========================================================================
   SIDEBAR (RIGHT) — Strict Industrial Minimalist (Prussian Slate & Flame)
   ========================================================================== */
.sidebar-section {
  width: 360px;
  background: var(--color-bg-sidebar);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
  z-index: 50;
}

.sidebar-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 2px;
}

.card-title-group {
  display: flex;
  flex-direction: column;
}

.card-title {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-main);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.card-subtitle {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-top: 2px;
}

.badge-status-accent {
  background: rgba(74, 222, 128, 0.1);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.25);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Best Prices List */
.best-prices-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.best-price-card {
  background: #0d1720;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 160ms var(--spring-ease), border-color 160ms var(--spring-ease), transform 140ms var(--spring-ease);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.best-price-card:hover {
  background: var(--color-bg-card-hover);
  border-color: rgba(254, 127, 45, 0.45);
  transform: translateY(-1px);
}

.best-price-card:active {
  transform: scale(0.985);
}

.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bp-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgb(249, 115, 22) 0%, rgb(234, 88, 12) 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.bp-92,
.bp-95,
.bp-100,
.bp-dt,
.bp-gas,
.bp-other {
  background: linear-gradient(135deg, rgb(249, 115, 22) 0%, rgb(234, 88, 12) 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.bp-price-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.bp-price-ton {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #f4f8fb;
  font-variant-numeric: tabular-nums;
}

.bp-price-lit {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-ai-92);
  font-variant-numeric: tabular-nums;
}

.bp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 5px;
}

.bp-location {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.bp-base-title {
  font-size: 12px;
  font-weight: 600;
  color: #f4f8fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bp-city-sub {
  font-size: 10px;
  color: var(--color-text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
}

.bp-source-sub {
  font-size: 10px;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Card 2: Parser Actions */
.parser-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* REDESIGNED LAUNCH BUTTON (High-contrast, Industrial Flame, 4px radius, tactile) */
.btn-primary-action {
  background: var(--color-brand-orange);
  color: #0c151c;
  border: 1px solid var(--color-brand-orange);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 150ms var(--spring-ease), border-color 150ms var(--spring-ease), transform 150ms var(--spring-ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-primary-action:hover {
  background: var(--color-brand-orange-hover);
  border-color: var(--color-brand-orange-hover);
  transform: translateY(-1px);
}

.btn-primary-action:active {
  transform: scale(0.98);
}

.btn-primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-svg-icon {
  flex-shrink: 0;
}

.btn-secondary-action {
  background: #101c26;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 150ms var(--spring-ease), border-color 150ms var(--spring-ease), color 150ms var(--spring-ease), transform 150ms var(--spring-ease);
}

.btn-secondary-action:hover {
  background: #192a38;
  border-color: rgba(254, 127, 45, 0.35);
  color: var(--color-text-main);
}

.btn-secondary-action:active {
  transform: scale(0.98);
}

/* Sources Telemetry Box */
.sources-status-box {
  background: #091218;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.sources-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.source-tag {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

.source-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  flex-shrink: 0;
}

.sources-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-brand-orange);
  text-align: right;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.spinner-icon {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

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

.modal-card {
  background: #1e293b;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-up 0.25s ease;
}

@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: #182234;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--color-text-dim);
  cursor: pointer;
  padding: 0 4px;
}

.btn-close-modal:hover {
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
}

.modal-body p {
  margin-bottom: 12px;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 10px;
  color: var(--color-text-muted);
}

.ai-pulse-dot {
  width: 40px;
  height: 40px;
  background: var(--color-brand-orange);
  border-radius: 50%;
  animation: pulse-orange 1.5s infinite;
}

@keyframes pulse-orange {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.ai-meta {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--color-text-dim);
}

.form-group {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-control {
  background: #0f172a;
  border: 1px solid var(--color-border);
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
}

.form-control:focus {
  border-color: var(--color-brand-orange);
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s ease;
  transition: opacity 0.4s ease;
}

.toast.fade-out {
  opacity: 0;
}

.toast-info {
  background: #1e293b;
  border-left: 4px solid var(--color-brand-orange);
  color: #ffffff;
}

.toast-success {
  background: #14532d;
  border-left: 4px solid #22c55e;
  color: #f0fdf4;
}

.toast-error {
  background: #7f1d1d;
  border-left: 4px solid #ef4444;
  color: #fef2f2;
}

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

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
    height: auto;
  }
  .app-main {
    flex-direction: column;
    height: auto;
  }
  .map-section {
    height: 60vh;
  }
  .sidebar-section {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
  .map-controls-bar {
    left: 14px;
    flex-direction: column;
    align-items: stretch;
  }
}

/* ==========================================================================
   DEMO MODE BANNER
   ========================================================================== */
.demo-mode-banner {
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  padding: 8px 20px;
  z-index: 1001;
  transition: all 0.3s ease;
}

.demo-mode-banner.hidden {
  display: none !important;
}

.banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.banner-text-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #f1f5f9;
}

.banner-badge {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.banner-message {
  line-height: 1.4;
  color: #cbd5e1;
}

.btn-banner-action {
  background: #f59e0b;
  color: #0f172a;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.btn-banner-action:hover {
  background: #d97706;
  transform: translateY(-1px);
}

/* ==========================================================================
   HEADER AUTH WIDGET
   ========================================================================== */
.auth-header-widget {
  display: flex;
  align-items: center;
}

.btn-login-header {
  background: rgba(15, 23, 42, 0.25);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.35);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-login-header:hover {
  background: rgba(15, 23, 42, 0.4);
  color: #ffffff;
}

.user-pill {
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(15, 23, 42, 0.35);
  border-radius: 20px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
}

.user-pill-name {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-header {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: #431407;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-logout-header:hover {
  color: #ffffff;
}

/* ==========================================================================
   DEMO BADGES & PINS
   ========================================================================== */
.badge-demo-accent {
  background: rgba(251, 191, 36, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(251, 191, 36, 0.3) !important;
}

.bp-demo-tag {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  margin-left: 6px;
  letter-spacing: 0.5px;
}

.pin-demo .pin-badge-demo {
  background: #d97706 !important;
  border-color: #f59e0b !important;
}

/* POPUP DEMO BANNER */
.popup-demo-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px 0 12px 0;
  font-size: 11px;
}

.pdb-text {
  color: #cbd5e1;
  line-height: 1.35;
  margin-bottom: 6px;
}

.pdb-badge {
  display: inline-block;
  background: #f59e0b;
  color: #0f172a;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 4px;
}

.btn-popup-auth {
  width: 100%;
  background: #f59e0b;
  color: #0f172a;
  border: none;
  font-weight: 700;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-popup-auth:hover {
  background: #d97706;
}

/* ==========================================================================
   MONITORING METRICS (PROTECTED STATS)
   ========================================================================== */
.monitoring-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: #cbd5e1;
}

.metric-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.metric-dot.active {
  background: #22c55e;
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.6);
}

/* ==========================================================================
   LOGIN MODAL & SECURITY
   ========================================================================== */
.modal-auth-card {
  max-width: 440px !important;
}

.modal-title-auth {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-icon-badge {
  width: 40px;
  height: 40px;
  background: rgba(254, 127, 45, 0.15);
  color: var(--color-brand-orange);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .field-icon {
  position: absolute;
  left: 12px;
  color: #64748b;
  pointer-events: none;
}

.input-with-icon .form-control {
  padding-left: 36px;
  padding-right: 36px;
}

.btn-password-toggle {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.btn-password-toggle:hover {
  color: #cbd5e1;
}

.btn-auth-submit {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  font-size: 14px;
}

.auth-security-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

.auth-security-notice svg {
  color: #22c55e;
  flex-shrink: 0;
}

.login-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.4;
  animation: shake 0.3s ease;
}

.login-alert.hidden {
  display: none !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ==========================================================================
   APP LOCKDOWN GATE (Zero-Trust Access Control)
   ========================================================================== */
body.app-locked .app-layout {
  filter: blur(8px) grayscale(50%);
  pointer-events: none;
  user-select: none;
  transition: filter 0.4s ease;
}

body.app-locked #login-modal {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  background: rgba(9, 13, 24, 0.92) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
}

body.app-locked #login-modal #btn-close-login {
  display: none !important;
}

body.app-locked #demo-mode-banner {
  display: none !important;
}

/* ==========================================================================
   CONTACT / LEAD MODAL STYLES
   ========================================================================== */
.modal-contact-card {
  max-width: 480px !important;
}

.contact-icon-badge {
  width: 42px;
  height: 42px;
  background: rgba(254, 127, 45, 0.16);
  color: var(--color-brand-orange);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(254, 127, 45, 0.15);
}

.contact-depot-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.cdb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.cdb-name {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.cdb-address {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.cdb-supplier {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.required-star {
  color: #ef4444;
}

.field-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.35;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.contact-success-box {
  text-align: center;
  padding: 24px 16px;
}

.contact-success-box.hidden {
  display: none !important;
}

.csb-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px auto;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.csb-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.csb-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 18px;
}

.btn-contact-done {
  max-width: 200px;
  margin: 0 auto;
}


