/* ============================================
   Hawaii Attractions Map - Full Width Interactive
   ============================================ */

/* Map wrapper fills viewport below header */
#attractions-map-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - 60px);
  min-height: 500px;
  overflow: hidden;
}

#attractions-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Fix Leaflet z-index conflicts with site header */
.leaflet-pane { z-index: 1; }
.leaflet-top, .leaflet-bottom { z-index: 10; }

/* ---- Floating Header ---- */
#map-header {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  text-align: center;
  pointer-events: none;
  max-width: 90vw;
  transition: opacity 0.3s ease;
}

#map-header h1 {
  font-family: 'brother-1816-printed', 'Proxima', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: #1C4D8E;
  margin: 0;
  line-height: 1.2;
}

#map-header .map-subtitle {
  font-size: 1rem;
  color: #666;
  margin: 2px 0 0;
  line-height: 1.3;
}

/* ---- Island Filter Buttons ---- */
#island-filters {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 6px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 10px;
  border-radius: 50px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 95vw;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#island-filters::-webkit-scrollbar { display: none; }

.island-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 50px;
  background: #f0f0f0;
  color: #444;
  font-family: 'Proxima', -apple-system, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  line-height: 1;
}

.island-btn:hover {
  background: #e0e0e0;
}

.island-btn.active {
  background: #fff;
  border-color: #1C4D8E;
  color: #1C4D8E;
  box-shadow: 0 1px 6px rgba(28,77,142,0.2);
}

.btn-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Category Legend ---- */
#category-legend {
  position: absolute;
  bottom: 24px;
  left: 12px;
  z-index: 20;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  gap: 14px;
  font-size: 0.95rem;
  color: #555;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.legend-icon {
  font-size: 1.15rem;
}

/* ---- Custom Map Markers ---- */
.marker-pin {
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 50% 0;
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -21px 0 0 -21px;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.marker-pin:hover {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}

.marker-pin .marker-icon {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  font-size: 20px;
  color: #fff;
  line-height: 1;
}

.marker-pin.marker-active {
  transform: rotate(-45deg) scale(1.25);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 1000 !important;
}

/* Marker number badge */
.marker-pin .marker-number {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  background: #fff;
  color: #333;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  font-family: 'Proxima', sans-serif;
}

/* ---- Attraction Detail Panel ---- */
#attraction-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.2);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 45vh;
  overflow: hidden;
}

#attraction-panel.panel-visible {
  transform: translateY(0);
}

#attraction-panel.panel-hidden {
  transform: translateY(100%);
}

#panel-close {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 30;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

#panel-close:hover {
  background: rgba(0,0,0,0.7);
}

#panel-content {
  display: flex;
  flex-direction: row;
  height: 100%;
}

#panel-image-wrap {
  width: 40%;
  min-width: 200px;
  max-width: 360px;
  flex-shrink: 0;
  overflow: hidden;
}

#panel-image {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  display: block;
}

#panel-info {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#panel-category {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: #1C4D8E;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  align-self: flex-start;
}

#panel-name {
  font-family: 'brother-1816-printed', 'Proxima', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #222;
  margin: 0 0 8px;
  line-height: 1.2;
}

#panel-description {
  font-size: 1.05rem;
  color: #555;
  line-height: 1.5;
  margin: 0 0 14px;
}

.panel-cta {
  display: inline-block;
  padding: 10px 22px;
  background: #1C4D8E;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  transition: background 0.2s;
  align-self: flex-start;
}

.panel-cta:hover {
  background: #0E3B7E;
}

/* ---- Attraction List Sidebar ---- */
#attraction-list {
  position: absolute;
  top: 155px;
  right: 12px;
  z-index: 20;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  width: 360px;
  max-height: calc(100vh - 240px);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

#attraction-list.list-collapsed {
  width: auto;
}

#attraction-list.list-collapsed #list-content {
  display: none;
}

#list-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'Proxima', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1C4D8E;
  width: 100%;
  text-align: left;
}

#list-toggle:hover {
  background: rgba(28,77,142,0.05);
}

#list-toggle-icon {
  font-size: 1.25rem;
}

#list-content {
  overflow-y: auto;
  flex: 1;
}

#list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
  border-bottom: 1px solid #eee;
}

#list-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
  margin: 0;
}

#list-count {
  font-size: 0.95rem;
  color: #999;
}

#list-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

#list-items li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

#list-items li:hover {
  background: #f5f8fc;
}

#list-items li.list-item-active {
  background: #e8f0fe;
}

.list-item-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

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

.list-item-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.list-item-island {
  font-size: 0.88rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.list-item-category {
  font-size: 0.88rem;
  color: #777;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Map Controls Customization ---- */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  width: 42px !important;
  height: 42px !important;
  line-height: 42px !important;
  font-size: 22px !important;
  color: #333 !important;
  background: rgba(255,255,255,0.95) !important;
  border-bottom: 1px solid #eee !important;
}

.leaflet-control-zoom a:hover {
  background: #f0f0f0 !important;
}

/* Custom Reset Button */
.map-reset-btn {
  background: rgba(255,255,255,0.95);
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #1C4D8E;
  font-family: 'Proxima', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.map-reset-btn:hover {
  background: #f0f0f0;
}

/* ---- Cluster Markers ---- */
.marker-cluster {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Proxima', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #attractions-map-wrapper {
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
  }

  #map-header {
    top: 8px;
    padding: 8px 18px;
  }

  #map-header h1 {
    font-size: 1.35rem;
  }

  #map-header .map-subtitle {
    font-size: 0.88rem;
  }

  #island-filters {
    top: 75px;
    padding: 5px 8px;
    gap: 4px;
  }

  .island-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  #attraction-list {
    display: none;
  }

  #panel-content {
    flex-direction: column;
  }

  #panel-image-wrap {
    width: 100%;
    max-width: none;
    height: 160px;
  }

  #panel-info {
    padding: 14px 18px;
  }

  #panel-name {
    font-size: 1.35rem;
  }

  #category-legend {
    bottom: 16px;
    left: 8px;
    font-size: 0.78rem;
    gap: 8px;
    padding: 6px 10px;
  }

  #attraction-panel {
    max-height: 55vh;
  }
}

@media (max-width: 480px) {
  #map-header h1 {
    font-size: 1.15rem;
  }

  .island-btn .btn-label {
    display: none;
  }

  #island-filters {
    gap: 3px;
  }

  .island-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  #category-legend {
    display: none;
  }
}

/* ---- Tile layer styling ---- */
.leaflet-tile-pane {
  filter: saturate(0.85) brightness(1.02);
}

/* Fix for site header overlap */
.attractions-map-page .cd-main-content > section.content {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

.attractions-map-page section.content {
  padding: 0 !important;
  margin: 0 !important;
}

.attractions-map-page .main-content {
  margin: 0 !important;
  padding: 0 !important;
}

/* Popup styling */
.attraction-popup {
  font-family: 'Proxima', -apple-system, sans-serif;
  min-width: 200px;
}

.attraction-popup .popup-name {
  font-weight: 700;
  font-size: 1.15rem;
  color: #222;
  margin: 0 0 2px;
}

.attraction-popup .popup-category {
  font-size: 0.95rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 12px 16px !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
}

/* Loading state */
#attractions-map-wrapper.loading::after {
  content: 'Loading map...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Proxima', sans-serif;
  font-size: 1rem;
  color: #888;
  z-index: 5;
}
