/* ============================================
PETA WISATA - MAP PAGE STYLES
============================================ */

/* Page Layout */

.map-page-wrapper {
  display: flex;
  height: calc(100vh - 70px);
  margin-top: 70px;
  position: relative;
}

/* Sidebar */

.map-sidebar {
  width: 380px;
  min-width: 380px;
  background: var(--white);
  border-right: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: 4px 0 20px rgba(0,0,0,0.06);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
}

.sidebar-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  margin: 0;
}

.sidebar-search {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.sidebar-search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(0,0,0,0.08);
  background: var(--bg-light);
  font-size: 0.9rem;
  transition: var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.sidebar-search input:focus {
  border-color: var(--primary);
  background-color: var(--white);
  box-shadow: 0 0 0 3px rgba(0,119,182,0.1);
}

.beach-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.beach-list::-webkit-scrollbar {
  width: 5px;
}

.beach-list::-webkit-scrollbar-track {
  background: transparent;
}

.beach-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 10px;
}

.beach-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  position: relative;
}

.beach-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  transform: scaleY(0);
  transition: var(--transition);
}

.beach-item:hover {
  background: var(--bg-light);
}

.beach-item:hover::before,
.beach-item.active::before {
  transform: scaleY(1);
}

.beach-item.active {
  background: linear-gradient(90deg, rgba(0,119,182,0.06), transparent);
}

.beach-item-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.beach-item-info {
  flex: 1;
  min-width: 0;
}

.beach-item-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.beach-item-info .beach-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.beach-item-info .beach-price {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 4px;
}

.beach-item-route-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.beach-item-route-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,119,182,0.3);
}

/* Map Container */

.map-container-leaflet {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Custom Marker */

.custom-marker {
  position: relative;
}

.marker-pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  background: linear-gradient(135deg, var(--primary), #00b4d8);
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -18px 0 0 -18px;
  box-shadow: 0 3px 10px rgba(0,119,182,0.4);
  animation: markerPulse 2s ease-in-out infinite;
}

.marker-pin::after {
  content: '';
  width: 18px;
  height: 18px;
  margin: 9px 0 0 9px;
  background: var(--white);
  position: absolute;
  border-radius: 50%;
}

.marker-pin-icon {
  position: absolute;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  left: 50%;
  top: 50%;
  margin: -18px 0 0 -18px;
  z-index: 1;
  font-size: 16px;
}

@keyframes markerPulse {
  0%, 100% {
    box-shadow: 0 3px 10px rgba(0,119,182,0.4);
  }

  50% {
    box-shadow: 0 3px 20px rgba(0,119,182,0.6);
  }

}

/* Map Popup */

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 280px !important;
  font-family: 'Poppins', sans-serif !important;
}

.leaflet-popup-tip {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

.popup-card {
  width: 100%;
}

.popup-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.popup-card-body {
  padding: 14px 16px 16px;
}

.popup-card-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.popup-card-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(0,119,182,0.08), rgba(0,180,216,0.08));
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.popup-facilities {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.popup-facility-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  background: var(--bg-light);
  color: var(--text-light);
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.06);
  font-weight: 500;
}

.popup-route-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
}

.popup-route-btn:hover {
  box-shadow: 0 4px 15px rgba(0,119,182,0.35);
  transform: translateY(-1px);
}

/* Route Info Panel */

.route-info-panel {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--radius-xl);
  padding: 24px 32px;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 32px;
  border: 1px solid rgba(255,255,255,0.6);
  animation: slideUp 0.4s cubic-bezier(0.4,0,0.2,1) forwards;
  max-width: 90%;
}

.route-info-panel.show {
  display: flex;
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }

}

.route-info-item {
  text-align: center;
}

.route-info-item .route-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.route-info-item .route-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.route-info-item .route-value.highlight {
  color: var(--primary);
}

.route-info-divider {
  width: 1px;
  height: 40px;
  background: rgba(0,0,0,0.1);
}

.route-info-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.route-info-close:hover {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}

/* Loading Overlay */

.map-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  flex-direction: column;
  gap: 16px;
}

.map-loading-overlay.show {
  display: flex;
}

.map-loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(0,119,182,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }

}

.map-loading-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
}

/* Sidebar Toggle (Mobile) */

.sidebar-toggle {
  display: none;
  position: absolute;
  top: 80px;
  left: 10px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: var(--primary);
  color: var(--white);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

/* Leaflet Routing Machine override */

.leaflet-routing-container {
  display: none !important;
}

@media (max-width: 768px) {
  .map-page-wrapper {
    flex-direction: column;
    height: calc(100vh - 60px);
    margin-top: 60px;
  }

  /* Map fills full screen */

  .map-container-leaflet {
    width: 100%;
    height: 100%;
    position: relative;
  }

  #map {
    height: 100%;
    min-height: calc(100vh - 60px);
  }

  /* Sidebar as bottom drawer */

  .map-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    height: 55vh;
    max-height: 55vh;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-right: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  }

  .map-sidebar.open {
    transform: translateY(0);
  }

  .sidebar-header {
    padding: 16px 20px 12px;
    border-radius: 16px 16px 0 0;
    position: relative;
  }

  .sidebar-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.4);
    border-radius: 2px;
  }

  .sidebar-header h2 {
    font-size: 1.1rem;
  }

  .sidebar-header p {
    font-size: 0.78rem;
  }

  .sidebar-search {
    padding: 10px 16px;
  }

  .sidebar-search input {
    padding: 8px 12px 8px 36px;
    font-size: 0.85rem;
  }

  .beach-item {
    padding: 10px 16px;
    gap: 10px;
  }

  .beach-item-img {
    width: 48px;
    height: 48px;
  }

  .beach-item-info h4 {
    font-size: 0.88rem;
  }

  .beach-item-info .beach-location {
    font-size: 0.72rem;
  }

  .beach-item-info .beach-price {
    font-size: 0.75rem;
  }

  .beach-item-route-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  /* Toggle button */

  .sidebar-toggle {
    display: flex;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    width: auto;
    height: auto;
    padding: 10px 20px;
    border-radius: 50px;
    background: var(--primary);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0,119,182,0.4);
    z-index: 499;
  }

  .sidebar-toggle:hover {
    background: var(--primary-dark);
    color: var(--white);
  }

  /* Route info */

  .route-info-panel {
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    bottom: 16px;
    width: 90%;
    max-width: 320px;
  }

  .route-info-divider {
    display: none;
  }

  .route-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    text-align: left;
  }

  .route-info-item .route-value {
    font-size: 1.1rem;
  }

  .leaflet-popup-content {
    width: 240px !important;
  }

  .popup-card-img {
    height: 120px;
  }

  .popup-card-body {
    padding: 10px 12px 12px;
  }

  .popup-card-body h3 {
    font-size: 0.95rem;
  }

}

@media (max-width: 480px) {
  .map-sidebar {
    height: 60vh;
    max-height: 60vh;
  }

  .leaflet-popup-content {
    width: 220px !important;
  }

  .popup-card-img {
    height: 100px;
  }

}
