/* DriveBC control base */
.leaflet-control.btr-control {
  background: rgba(17, 24, 39, 0.96); /* deeper slate */
  color: #f9fafb;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font: 12px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;

  width: auto;
  display: inline-block;
  box-sizing: border-box;
}

/* Root of the road events control */
.btr-road-events {
  max-width: 100%;
}

/* Header row: switch + title + chevron */
.btr-rc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btr-rc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* Hide raw checkbox; we style our own switch */
.btr-rc-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* iOS-style switch background */
.btr-rc-switch {
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: #4b5563;
  position: relative;
  transition: background 0.16s ease-out, box-shadow 0.16s ease-out;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.5);
}

/* iOS-style knob */
.btr-rc-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.4);
  transition: transform 0.16s ease-out;
}

/* ON state */
.btr-rc-toggle input[type="checkbox"]:checked + .btr-rc-switch {
  background: #22c55e;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.7);
}

.btr-rc-toggle input[type="checkbox"]:checked + .btr-rc-switch .btr-rc-knob {
  transform: translateX(14px);
}

.btr-rc-title {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
}

/* Collapse button */
.btr-rc-collapse {
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s ease-out, color 0.16s ease-out;
}

.btr-rc-collapse:hover {
  background: rgba(148, 163, 184, 0.18);
  color: #e5e7eb;
}

.btr-rc-chevron {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease-out;
}

/* Collapsed state */
.btr-road-events.is-collapsed .btr-rc-chevron {
  transform: rotate(-135deg);
}

.btr-rc-body {
  margin-top: 6px;
}

.btr-road-events.is-collapsed .btr-rc-body {
  display: none;
}

/* Filters: more compact, label inline with pills */
.btr-pills {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Each row can be Type, Severity, etc. */
.btr-pills-row {
  display: flex;              /* was missing before */
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
}

.btr-pills-row::-webkit-scrollbar {
  height: 4px;
}

.btr-pills-row::-webkit-scrollbar-track {
  background: transparent;
}

.btr-pills-row::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 999px;
}

.btr-pills .label {
  opacity: 0.75;
  font-size: 11px;
  margin-right: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btr-pills .pill {
  border: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.14s ease-out, transform 0.08s ease-out;
}

.btr-pills .pill:hover {
  background: #1f2937;
  transform: translateY(-1px);
}

.btr-pills .pill.active {
  background: #4f46e5;
  color: #f9fafb;
}

/* ---------------------------------------------------------
   Modern 2025 Leaflet Popup Override (DriveBC styling)
   --------------------------------------------------------- */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(17, 24, 39, 0.96); /* same as control box */
  color: #f1f5f9;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Popup container */
.leaflet-popup {
  margin-bottom: 12px; /* slightly lifted look */
}

/* Popup content area */
.leaflet-popup-content {
  margin: 14px 16px; /* override Leaflet default */
  font: 13px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

/* Popup title */
.btr-popup-title {
  font-size: 14px;
  font-weight: 600;
  color: #f9fafb;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

/* Description text */
.btr-popup-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 10px;
}

/* Key/value highlight row */
.btr-popup-meta {
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: #e2e8f0;
  margin-bottom: 6px;
}

/* Buttons inside popup */
.btr-popup-btn {
  display: inline-block;
  padding: 6px 10px;
  background: #4f46e5;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.2s ease-out, transform 0.12s ease-out;
  margin-right: 6px;
}

.btr-popup-btn:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

/* Close button override */
.leaflet-container a.leaflet-popup-close-button {
  color: #cbd5e1 !important;
  font-size: 18px;
  padding: 6px 8px;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}