/* ===== MAP PAGE BASE V2 (IMMERSIVE PREMIUM) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body.page-map {
    font-family: 'Inter', sans-serif;
    background: #F8FAFC;
    color: #0F172A;
    margin: 0;
    overflow: hidden;
}
body.page-map main { padding: 0; }
body.page-map footer { display: none; }

/* Global Header over map */
body.page-map .header--map {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    height: 72px; /* Fixed height for calculations */
    display: flex;
    align-items: center;
}
body.page-map .header--map .header__inner {
    width: 100%;
    max-width: 100%;
    padding: 0 24px;
}

/* Map Layout */
.map-layout-v2 {
  display: block;
  height: 100vh;
  width: 100vw;
  position: relative;
}

.map-fullscreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100; /* Leaflet needs to be at bottom */
}

/* Override Leaflet z-index to stay below UI */
.leaflet-top, .leaflet-bottom { z-index: 400 !important; }

/* ===== FLOATING SIDEBAR (DESKTOP) ===== */
.floating-sidebar {
  position: absolute;
  top: 84px; /* Below header */
  left: 20px;
  bottom: 24px;
  width: 440px;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
  z-index: 500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #E2E8F0;
}

.floating-sidebar__header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #FFFFFF;
  z-index: 10;
}

/* Premium Search */
.map-search-wrap { position: relative; width: 100%; }
.map-search-input {
  width: 100%;
  padding: 16px 48px 16px 24px;
  border: 1px solid #E2E8F0;
  border-radius: 32px;
  font-size: 15px;
  font-weight: 500;
  color: #0F172A;
  background: #F8FAFC;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
  font-family: inherit;
}
.map-search-input::placeholder { color: #64748B; font-weight: 400;}
.map-search-input:focus {
  outline: none;
  background: #fff;
  border-color: #3B82F6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}
.map-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #3B82F6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.map-search-btn:hover { background: #2563EB; transform: translateY(-50%) scale(1.05); }

/* Quick Filters */
.map-quick-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.map-quick-filters::-webkit-scrollbar { display: none; }
.quick-filter-pill {
  padding: 6px 12px;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #0F172A;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}
.quick-filter-pill:hover { border-color: #64748B; }
.quick-filter-pill.active { border-color: #0F172A; box-shadow: 0 0 0 1px #0F172A; }

/* Category Chips */
.map-chips-container { margin: 0 -24px; padding: 0 24px; }
.map-chips-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.map-chips-scroll::-webkit-scrollbar { display: none; }
.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 24px;
  border: 1px solid #E2E8F0;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: #64748B;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}
.filter-chip:hover { border-color: #0F172A; color: #0F172A; }
.filter-chip--active {
  background: #F8FAFC;
  border-color: #0F172A;
  color: #0F172A;
  font-weight: 600;
}
.filter-chip__icon { font-size: 16px; }

/* Toolbar */
.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.btn-more-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #E2E8F0;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #0F172A;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.btn-more-filters:hover { background: #F8FAFC; }

.sort-select {
  font-size: 13px;
  font-weight: 500;
  padding: 8px;
  border: none;
  background: transparent;
  color: #0F172A;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.sort-select:hover { background: #F8FAFC; border-radius: 8px; }

/* Sidebar Content */
.floating-sidebar__content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: #FFFFFF;
}
.sidebar-results-header {
  padding: 16px 24px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #0F172A;
}
.sidebar-list { list-style: none; padding: 0 24px 24px; margin: 0; display: flex; flex-direction: column; gap: 24px; }

/* ===== PREMIUM CARD V2 ===== */
.premium-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}
.premium-card__image-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #E2E8F0;
}
.premium-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.premium-card:hover .premium-card__img { transform: scale(1.04); }

.premium-card__rating-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  color: #0F172A;
}
.premium-card__rating-badge .star { color: #0F172A; } /* Black star Airbnb style */

.premium-card__save-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.premium-card__save-btn:hover svg { stroke: #EF4444; }
.premium-card__save-btn[data-saved="true"] svg { fill: #EF4444; stroke: #EF4444; }

.premium-card__info { display: flex; flex-direction: column; gap: 4px; }
.premium-card__header { display: flex; justify-content: space-between; align-items: flex-start; }
.premium-card__title {
  font-size: 16px;
  font-weight: 600;
  color: #0F172A;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
}
.premium-card__meta {
  font-size: 14px;
  color: #64748B;
  display: flex;
  align-items: center;
  gap: 6px;
}
.premium-card__dot { opacity: 0.5; }
.premium-card__pets {
  font-size: 13px;
  color: #22C55E;
  margin-top: 2px;
  font-weight: 500;
}
.premium-card__price {
  font-size: 14px;
  font-weight: 500;
  color: #0F172A;
  margin-top: 4px;
}

/* Skeletons */
.skeleton-premium-card { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px;}
.skeleton-img { width: 100%; aspect-ratio: 4/3; border-radius: 16px; background: #E2E8F0; animation: pulse 1.5s infinite; }
.skeleton-info { display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 16px; border-radius: 4px; background: #E2E8F0; animation: pulse 1.5s infinite; }
.skeleton-line.title { width: 70%; height: 20px; }
.skeleton-line.sub { width: 40%; }
.skeleton-line.pets { width: 50%; height: 14px;}
@keyframes pulse { 0% {opacity: 1;} 50% {opacity: 0.6;} 100% {opacity: 1;} }

/* Empty state */
.sidebar-empty { padding: 48px 24px; text-align: center; }
.sidebar-empty__icon { color: #64748B; opacity: 0.4; margin-bottom: 16px; }
.sidebar-empty__title { font-weight: 600; font-size: 18px; color: #0F172A; margin: 0 0 8px 0; }
.sidebar-empty__sub { font-size: 14px; color: #64748B; margin-bottom: 24px; line-height: 1.5;}
.btn-load-more {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #0F172A;
  background: transparent;
  color: #0F172A;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.btn-load-more:hover { background: #F8FAFC; }

/* ===== PLACE DRAWER V2 ===== */
.place-drawer {
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: #FFFFFF;
  z-index: 2000;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  border-radius: 24px; /* Same as sidebar */
}
.place-drawer--open { left: 0; }
.place-drawer__close {
  position: absolute;
  top: 20px; left: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 10;
  color: #0F172A;
}
.place-drawer__close:hover { background: #fff; transform: scale(1.05); }

.drawer-hero { width: 100%; height: 300px; object-fit: cover; }
.drawer-body { padding: 24px; }
.drawer-title { font-size: 26px; font-weight: 700; color: #0F172A; margin: 0 0 8px 0; }
.drawer-meta { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #64748B; margin-bottom: 24px; }
.drawer-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid #E2E8F0; }
.drawer-section h4 { font-size: 18px; font-weight: 600; color: #0F172A; margin: 0 0 16px 0; }
.drawer-actions { display: flex; gap: 12px; }
.drawer-btn { flex: 1; padding: 14px; border-radius: 12px; font-weight: 600; font-size: 15px; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px;}
.drawer-btn--primary { background: #3B82F6; color: white; }
.drawer-btn--primary:hover { background: #2563EB; }
.drawer-btn--outline { border: 1px solid #E2E8F0; color: #0F172A; }
.drawer-btn--outline:hover { background: #F8FAFC; }

/* ===== MAP CONTROLS ===== */
.map-floating-btn {
  position: absolute;
  z-index: 600;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 28px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  color: #0F172A;
  font-family: inherit;
}
.map-floating-btn:hover { transform: scale(1.03); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }

.map-floating-btn--locate {
  bottom: 40px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #3B82F6;
}

.map-floating-btn--list-toggle {
  display: none;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  background: #0F172A;
  color: #fff;
  gap: 8px;
  border: none;
}
.map-floating-btn--list-toggle:hover { transform: translateX(-50%) scale(1.03); }

/* ===== PREMIUM CUSTOM MARKERS ===== */
.custom-pin {
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #FFFFFF;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}
.custom-pin span {
  transform: rotate(45deg);
  font-size: 18px;
  line-height: 1;
}
.custom-pin:hover, .custom-pin.active {
  transform: rotate(-45deg) scale(1.3);
  z-index: 1000 !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  border-width: 2px;
}
.leaflet-div-icon { background: transparent; border: none; }

/* LEAFLET POPUP MINI CARD V2 */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15) !important;
}
.leaflet-popup-content { margin: 0 !important; width: 260px !important; cursor: pointer; font-family: 'Inter', sans-serif !important;}
.leaflet-popup-close-button {
  width: 32px !important;
  height: 32px !important;
  background: rgba(255,255,255,0.9) !important;
  backdrop-filter: blur(4px);
  border-radius: 50% !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  top: 10px !important; right: 10px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  color: #0F172A !important;
}
.map-popup-card { display: flex; flex-direction: column;}
.map-popup-card__img { width: 100%; height: 140px; object-fit: cover; }
.map-popup-card__info { padding: 16px; }
.map-popup-card__title { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: #0F172A; }
.map-popup-card__meta { font-size: 13px; color: #64748B; display: flex; justify-content: space-between; align-items: center;}
.map-popup-card__star { color: #0F172A; font-weight: 600; }

/* ===== MOBILE PREMIUM BOTTOM SHEET ===== */
@media (max-width: 768px) {
  .floating-sidebar { display: none; }
  .map-floating-btn--list-toggle { display: none; }
  
  .bottom-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 28px 28px 0 0;
    z-index: 2000;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
    height: 85dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
    
    /* Default state (collapsed) shows the handle wrap */
    transform: translateY(calc(100% - 96px - env(safe-area-inset-bottom))); 
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    touch-action: none;
  }
  
  .bottom-sheet--half { transform: translateY(45%); }
  .bottom-sheet--full { transform: translateY(0); }
  
  .bottom-sheet__handle-wrap {
    padding: 16px 0 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: grab;
    width: 100%;
    touch-action: none;
  }
  .bottom-sheet__handle {
    width: 48px; height: 5px;
    background: #CBD5E1;
    border-radius: 3px;
    margin-bottom: 12px;
  }
  .bottom-sheet__peek { padding: 0 24px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 4px; }
  .bottom-sheet__title { font-weight: 700; font-size: 16px; color: #0F172A;}
  .bottom-sheet__subtitle { font-size: 13px; color: #64748B; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px;}
  
  .bottom-sheet__content {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
    touch-action: pan-y;
  }
  
  .bottom-sheet__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 24px; }
  
  /* Make sure leaflet controls are above the collapsed bottom sheet */
  .leaflet-bottom { bottom: calc(96px + env(safe-area-inset-bottom)) !important; }
}

/* Autocomplete Premium */
.map-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 0; right: 0;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 0 0 1px #E2E8F0;
  max-height: 340px;
  overflow-y: auto;
  z-index: 100;
}
.ac-item { padding: 14px 20px; display: flex; align-items: center; gap: 14px; cursor: pointer; border-bottom: 1px solid #F1F5F9; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: #F8FAFC; }
.ac-item__icon { font-size: 20px; }
.ac-item__name { font-size: 15px; font-weight: 500; color: #0F172A; }
.ac-item__sub { font-size: 13px; color: #64748B; margin-top: 2px;}

/* Extra panels */
.extra-filters-panel {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 20px;
  margin-top: 12px;
}
