/* =========================================
   1. DESIGN TOKENS & RESET
   ========================================= */
   :root {
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
  
    /* Dimensions */
    --btn-size: 40px;       /* Desktop standard */
    --radius-md: 12px;
    --radius-pill: 50px;
  
    /* Shadows */
    --shadow-base: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0,0,0,0.05);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-active: 0 1px 4px rgba(0, 0, 0, 0.15);
  
    /* Animations */
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100dvh; /* Dynamic Height for Mobile Browsers */
    overflow: hidden;
    background-color: #fafafa;
    color: #1a1a1a;
  }
  
  /* =========================================
     2. MAP LAYER
     ========================================= */
  #map {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 1;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }
  
  /* =========================================
     3. UI: NAVBAR WITH CITY SELECTOR
     ========================================= */
  .navbar {
    position: fixed;
    top: var(--space-md);
    left: var(--space-lg);
    right: var(--space-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Container for Logo + City Selector */
  .brand-container {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: opacity 0.2s;
  }

  .logo:hover {
    opacity: 0.7;
  }

  /* City Selector Pill */
  .city-selector {
    position: relative;
  }

  .city-btn {
    background: #f1f3f5;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
  }

  .city-btn:hover {
    background: #e9ecef;
  }

  /* Dropdown Panel */
  .city-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    left: 0;
    background: white;
    min-width: 200px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 8px;
    z-index: 1001;
    animation: slideDown 0.15s ease-out;
  }

  .city-dropdown.show {
    display: block;
  }

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

  /* Dropdown Items */
  .city-option {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: #444;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: background 0.1s;
  }

  .city-option:hover {
    background: #f8f9fa;
    color: #000;
  }

  .city-option.active {
    background: #f1f3f5;
    font-weight: 600;
    color: #000;
  }

  .city-option.add-new {
    color: #667eea;
    font-weight: 500;
  }

  .dropdown-header {
    padding: 8px 12px 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #999;
    font-weight: 700;
    letter-spacing: 0.5px;
  }

  .dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 6px 0;
  }

  /* Mode Toggle */
  .mode-toggle-container {
    background: white;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-base);
    display: flex;
    gap: 4px;
    padding: 5px;
  }

  .mode-btn {
    padding: 6px 18px;
    border: none;
    background: transparent;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mode-btn.active {
    background: #111;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  
  /* =========================================
     4. MAP CONTROLS: ACTION STACK
     ========================================= */
  .action-stack-container {
    position: fixed;
    bottom: 100px; 
    right: var(--space-sm);
    z-index: 1000;
    display: flex; flex-direction: column; gap: var(--space-sm);
  }
  
  .map-action-btn {
    width: var(--btn-size); height: var(--btn-size);
    background: white; border: none; border-radius: 12px;
    box-shadow: var(--shadow-base);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #333; font-weight: 600;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
  }
  .map-action-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); background: #fff; z-index: 10; }
  .map-action-btn:active { transform: translateY(0); box-shadow: var(--shadow-active); background: #f4f4f4; }
  .locate-btn { border-radius: 50%; margin-bottom: 4px; }
  
  /* =========================================
     5. CITY VOTE & SUPPORT BUTTONS
     ========================================= */
  #support-btn {
    position: fixed; bottom: 100px; left: var(--space-lg);
    z-index: 1000;
    background: white; padding: 10px 16px; border-radius: var(--radius-pill);
    text-decoration: none; color: #333; font-size: 0.8rem; font-weight: 600;
    box-shadow: var(--shadow-base);
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
    display: inline-flex; align-items: center; gap: 8px;
  }
  #support-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
  
  #city-vote-btn {
    position: fixed; bottom: 150px; left: var(--space-lg);
    z-index: 1000;
    background: white; width: 40px; height: 40px; border-radius: 50%;
    text-decoration: none; color: #333; font-size: 1.2rem;
    box-shadow: var(--shadow-base);
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  #city-vote-btn span:last-child { display: none; }
  #city-vote-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
  
  /* =========================================
     6. FILTERS BAR
     ========================================= */
  .filters-container {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex; align-items: center; gap: 0.7rem;
    padding: 1rem var(--space-lg);
    
    
    overflow-x: auto; scrollbar-width: none;
  }
  .filters-container::-webkit-scrollbar { display: none; }
  
  .filters { display: flex; gap: 0.6rem; flex: 1; }
  
  .filter-btn {
    flex: 0 0 auto; height: 34px; padding: 0 16px;
    font-size: 0.85rem; white-space: nowrap;
    border-radius: var(--radius-pill); background: white;
    border: 1px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    color: #333; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 6px; font-weight: 500;
  }
  .filter-btn:hover { background: #f9f9f9; transform: translateY(-1px); }
  .filter-btn.active { background: #111; color: white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
  .filter-icon { width: 8px; height: 8px; border-radius: 50%; background: var(--vibe-color, #666); }
  
  .clear-btn-x {
    width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
    background: #f0f0f0; border: none; color: #666;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; transition: all 0.2s;
  }
  
 /* =========================================
   7. POPUP STYLING (Airbnb Style)
   ========================================= */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 16px; /* Airbnb uses slightly rounder corners */
  overflow: visible;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12); /* Softer shadow */
}

.leaflet-popup-content {
  margin: 0;
  width: 300px !important; /* Slightly wider for better readability */
  position: relative;
}

.leaflet-popup-tip-container { display: none; }

/* Close Button - Floating Bubble */
.leaflet-popup-close-button {
  background: white !important;
  border-radius: 50%;
  width: 32px !important;
  height: 32px !important;
  top: 12px !important;
  right: 12px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #222 !important;
  font-size: 18px !important;
  opacity: 1 !important;
  z-index: 20;
}

/* Carousel - IMMERSIVE IMAGE */
.popup-carousel {
  height: 200px; /* Keep it TALL */
  background: #ddd;
  border-radius: 16px 16px 0 0;
  position: relative;
  overflow: hidden;
}

.carousel-images {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease-in-out;
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #111;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s;
}

.popup-carousel:hover .carousel-nav { opacity: 1; }
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s;
}

.carousel-dot.active {
  background: white;
  width: 18px;
  border-radius: 3px;
}

/* Content - Clean & Spacious */
.popup-content {
  padding: 16px;
  background: white;
  border-radius: 0 0 16px 16px;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.popup-title {
  font-size: 1.1rem; /* Larger, clearer title */
  font-weight: 600; /* Airbnb uses semi-bold, not black weight */
  color: #222;
  line-height: 1.2;
  margin-right: 8px;
}

.rating {
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Vibes - Subtle Tags */
.popup-vibes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.vibe-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px; /* Less pill-shaped, more tag-shaped */
  color: white;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Quote - THE CLEAN FIX */
.sample-quote {
  /* Remove the box/background */
  background: transparent;
  border: none;
  border-left: none;
  padding: 0;
  margin: 12px 0;
  
  /* Typography */
  font-size: 0.95rem;
  color: #717171; /* Airbnb secondary text color */
  font-style: normal; /* Modern look */
  line-height: 1.4;
  
  /* ✂️ LINE CLAMPING (The Magic) */
  /* This forces text to stop after 3 lines with "..." */
  display: -webkit-box;
  -webkit-line-clamp: 3; 
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Highlight keywords just via Bold, no background */
.sample-quote strong {
  background: transparent;
  color: #222;
  font-weight: 600;
}

.google-maps-link {
  display: block; /* Full width link */
  margin-top: 12px;
  color: #222;
  text-decoration: underline;
  font-size: 0.9rem;
  font-weight: 600;
}
  /* =========================================
     8. NAVIGATION ARROWS
     ========================================= */
  .navigation-arrows-container {
    position: absolute; top: 50%; left: 0; right: 0; height: 0;
    transform: translateY(-50%); pointer-events: none; z-index: 1000;
  }
  .cafe-nav-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    background: white; border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; pointer-events: auto;
    color: #111; font-weight: bold; font-size: 18px;
    transition: all 0.2s var(--ease-spring);
  }
  .cafe-nav-back { left: -50px; }
  .cafe-nav-forward { right: -50px; }
  .cafe-nav-arrow:hover { transform: translateY(-50%) scale(1.15); }
  
  /* =========================================
     9. MARKERS & MODALS
     ========================================= */
  .custom-marker { background: transparent; border: none; }
  .marker-container { display: flex; flex-direction: column; align-items: center; justify-content: center; width:100%; height:100%; position: relative; }
  .marker-label {
    position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
    background: white; padding: 4px 10px; border-radius: 12px;
    font-size: 0.75rem; font-weight: 700; white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none; opacity: 0; transition: opacity 0.2s; z-index: 20; color: #333;
  }
  .custom-marker:hover .marker-label { opacity: 1; transform: translateX(-50%) translateY(-5px); }
  .marker-pin {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2); border: 2px solid white;
    cursor: pointer; transition: transform 0.2s var(--ease-spring); z-index: 10;
  }
  .marker-pin:hover { transform: scale(1.2); z-index: 100; }
  .marker-rating { font-size: 0.65rem; font-weight: 800; color: white; }

  /* Upcoming/Trending Pulse Animation (Hoodmaps-style) - COMMENTED OUT FOR LATER */
  /*
  @keyframes pulse-ring {
    0% { transform: scale(0.33); opacity: 0; }
    40% { opacity: 1; }
    80%, 100% { transform: scale(2.5); opacity: 0; }
  }

  @keyframes pulse-dot {
    0% { transform: scale(0.8); }
    50% { transform: scale(1); }
    100% { transform: scale(0.8); }
  }

  .marker-pin.upcoming {
    position: relative;
    animation: pulse-dot 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
  }

  .marker-pin.upcoming::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid #FF5F6D;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  }
  */

  #intro-modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px);
    z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px;
  }
  .modal-content { background: white; border-radius: 24px; padding: 40px; max-width: 480px; text-align: center; box-shadow: 0 20px 80px rgba(0,0,0,0.4); }
  .modal-content h2 { font-size: 2rem; margin-bottom: 16px; font-weight: 800; letter-spacing: -0.02em; }
  .modal-content p { color: #666; margin-bottom: 32px; line-height: 1.6; font-size: 1.1rem; }
  .modal-content button { background: #111; color: white; border: none; padding: 16px 40px; border-radius: 50px; font-size: 1.1rem; font-weight: 600; cursor: pointer; }
  
 /* =========================================
   10. MOBILE RESPONSIVENESS (Optimized)
   ========================================= */
@media (max-width: 768px) {
  /* 1. Full Screen Map */
  #map {
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 0; border: none;
  }

  /* 2. UI Adjustments for Touch */
  .navbar {
    top: calc(12px + env(safe-area-inset-top));
    left: 16px;
    right: 16px;
  }

  .logo {
    font-size: 1.2rem;
  }

  .city-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .mode-toggle-container {
    padding: 4px;
  }

  /* 3. Filter Bar - STACKING MODE */
  .filters-container {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    /* Allow height to grow as buttons stack */
    height: auto;
    align-items: flex-start;
  }

  .filters {
    /* ⚡ CHANGE: Wrap buttons to next line instead of scrolling */
    flex-wrap: wrap; 
    gap: 8px; /* Slightly larger gap for touch targets */
    justify-content: flex-start; /* Align left */
  }

  /* Make filter buttons slightly bigger for thumbs */
  .filter-btn { 
    height: 36px; 
    padding: 0 14px; 
    font-size: 0.85rem;
    flex: 0 0 auto; /* Don't stretch */
  }

  /* 4. Positioning Controls (Push UP to clear stacked filters) */
  /* Stacked filters take up ~90-100px. We need to clear that. */
  .action-stack-container {
    bottom: 50px;
    right: 0px;
  }

  #city-vote-btn {
    left: 16px;
    /* Match the bottom alignment of the Action Stack */
    bottom: calc(140px + env(safe-area-inset-bottom));
    width: 44px; height: 44px; font-size: 1.4rem;
  }

  /* Bigger buttons for touch */
  .map-action-btn { width: 44px; height: 44px; font-size: 1.4rem; }

  /* Hide Support Button on Mobile */
  #support-btn { display: none; }

  /* 5. Nav Arrows - Pull them in safe */
  .cafe-nav-back { left: -12px; }
  .cafe-nav-forward { right: -12px; }
  
  .cafe-nav-arrow {
    width: 36px; height: 36px;
    border: 2px solid white;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  }

  /* 6. Popup - Wider on mobile for better readability */
  .leaflet-popup-content {
    width: 320px !important; /* Wider on mobile */
    max-width: 90vw;
  }

  /* Maintain large image on mobile */
  .popup-carousel {
    height: 200px;
  }

  /* Always show carousel arrows on mobile (no hover on touch) */
  .carousel-nav {
    opacity: 1;
  }

  /* 7. Modal resizing */
  .modal-content { padding: 30px 20px; width: 90%; }

  /* 8. Hide Label on Mobile */
  .marker-label { display: none; }

  .mode-btn {
    padding: 3px 9px;
    font-size: 0.65rem; font-weight: 600; color: #666;
  }
}