:root {
  --theme-bg: #fff;
  --theme-text: #202124;
  --theme-border: #eee;
  --theme-hover: #f7faff;
  --theme-shadow: rgba(0,0,0,.12);
  --theme-active: #185adb;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.navbar {
  position: sticky;
  top: 0;
  background: var(--theme-bg);
  border-bottom: 1px solid var(--theme-border);
  z-index: 10;
  box-shadow: 0 2px 4px var(--theme-shadow);
}

.nav-content {
  display: flex;
  align-items: center;
  padding: 8px 12px;
}

.nav-logo .logo-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.search-container {
  flex: 1;
  display: flex;
  justify-content: center;
}

.search-box .input-group {
  display: flex;
  align-items: center;
  background: #f6f6f6;
  border-radius: 999px;
  padding: 8px 12px;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  transition: background-color .2s ease, box-shadow .2s ease;
}

.search-box .input-group:hover {
  background: var(--theme-hover);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 16px;
  color: var(--theme-text);
}

.map-container {
  flex: 1;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
}

/* Floating buttons */
.directions-toggle, .map-style-toggle {
  position: absolute;
  z-index: 9;
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--theme-bg);
  box-shadow: 0 2px 8px var(--theme-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .2s ease, transform .2s ease;
}

.directions-toggle { bottom: 68px; }
.map-style-toggle { bottom: 16px; }

.directions-toggle.active {
  background: var(--theme-active);
  color: #fff;
}

.directions-toggle:hover,
.map-style-toggle:hover {
  background: var(--theme-hover);
  transform: scale(1.05);
}

/* Map style panel */
.map-style-container {
  position: absolute;
  right: 12px;
  bottom: 72px;
  z-index: 9;
  display: none;
}

.map-style-container.open { display: block; }

.map-style-wrapper {
  background: var(--theme-bg);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.16);
  overflow: hidden;
}

.map-style-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--theme-border);
}

.map-style-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}

.map-style-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}

.map-style-option:hover {
  background: var(--theme-hover);
}

.map-style-option.active {
  border-color: var(--theme-active);
  background: #e8f0fe;
}

/* Suggestions dropdown */
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 60px;
  display: flex;
  justify-content: center;
  z-index: 11;
}

.suggestions-wrapper {
  width: 100%;
  max-width: 520px;
}

.suggestions-list {
  background: var(--theme-bg);
  border: 1px solid var(--theme-border);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  overflow: hidden;
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f2f2f2;
  transition: background-color .2s ease;
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--theme-hover); }

/* Toasts */
.toast-container {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #333;
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  transition: opacity .3s ease;
}

.toast.success { background: #2e7d32; }
.toast.error { background: #c62828; }
.toast.info { background: var(--theme-active); }

.toast-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
}

/* Popup */
.popup-content { min-width: 240px; max-width: 320px; }
.popup-title { margin: 0 0 6px; font-size: 16px; }
.popup-address { display: flex; align-items: center; gap: 6px; color: #444; margin-bottom: 8px; }
.popup-contact { margin-bottom: 8px; }
.popup-contact-link { color: var(--theme-active); text-decoration: none; }
.popup-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.popup-actions .material-icons { font-size: 18px; vertical-align: middle; margin-right: 6px; }
.popup-directions-btn, .popup-nearby-btn {
  width: 100%; padding: 8px 10px; border: 1px solid var(--theme-border);
  border-radius: 6px; background: #fafafa; cursor: pointer;
  transition: background-color .2s ease;
}
.popup-directions-btn:hover,
.popup-nearby-btn:hover { background: var(--theme-hover); }
.popup-icon { font-size: 16px; color: var(--theme-text-secondary); }
/* Popup container */
.mapboxgl-popup {
  max-width: 320px !important;
  z-index: 2 !important;
}

.mapboxgl-popup-content {
  padding: 20px !important;
  border-radius: 12px !important;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Title */
.popup-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #202124;
}

/* Address line */
.popup-address {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5f6368;
  font-size: 14px;
  margin-bottom: 12px;
}

.popup-address i {
  font-size: 16px;
  color: #5f6368;
}

/* Contact block */
.popup-contact {
  margin-bottom: 12px;
  border-top: 1px solid #eee;
  padding-top: 12px;
}

.popup-contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-contact-link {
  color: #185adb;
  text-decoration: none;
  font-weight: 500;
}

.popup-contact-link:hover {
  text-decoration: underline;
}

/* Action buttons */
.popup-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.popup-directions-btn,
.popup-nearby-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.2s ease;
}

.popup-directions-btn {
  background: #185adb;
  color: #fff;
}

.popup-directions-btn:hover {
  background: #0f4bb5;
}

.popup-nearby-btn {
  background: #f0f0f0;
  color: #202124;
}

.popup-nearby-btn:hover {
  background: #e0e0e0;
}

.popup-actions .material-icons {
  font-size: 18px;
  vertical-align: middle;
}
.suggestion-name {
  font-weight: 600;
  font-size: 15px;
}
.suggestion-name-dv {
  font-weight: 400;
  font-size: 13px;
  color: #5f6368;
}
.suggestion-road {
  font-size: 13px;
  color: #777;
}


}
////////////////////////
/* Footer suggestion */
.suggestion-help {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  color: #555;
  background-color: #fff;
  transition: background-color 0.2s, color 0.2s;
  border-top: 1px solid #eee;
  font-size: 10px; /* match road name and suggestion-item */
}

/* Footer suggestion */
.suggestion-help {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  color: #555;
  background-color: #fff;
  transition: background-color 0.2s, color 0.2s;
  border-top: 1px solid #eee;
  font-size: 12px; /* smaller than suggestion-item text */
}

/* Footer icon */
.suggestion-help .material-icons {
  font-size: 16px;   /* keep icon balanced */
  margin-right: 8px; /* consistent spacing */
  color: #555;
  vertical-align: middle;
}

/* Hover effect */
.suggestion-help:hover {
  background-color: #f0f4ff;
  color: #185adb;
}

.suggestion-help:hover .material-icons {
  color: #185adb;
}

.suggestion-help:hover .suggestion-help-link {
  color: #185adb;
}

/* Footer link styling */
.suggestion-help-link {
  color: #185adb;
  text-decoration: none; /* no underline */
  font-weight: 600;
  font-size: 12px;       /* match footer text size */
}
.clear-nearby-btn {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background-color 0.2s, color 0.2s;
  z-index: 999;
  pointer-events: auto;   /* ✅ only button clickable */
}

#map canvas {
  pointer-events: auto;   /* ✅ keep map interactive */
}


.clear-nearby-btn .material-icons {
  font-size: 16px;
  color: #555;
}

.clear-nearby-btn:hover {
  background-color: #f0f4ff;
  color: #185adb;
}

.clear-nearby-btn:hover .material-icons {
  color: #185adb;
}
map.fitBounds(bounds, {
  padding: 250,
  duration: 1000,
  easing: t => t*t,
  maxZoom: 18, // prevent over-zoom
  minZoom: 15  // ensure visible zoom change
});
.clear-nearby-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
}
.clear-nearby-btn i {
  margin-right: 6px;
}
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  background-color: #fff;
  cursor: pointer;
  animation: fadeInUp 0.3s ease forwards;
  transition: background 0.2s ease;
}

.suggestion-item:hover {
  background-color: #f9f9f9;
}

.suggestion-icon {
  font-size: 20px;
  color: #666;
  margin-right: 12px;
  flex-shrink: 0;
}

.suggestion-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.suggestion-name {
  font-size: 15px;
  font-weight: 600;
  color: #222;
}

.suggestion-name-dv {
  font-weight: 400;
  font-size: 13px;
  color: #666;
}

.suggestion-road {
  font-size: 13px;
  color: #444;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.popup-contact {
  display: flex;
  align-items: center;   /* vertically center icon + text */
  gap: 6px;              /* space between icon and number(s) */
  margin-bottom: 6px;
  font-size: 14px;
  color: #444;
}

.popup-contact i {
  font-size: 18px;
  color: #666;
  flex-shrink: 0;        /* prevent icon from shrinking */
}

.popup-contact a {
  color: #0078d7;
  text-decoration: none;
  font-weight: 500;
}

.popup-contact a:hover {
  text-decoration: underline;
}
/* Suggestion items */
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  background-color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.suggestion-item:hover {
  background-color: #f4f4f4;   /* same as suggestion-help hover */
}

.suggestion-item:hover .suggestion-name,
.suggestion-item:hover .suggestion-road,
.suggestion-item:hover .suggestion-name-dv,
.suggestion-item:hover .suggestion-icon {
  color: #185adb;              /* highlight text/icon in blue */
}
.suggestion-name-dv {
  font-family: 'MV Eamaan XP', sans-serif;
  font-size: 16px;
  color: #444;
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

@font-face {
  font-family: 'MV Eamaan XP';
  src: url('/api/fonts/Mv_Eamaan_XP.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}
///////////////////////////////////////////////////

/* Map container */
.map-container {
  height: 100%;
  width: 100%;
}

/* Floating buttons */
.directions-toggle,
.map-style-toggle {
  position: absolute;
  right: 16px;
  background: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.directions-toggle:hover,
.map-style-toggle:hover {
  background: #f4f4f4;
}

.directions-toggle {
  top: 100px;
}

.map-style-toggle {
  top: 150px;
}

/* Map style card */
.map-style-container {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  width: 180px;
  display: none; /* toggle with JS */
}

.map-style-header {
  padding: 12px 16px;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
}

.map-style-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.map-style-options {
  display: flex;
  flex-direction: column;
}

.map-style-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.map-style-option:hover {
  background: #f4f4f4;
  color: #185adb;
}

.map-style-option.active {
  background: #185adb;
  color: #fff;
}

.map-style-option .material-icons {
  font-size: 18px;
  color: inherit;
}


