/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #2c3e50;
  overflow: hidden;
}

/* ── App Layout ─────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: 270px;
  min-width: 270px;
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.12);
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow: hidden;
}

#sidebar.collapsed {
  transform: translateX(-100%);
}

/* Sidebar Header */
#sidebar-header {
  padding: 18px 16px 14px;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

#brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

/* Sidebar Content */
#sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

#sidebar-content::-webkit-scrollbar {
  width: 4px;
}
#sidebar-content::-webkit-scrollbar-track {
  background: #f1f1f1;
}
#sidebar-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

/* Show All button */
.show-all-row {
  padding: 0 12px 10px;
}

.btn-show-all {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #dde1e7;
  border-radius: 8px;
  background: #f8f9fa;
  color: #555;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.btn-show-all:hover,
.btn-show-all.active {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #ffffff;
}

/* Tour List */
#tour-list {
  padding: 0;
}

/* Group Section */
.tour-group {
  margin-bottom: 4px;
}

/* Group Header (chip/accordion) */
.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.group-header:hover {
  background: #f4f6f8;
}

.group-header.active {
  background: #eef3fb;
  border-left-color: #2980b9;
}

.group-flag {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.group-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  flex: 1;
  letter-spacing: 0.2px;
}

.group-count {
  font-size: 10.5px;
  color: #888;
  background: #eef0f3;
  padding: 2px 7px;
  border-radius: 10px;
}

.group-chevron {
  font-size: 10px;
  color: #aaa;
  transition: transform 0.25s;
  flex-shrink: 0;
}

.group-header.expanded .group-chevron {
  transform: rotate(90deg);
}

/* Tour Items Container */
.tour-items {
  display: none;
  padding-left: 8px;
  padding-right: 0;
  padding-bottom: 4px;
  border-left: 2px solid #e8eaed;
  margin-left: 22px;
}

.tour-items.visible {
  display: block;
}

/* Individual Tour Item */
.tour-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 10px;
  cursor: pointer;
  border-radius: 0 8px 8px 0;
  transition: background 0.15s;
  position: relative;
}

.tour-item:hover {
  background: #f4f6f8;
}

.tour-item.active {
  background: #f0f4ff;
}

.tour-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.15);
}

.tour-info {
  flex: 1;
  min-width: 0;
}

.tour-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tour-item-duration {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.tour-item.active .tour-item-name {
  color: #1a1a2e;
}

/* Coming Soon badge */
.coming-soon-badge {
  background: #fff3e0;
  color: #e67e22;
  font-weight: 700;
}

/* Coming Soon message inside group */
.coming-soon-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 14px;
  background: #fafafa;
  border-radius: 8px;
  margin: 2px 8px 8px 4px;
}

.cs-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.cs-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 2px;
}

.cs-sub {
  font-size: 11px;
  color: #999;
  line-height: 1.4;
}

/* Sidebar Footer */
#sidebar-footer {
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  text-align: center;
  flex-shrink: 0;
}

/* ── Map Container ───────────────────────────────────────── */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

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

/* ── Mobile Toggle Button ───────────────────────────────── */
#mobile-toggle {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 900;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  line-height: 1;
}

/* ── Basemap Layer Switcher ──────────────────────────────── */
#layer-switcher {
  position: absolute;
  bottom: 32px;
  right: 12px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.layer-toggle-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: background 0.2s;
}

.layer-toggle-btn:hover {
  background: #f0f0f0;
}

.layer-options {
  display: none;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.layer-options.visible {
  display: flex;
}

.layer-opt {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: all 0.15s;
  white-space: nowrap;
}

.layer-opt:hover {
  background: #f4f4f4;
}

.layer-opt.active {
  background: #1a1a2e;
  color: #ffffff;
}

/* ── Popups ─────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  line-height: 1.5;
  min-width: 190px;
}

.popup-inner {
  padding: 12px 14px 10px;
}

.popup-tour-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.popup-day-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.popup-description {
  font-size: 12px;
  color: #555;
  border-top: 1px solid #eee;
  padding-top: 6px;
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Location Tooltip ────────────────────────────────────── */
.location-tooltip {
  background: rgba(26, 26, 46, 0.88) !important;
  border: none !important;
  border-radius: 5px !important;
  color: #fff !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  padding: 4px 9px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
  white-space: nowrap;
}

.location-tooltip::before {
  border-top-color: rgba(26, 26, 46, 0.88) !important;
}

/* ── Leaflet Overrides ───────────────────────────────────── */
.leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255,255,255,0.75);
}

.leaflet-control-zoom {
  border: none !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18) !important;
}

.leaflet-control-zoom a {
  background: #ffffff;
  color: #333;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 16px;
  border-bottom: 1px solid #eee !important;
}

.leaflet-control-zoom a:hover {
  background: #f4f4f4;
}

/* ── Responsive / Mobile ─────────────────────────────────── */
@media (max-width: 680px) {
  #sidebar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #mobile-toggle {
    display: flex;
  }

  #map-container {
    width: 100%;
  }
}

/* ── Developer credit (sidebar footer) ──────────────────────────────────── */
#dev-credit {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  font-size: 11px;
}

.dev-name {
  padding: 4px 8px;
  color: #444;
  white-space: nowrap;
  border-right: 1px solid #ddd;
  line-height: 1.4;
}

.dev-name strong {
  color: #27ae60;
  font-weight: 700;
}

.dev-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-right: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  color: #e6a817;
  padding: 0;
  text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
  flex-shrink: 0;
}

.dev-icon-btn:last-child { border-right: none; }

.dev-icon-btn:hover {
  transform: scale(1.3);
  background: #f9f9f9;
  z-index: 1;
}

.dev-icon-btn svg { width: 13px; height: 13px; display: block; }

#email-toast {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}

#email-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
