/* ============================================================
   maharashtra.rent — Design System
   A venture-scale, mobile-first, dark-theme design system
   ============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  /* Default Theme (Dark) */
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.10);
  --surface-active: rgba(255, 255, 255, 0.14);
  --surface-glass: rgba(17, 17, 17, 0.92);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.20);

  /* Text */
  --text-primary: #f0f0f0;
  --text-secondary: #9a9a9a;
  --text-tertiary: #666666;
  --text-inverse: #0a0a0a;

  /* Accent Colors */
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --accent-glow: rgba(255, 107, 53, 0.25);
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.25);
  --accent-orange: #f97316;
  --accent-orange-glow: rgba(249, 115, 22, 0.25);
  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.25);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.25);
  --accent-teal: #0ea5e9;
  --accent-teal-glow: rgba(14, 165, 233, 0.25);
  --accent-yellow: #eab308;
  --accent-yellow-glow: rgba(234, 179, 8, 0.25);
  --accent-grey: #71717a;
  --accent-grey-glow: rgba(113, 113, 122, 0.25);

  /* Semantic Colors */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-color: rgba(0,0,0,0.5);
  --shadow-sm: 0 1px 2px var(--shadow-color);
  --shadow-md: 0 4px 12px var(--shadow-color);
  --shadow-lg: 0 8px 32px var(--shadow-color);
  --shadow-xl: 0 16px 48px var(--shadow-color);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Z-index layers */
  --z-map: 1;
  --z-controls: 100;
  --z-search: 200;
  --z-sheet: 500;
  --z-overlay: 700;
  --z-modal: 900;
  --z-toast: 1000;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Layout */
  --header-height: 56px;
  --bottom-bar-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light Theme Overrides */
[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-elevated: #ffffff;
  --surface: rgba(0, 0, 0, 0.04);
  --surface-hover: rgba(0, 0, 0, 0.08);
  --surface-active: rgba(0, 0, 0, 0.12);
  --surface-glass: rgba(255, 255, 255, 0.90);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --accent-glow: rgba(255, 107, 53, 0.15);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: var(--font-sans);
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
  border: none;
  background: none;
  color: var(--text-primary);
}

/* ============================================================
   LEAFLET MAP OVERRIDES
   ============================================================ */
#map {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: var(--z-map);
  background: var(--bg);
}

.leaflet-container {
  background: var(--bg) !important;
  font-family: var(--font-sans) !important;
}

.leaflet-control-zoom {
  display: none !important;
}

.leaflet-control-attribution {
  background: rgba(0,0,0,0.7) !important;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  padding: 2px 6px !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
}

/* Custom cluster markers */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(255, 107, 53, 0.25) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: var(--accent) !important;
  color: white !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  font-family: var(--font-sans) !important;
}

/* Custom pin markers */
.custom-pin {
  position: relative;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  transition: transform var(--duration-fast) var(--ease-spring);
}

.custom-pin:hover {
  transform: scale(1.15);
}

.custom-pin-gated {
  color: var(--accent-blue);
}

.custom-pin-nongated {
  color: var(--accent-orange);
}

.custom-pin-pg {
  color: var(--accent-purple);
}

.custom-pin-studio {
  color: var(--accent-teal);
}

.custom-pin-1rk {
  color: var(--accent-yellow);
}

.custom-pin-room {
  color: var(--accent-grey);
}

.pin-tag {
  position: absolute;
  top: -8px;
  right: -12px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.pin-tag-above {
  background: var(--warning);
  color: var(--text-inverse);
}

.pin-tag-flatmate {
  background: var(--info);
  color: white;
}

.pin-tag-vacant {
  background: var(--success);
  color: var(--text-inverse);
}

.pin-tag-owner {
  background: var(--accent-green);
  color: white;
  animation: bounce-in 0.5s var(--ease-spring);
}

@keyframes bounce-in {
  from { transform: translateX(-50%) scale(0); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-container {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-search);
  max-width: 500px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: var(--space-3) var(--space-5);
  box-shadow: var(--shadow-lg);
  transition: border-color var(--duration-normal) var(--ease-out);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-glow);
}

.search-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.search-input {
  flex: 1;
  height: 36px;
  font-size: 15px;
  color: var(--text-primary);
  background: transparent;
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  cursor: pointer;
  display: none;
  transition: color var(--duration-fast);
}

.search-clear:hover {
  color: var(--text-primary);
}

.search-clear.visible {
  display: block;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-height: 320px;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: none;
}

.search-results.active {
  display: block;
  animation: slideDown var(--duration-normal) var(--ease-out);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  cursor: pointer;
  transition: background var(--duration-fast);
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover, .search-result-item.active {
  background: var(--surface-hover);
}

.search-result-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.search-result-text {
  font-size: 14px;
  line-height: 1.4;
}

.search-result-secondary {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================================
   FLOATING ACTION BUTTONS (Right Side)
   ============================================================ */
.fab-container {
  position: fixed;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-controls);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.fab {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 20px;
  box-shadow: var(--shadow-md);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.fab:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: scale(1.08);
}

.fab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: var(--shadow-glow);
}

.fab-tooltip {
  position: absolute;
  right: calc(100% + var(--space-2));
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast);
}

.fab:hover .fab-tooltip {
  opacity: 1;
}

/* ============================================================
   PRIMARY CTA - Add Rent Button
   ============================================================ */
.add-rent-btn {
  position: fixed;
  bottom: calc(var(--space-6) + var(--safe-bottom) + 64px);
  right: var(--space-4);
  z-index: var(--z-controls);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background: var(--accent);
  color: white;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
  transition: all var(--duration-normal) var(--ease-out);
  animation: pulse-glow 3s ease-in-out infinite;
}

.add-rent-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
  box-shadow: var(--shadow-xl), 0 0 40px var(--accent-glow);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: var(--shadow-lg), 0 0 20px var(--accent-glow); }
  50% { box-shadow: var(--shadow-lg), 0 0 40px var(--accent-glow); }
}

/* ============================================================
   SUPPORT MAIN BUTTON
   ============================================================ */
.support-main-btn {
  position: fixed;
  bottom: calc(var(--space-6) + var(--safe-bottom) + 64px); /* Moved slightly higher to clear stats bar if needed, or match add-rent */
  left: var(--space-4);
  z-index: var(--z-controls);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(245, 158, 11, 0.4);
  transition: all var(--duration-normal) var(--ease-out);
  animation: pulse-support 3s ease-in-out infinite;
}

.support-main-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-xl), 0 0 30px rgba(245, 158, 11, 0.6);
}

@keyframes pulse-support {
  0%, 100% { box-shadow: var(--shadow-lg), 0 0 15px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: var(--shadow-lg), 0 0 30px rgba(245, 158, 11, 0.7); }
}

/* ============================================================
   BOTTOM SHEET
   ============================================================ */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-sheet);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.bottom-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-sheet) + 1);
  background: var(--bg-elevated);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  max-height: 90vh;
  max-height: 90dvh;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-out);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-handle {
  display: flex;
  justify-content: center;
  padding: var(--space-3) 0;
  flex-shrink: 0;
}

.bottom-sheet-handle-bar {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5) var(--space-4);
  flex-shrink: 0;
}

.bottom-sheet-title {
  font-size: 18px;
  font-weight: 700;
}

.bottom-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background var(--duration-fast);
}

.bottom-sheet-close:hover {
  background: var(--surface-hover);
}

.bottom-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-5) var(--space-6);
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--space-6) + var(--safe-bottom));
}

/* ============================================================
   MODAL / OVERLAY
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-content {
  padding: var(--space-8);
  text-align: center;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  transition: all var(--duration-normal) var(--ease-out);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface-hover);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

textarea.form-input {
  height: auto;
  min-height: 80px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.form-select {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239a9a9a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
}

.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select option {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

/* Toggle Chips (BHK, Furnishing, etc) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
}

.chip:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
}

.toggle-label {
  font-size: 14px;
  color: var(--text-primary);
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  flex-shrink: 0;
}

.toggle.active {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--duration-normal) var(--ease-spring);
}

.toggle.active::after {
  transform: translateX(20px);
}

.toggle-green.active {
  background: var(--accent-green) !important;
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 12px var(--accent-green-glow);
}

/* Range Slider */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface);
  border-radius: var(--radius-full);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-whatsapp {
  background: #25D366;
  color: white;
  font-weight: 700;
}

.btn-whatsapp:hover {
  background: #20bd5a;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(37, 211, 102, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 16px;
  border-radius: var(--radius-lg);
}

/* ============================================================
   LANDING & TRUST SCREENS
   ============================================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: var(--space-5);
  opacity: 0;
  pointer-events: none;
  overflow-y: auto;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.onboarding-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-card {
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  margin: auto;
  animation: modalEnter var(--duration-slow) var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.onboarding-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}

.onboarding-emoji {
  font-size: 48px;
  margin-bottom: var(--space-4);
}

.onboarding-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: var(--space-3);
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.onboarding-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Trust Points */
.trust-points {
  text-align: left;
  margin-bottom: var(--space-8);
}

.trust-point {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.trust-point-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.trust-point-text span {
  color: var(--text-primary) !important;
  font-weight: 600;
}

/* ============================================================
   PIN DETAIL CARD (shown in bottom sheet)
   ============================================================ */
.pin-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.pin-detail-rent {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.pin-detail-bhk {
  font-size: 14px;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.pin-detail-building {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.pin-detail-locality {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.pin-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.detail-tag {
  font-size: 11px;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.detail-tag-gated {
  background: var(--info-bg);
  color: var(--accent-blue);
}

.detail-tag-nongated {
  background: var(--accent-orange-glow);
  color: var(--accent-orange);
}

.detail-tag-furnished {
  background: var(--success-bg);
  color: var(--success);
}

.detail-tag-semi {
  background: var(--accent-teal-glow);
  color: var(--accent-teal);
}

.detail-tag-unfurnished {
  background: var(--surface);
  color: var(--text-secondary);
}

.detail-tag-above {
  background: var(--warning-bg);
  color: var(--warning);
}

.detail-tag-flatmate {
  background: var(--info-bg);
  color: var(--info);
}

.detail-tag-vacant {
  background: var(--success-bg);
  color: var(--success);
}

.detail-tag-pg {
  background: var(--accent-purple-glow);
  color: var(--accent-purple);
}

.detail-tag-studio {
  background: var(--accent-teal-glow);
  color: var(--accent-teal);
}

.detail-tag-1rk {
  background: var(--accent-yellow-glow);
  color: var(--accent-yellow);
}

.detail-tag-room {
  background: var(--accent-grey-glow);
  color: var(--accent-grey);
}

.pin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.pin-detail-stat {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.pin-detail-stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pin-detail-stat-value {
  font-size: 15px;
  font-weight: 600;
  margin-top: var(--space-1);
}

.pin-detail-oneliner {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  padding: var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  margin-bottom: var(--space-4);
}

/* Ratings */
.pin-detail-ratings {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.rating-block {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
}

.rating-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.rating-stars {
  color: var(--warning);
  font-size: 16px;
  margin-top: var(--space-1);
}

.rating-value {
  font-size: 13px;
  font-weight: 600;
  margin-top: var(--space-1);
}

/* Pin Actions */
.pin-actions {
  display: flex;
  gap: var(--space-3);
}

/* ============================================================
   INSIGHT SCREEN
   ============================================================ */
.insight-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-5);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  overflow-y: auto;
  transition: all var(--duration-slow) var(--ease-out);
}

.insight-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.insight-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-6);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5);
  margin: auto;
  animation: modalEnter var(--duration-slow) var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.insight-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}

.insight-emoji {
  font-size: 72px;
  margin-bottom: var(--space-6);
  display: inline-block;
  transform-origin: center;
  animation: bounce 1s var(--ease-spring);
}

.insight-big-number {
  font-size: 56px;
  font-weight: 900;
  margin-bottom: var(--space-2);
  line-height: 1;
  letter-spacing: -2px;
  display: block;
}

.insight-overpaying {
  color: #ff4d4d;
  text-shadow: 0 0 20px rgba(255, 77, 77, 0.3);
}

.insight-great-deal {
  color: #00ff88;
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.insight-label {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--text-primary); 
  line-height: 1.3;
}

.insight-sublabel {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  opacity: 0.8;
}

.insight-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  background: var(--surface);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.insight-stat {
  text-align: center;
}

.insight-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.insight-stat-label {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insight-share-prompt {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  font-weight: 600;
}

.insight-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: 100%;
}


/* ============================================================
   FILTER PANEL
   ============================================================ */
.filter-btn {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-search);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transition: all var(--duration-normal) var(--ease-out);
}

.filter-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
  box-shadow: var(--shadow-lg), 0 0 15px var(--accent-glow);
}

.filter-btn:active {
  transform: scale(0.95);
}

.filter-btn.has-filters {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), 0 0 12px var(--accent-glow);
}

.filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: none;
  align-items: center;
  justify-content: center;
}

.filter-badge.visible {
  display: flex;
}

.filter-section {
  margin-bottom: var(--space-6);
}

.filter-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
}

.filter-reset {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   AREA STATS MODAL
   ============================================================ */
.area-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.area-stats-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.area-stats-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.area-stats-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.area-stats-table tr:last-child td {
  border-bottom: none;
}

/* Stats Tabs */
.stats-tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}

.stats-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.stats-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.stats-tab:hover:not(.active) {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ============================================================
   LIVE STATS BAR
   ============================================================ */
.stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-controls);
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  padding-bottom: calc(var(--space-3) + var(--safe-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--duration-normal);
}

.stats-bar-content {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.stats-bar-content::-webkit-scrollbar {
  display: none;
}

.stats-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.stats-bar-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.stats-bar-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stats-bar-expand {
  font-size: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  width: calc(100% - var(--space-8));
  max-width: 400px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn var(--duration-normal) var(--ease-spring);
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-message { flex: 1; }

/* ============================================================
   MAP PIN DROP MODE
   ============================================================ */
.pin-drop-tooltip {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-controls);
  background: var(--accent);
  color: white;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg), 0 0 24px var(--accent-glow);
  display: none;
  animation: bounce 2s infinite;
  white-space: nowrap;
}

.pin-drop-tooltip.active {
  display: block;
}

/* ============================================================
   FLAT HUNT MODE
   ============================================================ */
.seeker-marker-icon {
  width: 40px;
  height: 40px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seeker-emoji-icon {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  z-index: 2;
  position: relative;
  animation: bounce-small 2s infinite var(--ease-spring);
}

.pulse-ring {
  content: '';
  width: 40px;
  height: 40px;
  background: var(--accent-purple);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  animation: pulsate 2s infinite ease-out;
}

@keyframes pulsate {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.0); opacity: 0; }
}

@keyframes bounce-small {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.seeker-custom-div-icon {
  background: transparent;
  border: none;
}

.seeker-popup-card {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  min-width: 220px;
}

.seeker-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.seeker-emoji-small {
  font-size: 16px;
}

.seeker-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  background: linear-gradient(90deg, #8b5cf6, #d946ef);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.seeker-budget {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.seeker-budget-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.seeker-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.seeker-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  background: rgba(139, 92, 246, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}

.seeker-note {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--surface);
  padding: 8px;
  border-radius: 4px;
  border-left: 2px solid var(--border-strong);
}

/* ============================================================
   STAR RATING INPUT
   ============================================================ */
.star-input {
  display: flex;
  gap: var(--space-1);
}

.star-input-btn {
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--duration-fast), transform var(--duration-fast);
}

.star-input-btn:hover {
  transform: scale(1.2);
}

.star-input-btn.filled {
  color: var(--warning);
}

/* ============================================================
   METRO OVERLAY CONTROLS
   ============================================================ */
.metro-legend {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-top: var(--space-3);
}

.metro-line-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.metro-line-color {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .search-container {
    left: var(--space-3);
    right: 60px;
  }

  .fab-container {
    right: var(--space-3);
  }

  .fab {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .fab-tooltip {
    display: none !important;
  }

  .onboarding-card {
    padding: var(--space-6);
  }

  .onboarding-title {
    font-size: 24px;
  }

  .insight-big-number {
    font-size: 36px;
  }

  .modal-content {
    padding: var(--space-6);
  }

  .add-rent-btn {
    right: var(--space-3);
    bottom: calc(var(--space-6) + var(--safe-bottom) + 64px);
    padding: var(--space-3) var(--space-5);
    font-size: 14px;
  }

  .stats-bar {
    padding: var(--space-2) var(--space-3);
  }
}

/* ============================================================
   INSIGHT OVERLAY STYLES
   ============================================================ */
.insight-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}

.insight-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#insight-content {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.insight-emoji {
  font-size: 64px;
  margin-bottom: var(--space-4);
  animation: bounce 2s infinite;
}

.insight-big-number {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: var(--space-1);
  letter-spacing: -1px;
}

.insight-overpaying {
  color: var(--error);
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.insight-great-deal {
  color: var(--success);
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.insight-label {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: var(--space-2);
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.no-data .insight-label {
  font-size: 20px;
}

.insight-sublabel {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-6);
}

.insight-stats {
  display: flex;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  gap: var(--space-2);
}

.insight-stat {
  flex: 1;
}

.insight-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.insight-stat-label {
  font-size: 9px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insight-share-prompt {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.insight-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}


@media (min-width: 768px) {
  .search-container {
    left: var(--space-6);
    top: var(--space-6);
  }

  .fab-container {
    right: var(--space-6);
  }

  .bottom-sheet {
    max-width: 480px;
    left: auto;
    right: 0;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: 0;
  }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   AMAZON AFFILIATE STYLES
   ============================================================ */
.affiliate-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  position: relative;
}

.affiliate-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  font-weight: 700;
}

.affiliate-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 16px;
  scrollbar-width: thin; /* Show thin scrollbar on Firefox */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Styled scrollbar for desktop */
.affiliate-scroll::-webkit-scrollbar {
  display: block;
  height: 4px;
}

.affiliate-scroll::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 2px;
}

.affiliate-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.affiliate-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-glow);
}

/* Faded edges to hint at more content */
.affiliate-scroll-container {
  position: relative;
  margin: 0 -4px;
}

.affiliate-scroll-container::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to left, var(--bg-elevated), transparent);
  pointer-events: none;
}

.affiliate-card {
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  transition: all 0.2s ease-out;
}

.affiliate-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.affiliate-card-emoji {
  font-size: 24px;
  margin-bottom: 4px;
}

.affiliate-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.affiliate-card-benefit {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
  height: 32px;
  overflow: hidden;
}

.affiliate-card-btn {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: all 0.15s;
}

.affiliate-card-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.affiliate-disclaimer {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 16px;
  text-align: center;
  font-style: italic;
}


/* Vertical adjustment for modal list */
.affiliate-vertical .affiliate-scroll {
  flex-direction: column;
  overflow-x: hidden;
  gap: 12px;
}

.affiliate-vertical .affiliate-card {
  min-width: unset;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.affiliate-vertical .affiliate-card-btn {
  margin-top: 0;
  margin-left: auto;
  white-space: nowrap;
}

/* Affiliate Banner in Pin Detail */
.affiliate-banner {
  display: block;
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin: 16px -20px -20px -20px;
  cursor: pointer;
  text-decoration: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: background 0.2s;
}

.affiliate-banner:hover {
  background: rgba(255,107,53,0.1);
  color: var(--text-primary);
}

/* ============================================================
   MAP LEGEND
   ============================================================ */
.map-legend {
  position: fixed;
  bottom: calc(var(--bottom-bar-height) + var(--space-4) + 64px);
  left: var(--space-4);
  z-index: var(--z-controls);
  background: rgba(17, 17, 17, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  box-shadow: var(--shadow-md);
  max-width: 140px;
}

@media (max-width: 768px) {
  .map-legend {
    display: none; /* Hide on mobile to save space, or make it toggleable */
  }
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.legend-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}


/* ============================================================
   FEEDBACK & UPLOAD STYLES
   ============================================================ */
.upload-area {
  width: 100%;
  min-height: 120px;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.upload-area:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  padding: var(--space-4);
}

.upload-preview {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
}

.upload-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.remove-upload {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  backdrop-filter: blur(4px);
  z-index: 10;
  transition: background var(--duration-fast);
}

.remove-upload:hover {
  background: var(--error);
}

/* ============================================================
   ONBOARDING STEPPER
   ============================================================ */
.stepper-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.stepper-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-active);
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
  box-shadow: 0 0 8px var(--accent-glow);
}

.stepper-content {
  flex: 1;
  position: relative;
  min-height: 240px;
}

.onboarding-step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateX(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-step.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.onboarding-step.prev {
  transform: translateX(-20px);
}

.onboarding-emoji {
  font-size: 56px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 20px rgba(255,255,255,0.1));
}

@media (max-width: 480px) {
  .stepper-card {
    padding: 32px 24px;
    min-height: 450px;
  }
  .onboarding-emoji {
    font-size: 48px;
  }
}

/* ============================================================
   TABS & NAVIGATION (Pin Detail & Stats)
   ============================================================ */
.tab-header {
  display: flex;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.tab-item {
  padding: var(--space-2) var(--space-1);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  position: relative;
  transition: color var(--duration-fast);
}

.tab-item:hover {
  color: var(--text-secondary);
}

.tab-item.active {
  color: var(--accent);
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.tab-content {
  display: none;
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   COMMENTS & THREADS
   ============================================================ */
#comments-container {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.comment-item {
  padding: 12px 0;
  position: relative;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.comment-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-teal);
}

.comment-time {
  font-size: 10px;
  color: var(--text-tertiary);
}

.comment-content {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  background: rgba(255,255,255,0.03);
  padding: 8px 12px;
  border-radius: 0 12px 12px 12px;
  border: 1px solid var(--border);
}

.comment-actions {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.comment-action-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.comment-action-btn:hover {
  color: var(--accent);
}

.comment-input-area {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

#new-comment-text {
  width: 100%;
  min-height: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 8px;
  resize: none;
}

#new-comment-text:focus {
  border-color: var(--accent);
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: transform 0.2s, border-color 0.2s;
}

.leaderboard-item:hover {
  border-color: var(--accent-glow);
  transform: translateX(4px);
}

.leaderboard-item.top-three {
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.05), transparent);
  border-left: 3px solid var(--accent);
}

.leaderboard-rank {
  font-size: 20px;
  width: 32px;
  text-align: center;
}

.leaderboard-info {
  flex: 1;
}

.leaderboard-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.leaderboard-city {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leaderboard-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  text-align: right;
}

.leaderboard-score span {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--surface-active);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 20px auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.comment-text {
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.comment-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  max-height: 4.5em;
}

.read-more-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 4px;
}

.view-more-replies-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin: 12px 0;
  background: rgba(255, 107, 53, 0.08);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.view-more-replies-btn:hover {
  background: rgba(255, 107, 53, 0.15);
  transform: translateY(-1px);
}

.reply-context {
  color: var(--accent);
  opacity: 0.7;
  font-weight: bold;
}

/* Leaderboard Premium Styles */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-out);
}

.leaderboard-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  transform: translateX(4px);
}

.leaderboard-item.top-three {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(255, 107, 53, 0.02));
  border-color: rgba(255, 107, 53, 0.3);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.1);
}

.leaderboard-item.top-three:first-child {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.15), rgba(255, 184, 0, 0.05));
  border-color: rgba(255, 184, 0, 0.4);
  box-shadow: 0 0 20px rgba(255, 184, 0, 0.15);
}

.leaderboard-rank {
  font-size: 20px;
  font-weight: 800;
  width: 32px;
  display: flex;
  justify-content: center;
}

.leaderboard-info {
  flex: 1;
}

.leaderboard-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.leaderboard-city {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.leaderboard-score {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 18px;
  color: var(--accent);
}

.leaderboard-score span {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-weight: 500;
  margin-left: 2px;
}
