:root {
  --gm-blue: #1a73e8;
  --gm-blue-hover: #1557b0;
  --gm-blue-light: #e8f0fe;
  --gm-text-primary: #202124;
  --gm-text-secondary: #5f6368;
  --gm-border: #dadce0;
  --gm-bg-card: #ffffff;
  --gm-shadow-1: 0 1px 3px rgba(60,64,67, 0.3), 0 4px 8px 3px rgba(60,64,67, 0.15);
  --gm-shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  --gm-radius-lg: 16px;
  --gm-radius-md: 8px;
  --gm-radius-full: 9999px;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  color: var(--gm-text-primary);
  background-color: #e5e3df;
}

/* Map Base */
#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Hide default leaflet controls since we build custom Google Maps UI */
.leaflet-control-zoom,
.leaflet-control-attribution {
  display: none !important;
}

/* Top Floating Area */
.top-controls-container {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}

.top-controls-container > * {
  pointer-events: auto;
}

/* Search Card */
.search-card {
  width: 400px;
  max-width: calc(100vw - 24px);
  background: var(--gm-bg-card);
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 4px 8px;
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--gm-text-primary);
  padding: 0 10px;
  background: transparent;
}

.search-input-wrapper input::placeholder {
  color: var(--gm-text-secondary);
}

.icon-btn {
  background: transparent;
  border: none;
  outline: none;
  width: 36px;
  height: 36px;
  border-radius: var(--gm-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gm-text-secondary);
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: #f1f3f4;
  color: var(--gm-text-primary);
}

.divider-v {
  width: 1px;
  height: 24px;
  background-color: var(--gm-border);
  margin: 0 4px;
}

.directions-action-btn {
  color: var(--gm-blue);
}

.directions-action-btn:hover {
  background: var(--gm-blue-light);
  color: var(--gm-blue-hover);
}

/* Search Suggestions Dropdown */
.search-results-dropdown {
  display: none;
  max-height: 340px;
  overflow-y: auto;
  border-top: 1px solid var(--gm-border);
  background: var(--gm-bg-card);
  border-radius: 0 0 var(--gm-radius-md) var(--gm-radius-md);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1f3f4;
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f8f9fa;
}

.search-result-item i {
  color: var(--gm-text-secondary);
  font-size: 16px;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gm-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-subtitle {
  font-size: 12px;
  color: var(--gm-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quick Category Chips */
.category-chips-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 100vw;
  padding-bottom: 4px;
}

.category-chips-scroll::-webkit-scrollbar {
  display: none;
}

.category-chips {
  display: flex;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gm-bg-card);
  border: 1px solid transparent;
  border-radius: var(--gm-radius-full);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gm-text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.chip i {
  font-size: 13px;
  color: #ea4335;
}
.chip:nth-child(2) i { color: #f29900; }
.chip:nth-child(3) i { color: #1a73e8; }
.chip:nth-child(4) i { color: #1e8e3e; }
.chip:nth-child(5) i { color: #9334e6; }
.chip:nth-child(6) i { color: #129eaf; }

.chip:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(0);
}

/* Route Navigation Panel */
.route-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 400px;
  max-width: calc(100vw - 24px);
  background: var(--gm-bg-card);
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-1);
  z-index: 1100;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.route-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--gm-border);
}

.travel-modes {
  display: flex;
  gap: 8px;
}

.mode-btn {
  background: transparent;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: var(--gm-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gm-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover {
  background: #e8eaed;
}

.mode-btn.active {
  background: var(--gm-blue-light);
  color: var(--gm-blue);
  font-weight: 700;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--gm-text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: #e8eaed;
  color: var(--gm-text-primary);
}

.route-inputs {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
  position: relative;
}

.route-dots-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 14px;
}

.route-dots-indicator .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.origin-dot {
  background-color: var(--gm-blue);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--gm-blue);
}

.dot.dest-dot {
  background-color: #ea4335;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #ea4335;
}

.dot-line {
  width: 2px;
  height: 28px;
  background-color: #dadce0;
}

.inputs-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.route-field {
  display: flex;
  align-items: center;
  background: #f1f3f4;
  border-radius: 6px;
  padding: 2px 8px;
}

.route-field input {
  width: 100%;
  height: 34px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--gm-text-primary);
}

.locate-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gm-blue);
  padding: 4px;
}

.swap-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--gm-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn:hover {
  background: #f1f3f4;
}

/* Route Summary */
.route-summary {
  padding: 14px 16px;
  border-top: 1px solid var(--gm-border);
  background: #ffffff;
}

.summary-highlight {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.summary-time {
  font-size: 24px;
  font-weight: 700;
  color: #1e8e3e;
}

.summary-distance {
  font-size: 15px;
  color: var(--gm-text-secondary);
}

.summary-traffic {
  font-size: 12px;
  color: #1e8e3e;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-steps-list {
  margin-top: 12px;
  max-height: 180px;
  overflow-y: auto;
  border-top: 1px solid #f1f3f4;
  padding-top: 8px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--gm-text-primary);
  padding: 6px 0;
}

.step-item i {
  color: var(--gm-blue);
  margin-top: 3px;
}

/* Place Detail Drawer */
.place-detail-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 408px;
  max-width: 100vw;
  background: var(--gm-bg-card);
  z-index: 1050;
  box-shadow: var(--gm-shadow-1);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.place-detail-panel.open {
  transform: translateX(0);
}

.detail-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gm-text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.detail-close-btn:hover {
  background: #ffffff;
}

.place-banner {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: #ddd;
  overflow: hidden;
}

.place-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-banner-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
}

.place-body {
  padding: 16px 20px;
}

.place-title-wrap {
  margin-bottom: 8px;
}

.place-title-wrap h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gm-text-primary);
  line-height: 1.25;
}

.place-category {
  font-size: 13px;
  color: var(--gm-text-secondary);
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.rating-num {
  font-weight: 700;
  color: #e37400;
}

.rating-stars {
  color: #e37400;
  font-size: 12px;
}

.reviews-count {
  color: var(--gm-text-secondary);
  font-size: 13px;
}

/* Quick Action Buttons */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gm-border);
}

.action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.action-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gm-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gm-blue);
  font-size: 16px;
  transition: all 0.15s;
}

.action-btn span {
  font-size: 12px;
  color: var(--gm-blue);
  font-weight: 600;
}

.action-btn:hover .action-icon {
  background: var(--gm-blue-light);
  border-color: var(--gm-blue);
}

.action-btn.primary .action-icon {
  background: var(--gm-blue);
  border-color: var(--gm-blue);
  color: #ffffff;
}

.action-btn.primary:hover .action-icon {
  background: var(--gm-blue-hover);
}

/* Place Meta Items */
.place-meta-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 14px;
  line-height: 1.4;
}

.meta-icon {
  color: var(--gm-text-secondary);
  font-size: 16px;
  margin-top: 2px;
  width: 20px;
  text-align: center;
}

.status-open {
  color: #1e8e3e;
  font-weight: 600;
}

.meta-content a {
  color: var(--gm-blue);
  text-decoration: none;
}

.meta-content a:hover {
  text-decoration: underline;
}

/* Bottom-Left Layer Switcher */
.layer-switcher-widget {
  position: absolute;
  bottom: 24px;
  left: 20px;
  z-index: 999;
}

.layer-main-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--gm-radius-md);
  border: 2px solid #ffffff;
  box-shadow: var(--gm-shadow-1);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.layer-main-preview:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.layer-main-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layer-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 3px 0;
  backdrop-filter: blur(2px);
}

.layer-options-menu {
  position: absolute;
  bottom: 92px;
  left: 0;
  background: #ffffff;
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-1);
  padding: 8px;
  display: none;
  gap: 8px;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.layer-options-menu.show {
  display: flex;
}

.layer-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--gm-text-secondary);
}

.layer-option:hover {
  background: #f1f3f4;
}

.layer-option.active {
  color: var(--gm-blue);
  font-weight: 700;
}

.layer-option .thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
}

.layer-option.active .thumb {
  border-color: var(--gm-blue);
}

.streets-thumb {
  background-image: url('https://mt1.google.com/vt/lyrs=m&x=1336&y=2105&z=12');
}
.satellite-thumb {
  background-image: url('https://mt1.google.com/vt/lyrs=y&x=1336&y=2105&z=12');
}
.dark-thumb {
  background-image: url('https://a.basemaps.cartocdn.com/dark_all/12/2105/1336.png');
}
.terrain-thumb {
  background-image: url('https://mt1.google.com/vt/lyrs=p&x=1336&y=2105&z=12');
}

/* Floating Right Bottom Controls (Zoom, My Location, Street View) */
.map-action-controls {
  position: absolute;
  bottom: 24px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-ctrl-btn {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border: none;
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--gm-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.map-ctrl-btn:hover {
  background: #f8f9fa;
  color: var(--gm-text-primary);
}

.zoom-group {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--gm-radius-md);
  box-shadow: var(--gm-shadow-1);
  overflow: hidden;
}

.zoom-btn {
  border-radius: 0;
  box-shadow: none;
}

.ctrl-divider {
  width: 80%;
  height: 1px;
  background-color: var(--gm-border);
  margin: 0 auto;
}

.pegman-btn {
  color: #fbbc04;
}
.pegman-btn:hover {
  color: #e37400;
}

/* Custom Marker Styling */
.gm-pin {
  width: 32px;
  height: 42px;
  position: relative;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gm-pin:hover {
  transform: scale(1.18) translateY(-4px);
}

.gm-pin svg {
  width: 100%;
  height: 100%;
}

/* User Location Pulse Marker */
.user-pulse-marker {
  width: 20px;
  height: 20px;
  background: var(--gm-blue);
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
  position: relative;
}

.user-pulse-marker::after {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(26, 115, 232, 0.35);
  animation: radarPulse 2s infinite ease-out;
}

@keyframes radarPulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Toast Message */
.toast-msg {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--gm-radius-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: none;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
}

/* Responsive Styles for Mobile */
@media (max-width: 600px) {
  .top-controls-container {
    left: 8px;
    right: 8px;
    top: 8px;
  }
  .search-card {
    width: 100%;
  }
  .search-input-wrapper input {
    font-size: 16px; /* Prevents auto zoom on mobile browsers */
  }
  .category-chips-scroll {
    -webkit-overflow-scrolling: touch;
    padding-right: 16px;
  }
  .place-detail-panel {
    width: 100%;
    top: auto;
    bottom: 0;
    height: 72vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
  }
  .place-detail-panel.open {
    transform: translateY(0);
  }
  .layer-switcher-widget {
    bottom: 16px;
    left: 12px;
  }
  .layer-main-preview {
    width: 64px;
    height: 64px;
  }
  .map-action-controls {
    bottom: 16px;
    right: 12px;
  }
  .map-ctrl-btn {
    width: 40px;
    height: 40px;
  }
  .route-panel {
    width: 100%;
    left: 8px;
    right: 8px;
  }
}

/* Permission Modal Overlay */
.permission-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

.permission-modal-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 380px;
  width: 100%;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  animation: scaleUp 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.permission-google-brand {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.permission-modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gm-text-primary);
  margin-bottom: 8px;
}

.permission-modal-card p {
  font-size: 13px;
  color: var(--gm-text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.permission-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-perm-grant {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--gm-radius-full);
  background: var(--gm-blue);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
}

.btn-perm-grant:hover {
  background: var(--gm-blue-hover);
}

.btn-perm-deny {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--gm-radius-full);
  background: transparent;
  color: var(--gm-text-secondary);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-perm-deny:hover {
  background: #f1f3f4;
  color: var(--gm-text-primary);
}
