@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&display=swap");
@import "leaflet/dist/leaflet.css";

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  color-scheme: light;
  --bg-top: #f7fbff;
  --bg-bottom: #dfeef9;
  --panel: rgba(255, 255, 255, 0.86);
  --border: rgba(148, 163, 184, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html.dashboard-page,
body.dashboard-page {
  overscroll-behavior: none;
}

@media (max-width: 767px) {
  html.dashboard-page,
  body.dashboard-page {
    height: 100dvh;
    overflow: hidden;
  }
}

body {
  background:
    radial-gradient(circle at top left, rgba(79, 156, 249, 0.28), transparent 26%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.14), transparent 28%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  color: #0f172a;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
}

.neo-panel {
  background: rgba(7, 13, 28, 0.9);
  border: 2px solid rgba(74, 222, 128, 0.62);
  box-shadow:
    0 0 0 1px rgba(110, 255, 170, 0.24),
    0 0 8px rgba(74, 222, 128, 0.18),
    0 0 20px rgba(74, 222, 128, 0.2),
    0 0 32px rgba(74, 222, 128, 0.1),
    0 18px 40px rgba(2, 8, 23, 0.46),
    inset 0 0 24px rgba(74, 222, 128, 0.07);
  backdrop-filter: blur(22px) saturate(130%);
  color: #e5eefc;
}

.dashboard-header-panel {
  box-shadow:
    0 0 0 1px rgba(110, 255, 170, 0.22),
    0 0 7px rgba(74, 222, 128, 0.16),
    0 0 16px rgba(74, 222, 128, 0.16),
    0 10px 22px rgba(2, 8, 23, 0.34),
    inset 0 0 18px rgba(74, 222, 128, 0.05);
}

.neo-panel--compact {
  padding: 14px 16px;
}

.neo-panel__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.neo-panel__titlegroup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.neo-panel__icon {
  display: inline-flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  color: #68e1ff;
  box-shadow:
    inset 0 0 0 1px rgba(104, 225, 255, 0.24),
    0 0 18px rgba(56, 189, 248, 0.16);
}

.neo-panel__title {
  color: #f8fbff;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.neo-panel__body {
  margin-top: 14px;
}

.neo-panel__toggle {
  display: inline-flex;
  height: 28px;
  width: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: #c8d5ea;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.neo-panel__toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(104, 225, 255, 0.32);
  color: #f8fbff;
}

.neo-pill {
  background: rgba(7, 13, 28, 0.9);
  border: 2px solid rgba(74, 222, 128, 0.5);
  color: #d9e7fb;
  box-shadow:
    0 0 10px rgba(74, 222, 128, 0.18),
    0 0 24px rgba(74, 222, 128, 0.22),
    0 12px 28px rgba(2, 8, 23, 0.42),
    inset 0 0 18px rgba(74, 222, 128, 0.06);
  backdrop-filter: blur(18px) saturate(130%);
}

.neo-panel .neo-field,
.neo-panel select,
.neo-panel input[type="date"],
.neo-panel input[type="time"],
.neo-panel input[type="datetime-local"] {
  border-color: rgba(104, 225, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #f8fbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  color-scheme: dark;
}

.neo-panel input[type="date"]::-webkit-calendar-picker-indicator,
.neo-panel input[type="time"]::-webkit-calendar-picker-indicator,
.neo-panel input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.9;
  cursor: pointer;
}

.neo-panel select option {
  color: #0f172a;
}

.neo-panel .neo-subcard {
  border: 2px solid rgba(74, 222, 128, 0.34);
  background: rgba(255, 255, 255, 0.04);
  box-shadow:
    0 0 8px rgba(74, 222, 128, 0.12),
    0 0 18px rgba(74, 222, 128, 0.14),
    inset 0 0 20px rgba(74, 222, 128, 0.04);
}

.neo-panel .neo-soft-text {
  color: #8fa9ca;
}

.neo-panel .neo-emphasis {
  color: #f8fbff;
}

.neo-panel .neo-label {
  color: #8fcfff;
}

.neo-panel .neo-outline-mint {
  border-color: rgba(74, 222, 128, 0.28);
  box-shadow: inset 0 0 20px rgba(74, 222, 128, 0.04);
}

.neo-panel .neo-outline-amber {
  border-color: rgba(245, 158, 11, 0.28);
  box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.04);
}

.leaflet-container {
  height: 100%;
  width: 100%;
}

.vehicle-marker-wrapper {
  background: transparent;
  border: 0;
}

.vehicle-marker {
  position: relative;
  width: 28px;
  height: 44px;
  overflow: visible;
  pointer-events: none;
}

.vehicle-marker.is-delayed {
  opacity: 0.84;
}

.vehicle-marker.is-offline {
  opacity: 0.55;
  filter: saturate(0.55);
}

.vehicle-marker__body {
  position: absolute;
  top: 0;
  left: 50%;
  width: 14px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--vehicle-color);
  transform: translateX(-50%) rotate(var(--vehicle-rotation));
  transform-origin: center;
  pointer-events: none;
}

.vehicle-marker__body svg {
  width: 14px;
  height: 28px;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.2));
  pointer-events: none;
}

.vehicle-marker.is-active .vehicle-marker__body svg {
  filter:
    drop-shadow(0 0 0.5px rgba(255, 255, 255, 0.95))
    drop-shadow(0 4px 7px rgba(15, 23, 42, 0.24));
}

.vehicle-marker__label {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.24);
  padding: 1px 5px;
  font-size: 9px;
  line-height: 1.1;
  font-weight: 600;
  color: #0f172a;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.1);
  pointer-events: none;
}

.vehicle-marker__inspection-alert {
  position: absolute;
  left: 50%;
  top: -16px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 9999px;
  background: rgba(255, 50, 80, 0.94);
  border: 1px solid rgba(255, 220, 225, 0.7);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow:
    0 0 10px rgba(255, 60, 90, 0.55),
    0 0 22px rgba(255, 60, 90, 0.38);
  animation: inspection-alert-pulse-marker 1.65s ease-in-out infinite;
  pointer-events: none;
}

.vehicle-marker__inspection-alert--missing {
  background: rgba(255, 70, 70, 0.96);
}

.brand-shell {
  position: relative;
  overflow: hidden;
}

.brand-map-background {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.brand-map-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(247, 251, 255, 0.18), rgba(223, 238, 249, 0.22)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 30%);
  pointer-events: none;
}

.brand-map-background .leaflet-container {
  height: 100%;
  width: 100%;
}

.brand-map-background .leaflet-tile-pane {
  filter: contrast(1.08) saturate(1.08) brightness(0.94);
}

.brand-map-canvas .leaflet-top.leaflet-right {
  top: 18px;
  right: 18px;
}

.brand-map-canvas .leaflet-bottom.leaflet-right {
  right: auto;
  left: 12px;
}

.brand-map-canvas .leaflet-control-attribution {
  margin: 0;
  border: 2px solid rgba(74, 222, 128, 0.44);
  border-bottom: 0;
  border-left: 0;
  border-top-right-radius: 12px;
  background: rgba(7, 13, 28, 0.9);
  color: #d9e7fb;
  box-shadow:
    0 0 10px rgba(74, 222, 128, 0.16),
    0 0 22px rgba(74, 222, 128, 0.14);
  backdrop-filter: blur(18px) saturate(130%);
}

.brand-map-canvas .leaflet-control-attribution a {
  color: #8fdcff;
}

.brand-map-canvas .map-layer-toggle {
  position: absolute;
  top: 334px;
  left: 34px;
  right: auto;
  z-index: 450;
}

.brand-map-canvas .leaflet-top.leaflet-left {
  top: 260px;
  left: 27px;
}

.vehicle-status-popup .leaflet-popup-content-wrapper {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}

.vehicle-status-popup .leaflet-popup-content {
  margin: 0;
}

.vehicle-status-popup .leaflet-popup-tip-container {
  margin-top: -2px;
}

.vehicle-status-popup .leaflet-popup-tip {
  background: rgba(7, 13, 28, 0.94);
  box-shadow: 0 0 18px rgba(74, 222, 128, 0.18);
}

.vehicle-status-popup .leaflet-popup-close-button {
  color: #dbe9ff;
  padding: 6px 8px 0 0;
}

.vehicle-status-card {
  min-width: 270px;
  max-width: 320px;
  border-radius: 16px;
  border: 2px solid var(--popup-accent, #18b868);
  background: rgba(7, 13, 28, 0.94);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--popup-accent, #18b868) 28%, transparent),
    0 0 16px color-mix(in srgb, var(--popup-accent, #18b868) 26%, transparent),
    0 0 32px color-mix(in srgb, var(--popup-accent, #18b868) 18%, transparent),
    0 16px 34px rgba(2, 8, 23, 0.48),
    inset 0 0 20px color-mix(in srgb, var(--popup-accent, #18b868) 8%, transparent);
  padding: 14px 14px 13px;
  backdrop-filter: blur(18px) saturate(135%);
}

.vehicle-status-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.vehicle-status-card__titlewrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vehicle-status-card__title {
  color: var(--popup-accent-strong, #3df08c);
  font-size: 17px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vehicle-status-card__plate {
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.vehicle-status-card__speedbadge {
  flex-shrink: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--popup-accent, #18b868) 82%, black 18%);
  padding: 5px 10px;
  color: white;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  box-shadow: 0 0 16px color-mix(in srgb, var(--popup-accent, #18b868) 30%, transparent);
}

.vehicle-status-card__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.vehicle-status-card__row--compact {
  margin-top: 3px;
}

.vehicle-status-card__row--between {
  justify-content: space-between;
}

.vehicle-status-card__icon,
.vehicle-status-card__gpsicon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.vehicle-status-card__icon {
  height: 24px;
  width: 24px;
  border-radius: 9999px;
}

.vehicle-status-card__icon--pin {
  color: #57a9ff;
}

.vehicle-status-card__icon--gps {
  color: #ffffff;
}

.vehicle-status-card__icon--road {
  background: #1f78ff;
  color: #ffffff;
}

.vehicle-status-card__icon--nav {
  color: #34d399;
  transition: transform 0.2s ease;
}

.vehicle-status-card__icon--battery {
  color: var(--popup-accent-strong, #3df08c);
}

.vehicle-status-card__icon--ignition {
  color: #ffffff;
}

.vehicle-status-card__gpsicon img {
  display: block;
  height: 16px;
  width: 16px;
}

.vehicle-status-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vehicle-status-card__text {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 500;
}

.vehicle-status-card__value {
  font-weight: 700;
}

.vehicle-status-card__value--moving {
  color: #34d399;
}

.vehicle-status-card__value--eta {
  color: #9be7b0;
}

.vehicle-status-card__inspection-alert {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 124, 124, 0.55);
  background: linear-gradient(135deg, rgba(120, 0, 24, 0.92), rgba(255, 52, 90, 0.28));
  padding: 9px 11px;
  color: #ffd6dc;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow:
    0 0 14px rgba(255, 62, 96, 0.36),
    inset 0 0 16px rgba(255, 120, 145, 0.12);
  animation: inspection-alert-pulse-popup 1.65s ease-in-out infinite;
}

@keyframes inspection-alert-pulse-marker {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(255, 60, 90, 0.38),
      0 0 22px rgba(255, 60, 90, 0.24);
    transform: translateX(-50%) scale(1);
  }
  50% {
    box-shadow:
      0 0 18px rgba(255, 60, 90, 0.68),
      0 0 30px rgba(255, 60, 90, 0.42);
    transform: translateX(-50%) scale(1.06);
  }
}

@keyframes inspection-alert-pulse-popup {
  0%, 100% {
    box-shadow:
      0 0 14px rgba(255, 62, 96, 0.36),
      inset 0 0 16px rgba(255, 120, 145, 0.12);
  }
  50% {
    box-shadow:
      0 0 24px rgba(255, 62, 96, 0.6),
      inset 0 0 22px rgba(255, 120, 145, 0.18);
  }
}

@media (max-width: 767px) {
  .neo-panel {
    box-shadow:
      0 0 0 1px rgba(110, 255, 170, 0.2),
      0 0 6px rgba(74, 222, 128, 0.14),
      0 0 14px rgba(74, 222, 128, 0.12),
      0 10px 20px rgba(2, 8, 23, 0.32),
      inset 0 0 14px rgba(74, 222, 128, 0.04);
  }

  .dashboard-header-panel {
    box-shadow:
      0 0 0 1px rgba(110, 255, 170, 0.18),
      0 0 5px rgba(74, 222, 128, 0.12),
      0 0 10px rgba(74, 222, 128, 0.1),
      0 8px 16px rgba(2, 8, 23, 0.28),
      inset 0 0 10px rgba(74, 222, 128, 0.03);
  }
}

@media (max-width: 767px) {
  .brand-map-canvas .leaflet-top.leaflet-left {
    top: 212px;
    left: 17px;
  }

  .brand-map-canvas .map-layer-toggle {
    top: 293px;
    left: 24px;
    right: auto;
  }
}

.brand-shell__content {
  position: relative;
  z-index: 1;
}

.brand-lockup {
  width: 160px;
}

.brand-logo {
  display: block;
  width: 100%;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-palette {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.brand-swatch {
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  padding: 8px;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.brand-swatch:hover {
  transform: translateY(-1px);
}

.brand-swatch.is-active {
  border-color: rgba(15, 23, 42, 0.48);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.brand-swatch__chip {
  width: 100%;
  height: 24px;
  border-radius: 10px;
}

.brand-swatch__label {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  color: #0f172a;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #0f172a;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.timeline-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #0f172a;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.timeline-scrubber {
  position: relative;
  height: 12px;
  width: 100%;
  cursor: pointer;
  border-radius: 9999px;
  background:
    linear-gradient(
      90deg,
      var(--timeline-color, #18b868) 0%,
      var(--timeline-color, #18b868) var(--timeline-progress, 0%),
      rgba(148, 163, 184, 0.28) var(--timeline-progress, 0%),
      rgba(148, 163, 184, 0.28) 100%
    );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(15, 23, 42, 0.18);
  touch-action: none;
}

.timeline-scrubber__thumb {
  position: absolute;
  top: 50%;
  left: var(--timeline-progress, 0%);
  height: 18px;
  width: 18px;
  transform: translate(-50%, -50%);
  border-radius: 9999px;
  border: 2px solid #ffffff;
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.24);
  pointer-events: none;
}

.visible-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.35) rgba(148, 163, 184, 0.12);
}

.visible-scrollbar::-webkit-scrollbar {
  width: 10px;
}

.visible-scrollbar::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 9999px;
}

.visible-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.35);
  border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
}
