*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --panel-bg: rgba(17, 24, 39, 0.92);
  --panel-border: rgba(148, 163, 184, 0.16);
  --panel-shadow: 0 25px 70px rgba(2, 6, 23, 0.55);
  --brand-blue: #3b82f6;
  --brand-green: #34d399;
  --brand-pink: #f472b6;
  --text-muted: #9ca3af;
}

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

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f3f4f6;
  background: #030712;
}

#app {
  position: relative;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.25), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(244, 114, 182, 0.18), transparent 50%),
    #030712;
}

#map-container {
  position: absolute;
  inset: 0;
  background: #0f172a;
}

#map {
  width: 100%;
  height: 100%;
}

#sidebar {
  position: absolute;
  top: clamp(16px, 4vh, 48px);
  left: clamp(16px, 4vw, 56px);
  width: min(380px, calc(100% - 32px));
  max-height: calc(100vh - clamp(32px, 8vh, 96px));
  padding: 28px 28px 32px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  box-shadow: var(--panel-shadow);
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  backdrop-filter: blur(24px);
  z-index: 10;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#sidebar.hidden {
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 1025px) {
  #sidebar.hidden {
    transform: translateX(calc(-100% - 20px));
  }
}

.sidebar-hide-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: #e2e8f0;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-hide-btn:hover {
  background: rgba(15, 23, 42, 0.8);
  transform: scale(1.1);
}

.sidebar-hide-btn span {
  line-height: 1;
}

.sidebar-show-tab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 80px;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-left: none;
  color: #e2e8f0;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.sidebar-show-tab:hover {
  background: rgba(15, 23, 42, 0.95);
  transform: translateY(-50%) translateX(4px);
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
}

.sidebar-show-tab.hidden {
  display: none;
}

.sidebar-show-tab span {
  line-height: 1;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 8px 0;
  margin-bottom: 8px;
}

.sidebar-header .logo {
  max-width: 150px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.utility-panel {
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.utility-headline p {
  margin: 0;
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 500;
}

.nearest-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-btn {
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-pink));
  color: #0f172a;
  box-shadow: 0 4px 4px rgba(59, 130, 246, 0.25);
}

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

.ghost-btn {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
}

.ghost-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nearest-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.nearest-results.empty {
  opacity: 0.8;
}

.nearest-card {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nearest-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.nearest-card h3 {
  margin: 0;
  font-size: 15px;
  color: #f9fafb;
}

.nearest-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.distance-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 12px;
  color: #dbeafe;
}

.nearest-card footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nearest-card button {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 13px;
  color: #dbeafe;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-header label {
  margin: 0;
}

.view-all-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-weight: 400;
}

.view-all-btn:hover {
  color: #ffffff;
}

#searchInput {
  width: 100%;
  padding: 10px 12px;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #ffffff;
  font-size: 14px;
  outline: none;
}

#searchInput::placeholder {
  color: var(--text-muted);
}

#searchInput:focus {
  border-color: #93c5fd;
  background: rgba(15, 23, 42, 0.85);
}

/* scroll filters replaced by dropdowns */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 18px;
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--panel-shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: #ffffff;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(148, 163, 184, 0.1);
  color: #ffffff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-item {
  padding: 12px;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-item:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.5);
}

.modal-item.active {
  background: #ffffff;
  color: #1f2937;
  border-color: #ffffff;
  font-weight: 500;
}

#map-loading,
#map-error {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
  z-index: 2;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

#map-error {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fca5a5;
}

.hidden {
  display: none;
}


.tours-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  padding-top: 20px;
}

.tours-panel-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

.tour-card-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-card {
  padding: 14px 16px;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tour-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tour-card h3 {
  margin: 0;
  font-size: 15px;
  color: #f9fafb;
}

.tour-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.tour-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tour-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.tour-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #0f172a;
  font-weight: 600;
}

.tour-card button {
  border: none;
  background: rgba(59, 130, 246, 0.15);
  color: #bfdbfe;
  font-weight: 600;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s, color 0.2s;
}

/* Active tour — End tour button */
.tour-card button.end-tour {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.tour-card button.end-tour:hover {
  background: rgba(239, 68, 68, 0.32);
  color: #fee2e2;
}

@media (max-width: 1024px) {
  #sidebar {
    width: min(420px, calc(100% - 32px));
    left: 50%;
    transform: translateX(-50%);
  }
  
  #sidebar.hidden {
    transform: translateX(calc(-100% - 20px));
  }
}

@media (max-width: 768px) {
  #sidebar {
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    border-radius: 32px 32px 0 0;
    max-height: 85vh;
    transform: translateY(calc(100% + 32px));
    transition: transform 0.35s ease, opacity 0.35s ease;
    padding: 24px 24px 32px;
    border-left: none;
    border-right: none;
  }

  body.sidebar-open #sidebar {
    transform: translateY(0);
  }
  
  #sidebar.hidden {
    transform: translateY(calc(100% + 32px));
  }

  #map-loading,
  #map-error {
    top: 12px;
    width: calc(100% - 32px);
    max-width: 260px;
  }
}

/* ── Mural popup — matches sidebar glassmorphism ────────────────── */
.gm-style-iw-d {
  background: rgba(17, 24, 39, 0.96) !important;
  color: #e2e8f0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  width: 500px !important;
  max-width: 500px !important;
  min-width: 500px !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
}

.gm-style-iw-c {
  background: rgba(17, 24, 39, 0.96) !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  box-shadow: 0 25px 70px rgba(2, 6, 23, 0.55) !important;
  padding: 0 !important;
  width: 500px !important;
  max-width: 500px !important;
  min-width: 500px !important;
  overflow: hidden !important;
  border-radius: 8px !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
}

/* ── Directions panel — floats to the right of the sidebar ─────── */
#directions-panel {
  /* Positioning is set dynamically in JS to match sidebar's exact coordinates */
}

#directions-panel #dir-route-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

#directions-panel #dir-route-list::-webkit-scrollbar {
  width: 8px;
}

#directions-panel #dir-route-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 30px;
}

/* Collapse panel on narrow screens where there's no room beside the sidebar */
@media (max-width: 900px) {
  #directions-panel {
    display: none !important;
  }
}

.gm-style-iw-d::-webkit-scrollbar,
.gm-style-iw-c::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.gm-style-iw-d {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

.gm-ui-hover-effect {
  display: none !important;
}

.gm-style-iw-d > div {
  background: rgba(17, 24, 39, 0.96) !important;
  color: #e2e8f0 !important;
  overflow: hidden !important;
}

.gm-style-iw-t::after {
  display: none !important;
}

.gm-style-iw-tc::after {
  display: none !important;
}

/* --- CUSTOM SCROLLBAR FOR SIDEBAR --- */

/* 1. For Chrome, Edge, and Safari */
#sidebar::-webkit-scrollbar {
  width: 8px; /* Makes the bar thinner and less intrusive */
}

#sidebar::-webkit-scrollbar-track {
  background: transparent; /* Makes the track blend into the sidebar background */
}

#sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.2); /* Uses a semi-transparent version of your border color */
  border-radius: 30px; /* Makes the edges rounded and modern */
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(148, 163, 184, 0.4); /* Brightens slightly when hovered */
}


/* ── Address input ─────────────────────────────────────────────────── */
.address-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #ffffff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.address-input::placeholder {
  color: var(--text-muted);
}

.address-input:focus {
  border-color: #93c5fd;
  background: rgba(15, 23, 42, 0.85);
}

/* Google autocomplete dropdown matches dark theme */
.pac-container {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.5);
  font-family: inherit;
}

.pac-item {
  color: #e2e8f0;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.pac-item:hover,
.pac-item-selected {
  background: rgba(59, 130, 246, 0.2);
}

.pac-item-query {
  color: #ffffff;
  font-size: 13px;
}

.pac-matched {
  color: #60a5fa;
}

.pac-icon {
  display: none;
}

/* ── Location action buttons row ───────────────────────────────────── */
.location-actions {
  display: flex;
  gap: 8px;
}

.location-actions .ghost-btn {
  flex: 1;
  font-size: 12px;
  padding: 8px 10px;
}

/* ── Filter select dropdowns ───────────────────────────────────────── */
.filter-select {
  width: 100%;
  padding: 9px 32px 9px 12px;
  border-radius: 5px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  /* Chevron arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s, background-color 0.2s;
}

.filter-select:hover {
  border-color: rgba(148, 163, 184, 0.55);
  background-color: rgba(15, 23, 42, 0.8);
}

.filter-select:focus {
  border-color: #93c5fd;
  background-color: rgba(15, 23, 42, 0.85);
}

.filter-select option {
  background: #1e293b;
  color: #e2e8f0;
}

/* ── Mural view range slider ───────────────────────────────────────── */
.mural-view-slider {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(
    to right,
    #3b82f6 0%,
    #3b82f6 calc(var(--val, 100) * 1%),
    rgba(148, 163, 184, 0.25) calc(var(--val, 100) * 1%),
    rgba(148, 163, 184, 0.25) 100%
  );
  outline: none;
  cursor: pointer;
}

.mural-view-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mural-view-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 14px rgba(59, 130, 246, 0.6);
}

.mural-view-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  cursor: pointer;
}

/* 2. For Firefox */
#sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}