/* ==========================================================================
   Benmi Multi-Tenant Marketplace & Map Discovery Stylesheet
   Design Philosophy: High-End Editorial Luxury, Warm Linen & Deep Obsidian,
   Precision Vector 3D Map, Commercial SVG Iconography
   ========================================================================== */

:root {
  /* Luxury Palette: Deep British Emerald, Warm Amber Gold, Obsidian */
  --primary: #065f46;
  --primary-hover: #044e3a;
  --primary-light: #ecfdf5;
  --primary-glow: rgba(6, 95, 70, 0.22);
  
  --accent-gold: #d97706;
  --accent-gold-light: #fef3c7;
  --accent-gold-glow: rgba(217, 119, 6, 0.2);

  --emerald-live: #10b981;
  --emerald-live-glow: rgba(16, 185, 129, 0.4);

  --danger: #e11d48;
  --danger-light: #ffe4e6;
  
  /* Surfaces: Warm Gallery Linen & Architectural White */
  --bg-page: #fbfbf9;
  --bg-surface: #ffffff;
  --bg-subtle: #f4f4f0;
  --bg-subtle-hover: #eaeae4;
  --bg-glass: rgba(251, 251, 249, 0.88);
  --bg-card-glass: rgba(255, 255, 255, 0.92);
  
  /* Typography */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  /* Hairline Borders */
  --border-light: rgba(15, 23, 42, 0.08);
  --border-hairline: rgba(15, 23, 42, 0.05);
  --border-focus: #065f46;
  
  /* Curvature & Geometry */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  /* Multi-Layered Editorial Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 2px 4px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 6px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 14px 34px -4px rgba(15, 23, 42, 0.09), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 48px -8px rgba(15, 23, 42, 0.14), 0 8px 18px -4px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 10px 25px -3px rgba(6, 95, 70, 0.25);
  
  --header-height: 74px;
  --filter-height: 60px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans TC", sans-serif;
  background-color: var(--bg-page);
  background-image: radial-gradient(at 15% 15%, rgba(6, 95, 70, 0.025) 0px, transparent 50%),
                    radial-gradient(at 85% 85%, rgba(217, 119, 6, 0.02) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* SVG Icon Base Utility */
.icon-svg {
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ==========================================================================
   Header & Navbar (Frosted Glassmorphism)
   ========================================================================== */
.marketplace-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.03);
}

.header-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Brand Section */
.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.brand-section:hover {
  opacity: 0.9;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #065f46 0%, #047857 50%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 6px 16px var(--primary-glow), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-info h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.brand-info p {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Command Search Bar */
.search-wrapper {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-input-box {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 44px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm), inset 0 1px 2px rgba(15, 23, 42, 0.02);
}

.search-input-box:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-md);
}

.search-icon-left {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-input-box:focus + .search-icon-left {
  color: var(--primary);
}

.search-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  padding: 4px;
  display: none;
  border-radius: 50%;
}

.search-clear-btn:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.gps-locate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-body);
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}

.gps-locate-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.gps-locate-btn.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.gps-locate-btn.loading .icon-svg {
  animation: spin 1s linear infinite;
}

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

.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-body);
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.lang-switch-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* ==========================================================================
   Filter Bar & Navigation Tabs (Tactile Tokens)
   ========================================================================== */
.marketplace-filters {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 24px;
  position: sticky;
  top: var(--header-height);
  z-index: 990;
}

.filter-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-pills-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-body);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-shadow: var(--shadow-xs);
}

.filter-chip:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-main);
  border-color: var(--text-subtle);
  transform: translateY(-1px);
}

.filter-chip.active {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22);
}

.filter-divider {
  width: 1px;
  height: 24px;
  background: var(--border-light);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Toggle Switch for Open Only */
.toggle-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  background: #ffffff;
  padding: 6px 14px 6px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

.switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-slider {
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: var(--radius-full);
  position: relative;
  transition: background 0.2s ease;
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-input:checked + .switch-slider {
  background: var(--emerald-live);
}

.switch-input:checked + .switch-slider::after {
  transform: translateX(16px);
}

/* View Mode Segment (Mobile / Tablet Switcher) */
.view-mode-toggle {
  display: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.view-mode-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Main Marketplace Split Layout (Desktop & Mobile)
   ========================================================================== */
.marketplace-main {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  height: calc(100vh - var(--header-height) - 67px);
  position: relative;
}

/* Left Panel: Store Cards Feed */
.stores-panel {
  flex: 1.05;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 24px 24px 64px 24px;
  scroll-behavior: smooth;
}

.stores-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stores-count-badge {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.stores-count-badge b {
  color: var(--text-main);
  font-weight: 700;
}

/* Store Cards Grid */
.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

/* Individual Store Card (Curated Luxury Edition) */
.store-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0;
  position: relative;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
}

.store-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.store-card.active-focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-xl);
  background: #ffffff;
}

/* Top Card Accent Bar */
.card-accent-bar {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, var(--primary), rgba(6, 95, 70, 0.4));
  flex-shrink: 0;
}

/* Card Content Container */
.store-card > .card-header,
.store-card > .card-status-row,
.store-card > .card-details,
.store-card > .card-categories,
.store-card > .card-actions {
  padding-left: 20px;
  padding-right: 20px;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 18px;
  margin-bottom: 12px;
}

.card-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease;
}

.store-card:hover .card-avatar {
  transform: scale(1.04);
}

.card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-avatar-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.card-brand-name {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.015em;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-cuisine-pill {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-hairline);
  text-transform: capitalize;
}

.card-distance-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.card-distance-pill .icon-svg {
  width: 12px;
  height: 12px;
}

/* Live Status & Hours Row */
.card-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-light);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.status-badge.open {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-badge.closed {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid var(--border-light);
}

.status-badge.busy {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-badge.open .status-dot {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
  animation: pulse-dot 2s infinite;
}

.status-badge.closed .status-dot {
  background: #94a3b8;
}

.status-badge.busy .status-dot {
  background: #f59e0b;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hours-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hours-badge .icon-svg {
  width: 14px;
  height: 14px;
  color: var(--text-subtle);
}

/* Card Details (Address) */
.card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  color: var(--text-body);
}

.detail-line {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-line .icon-svg {
  color: var(--text-subtle);
  width: 15px;
  height: 15px;
}

/* Categories Chips Preview */
.card-categories {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.category-chip {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-xs);
  color: var(--text-body);
  font-weight: 500;
  transition: background 0.15s ease;
}

.category-chip:hover {
  background: var(--bg-subtle-hover);
}

/* Card Action Buttons */
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-bottom: 18px;
}

.btn-card-preview {
  flex: 1;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.btn-card-preview:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-card-order {
  flex: 1.35;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-card-order:hover {
  background: linear-gradient(135deg, #044e3a 0%, #065f46 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-arrow {
  transition: transform 0.2s ease;
  font-weight: 400;
}

.btn-card-order:hover .btn-arrow {
  transform: translateX(3px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-xl);
  margin-top: 12px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px auto;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto 20px auto;
}

/* ==========================================================================
   Right Panel: MapLibre GL Vector Map (3D Interactive)
   ========================================================================== */
.map-panel {
  flex: 0.95;
  min-width: 0;
  height: 100%;
  position: relative;
  border-left: 1px solid var(--border-light);
  background: #f1f5f9;
}

#marketplaceMap {
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Map Floating Overlay Recenter Button */
.map-recenter-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 400;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-recenter-btn:hover {
  background: #ffffff;
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Mathematical Precision Luxury Map Pins (Zero Drift on Any Zoom)
   ========================================================================== */
.custom-marker-anchor {
  width: 42px;
  height: 52px;
  position: relative;
  cursor: pointer;
  margin: 0;
  padding: 0;
  /* Strictly NO transform or transition here - MapLibre has 100% direct matrix control */
}

.custom-map-pin {
  width: 42px;
  height: 52px;
  position: relative;
  pointer-events: none;
}

/* Exact ground shadow at the touch point */
.pin-shadow {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 6px;
  background: rgba(15, 23, 42, 0.28);
  border-radius: 50%;
  filter: blur(2px);
  transition: all 0.25s ease;
}

/* Floating Squircle Badge */
.pin-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--pin-color, #065f46);
  border: 2.5px solid #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  overflow: visible;
}

.pin-icon-wrap {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.pin-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Live Status Dot Indicator */
.pin-status-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.9);
}

.pin-badge.closed .pin-status-dot {
  background: #94a3b8;
  box-shadow: none;
}

.pin-badge.busy .pin-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

/* Needle Tip pointing precisely to bottom coordinate */
.pin-needle {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 9px solid var(--pin-color, #065f46);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
  transition: all 0.25s ease;
}

/* Hover & Active States */
.custom-marker-anchor:hover,
.custom-marker-anchor.active {
  z-index: 1000 !important;
}

.custom-marker-anchor:hover .pin-badge,
.custom-marker-anchor.active .pin-badge {
  transform: translateX(-50%) translateY(-5px) scale(1.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), 0 0 0 3px #fbbf24;
}

.custom-marker-anchor:hover .pin-shadow,
.custom-marker-anchor.active .pin-shadow {
  transform: translateX(-50%) scale(1.25);
  opacity: 0.4;
}

/* ==========================================================================
   Luxury Cluster Badges (Zoom-Out Stacking)
   ========================================================================== */
.custom-cluster-badge {
  width: 48px;
  height: 48px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cluster-halo {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(6, 95, 70, 0.22);
  animation: cluster-pulse 2.5s infinite;
}

@keyframes cluster-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 0.25; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.cluster-core {
  position: relative;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #065f46 0%, #047857 50%, #10b981 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 6px 18px rgba(6, 95, 70, 0.35), 0 2px 4px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-cluster-badge:hover .cluster-core {
  transform: scale(1.15);
  box-shadow: 0 8px 24px rgba(6, 95, 70, 0.5), 0 0 0 3px #fbbf24;
}

/* User Location Marker */
.user-location-marker {
  width: 22px;
  height: 22px;
  background: #2563eb;
  border: 3.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.35);
  animation: user-pulse 2s infinite;
}

@keyframes user-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Custom MapLibre GL Popup */
.maplibregl-popup {
  z-index: 500;
}

.maplibregl-popup-content {
  border-radius: var(--radius-lg) !important;
  padding: 0 !important;
  box-shadow: var(--shadow-xl) !important;
  border: 1px solid var(--border-light) !important;
  overflow: hidden;
  background: #ffffff !important;
  width: 270px !important;
  line-height: 1.4 !important;
}

.maplibregl-popup-close-button {
  font-size: 18px;
  color: var(--text-muted);
  padding: 6px 10px;
  right: 6px;
  top: 6px;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.maplibregl-popup-close-button:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.maplibregl-popup-tip {
  border-top-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

.map-popup-card {
  padding: 16px;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.popup-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--primary);
  font-size: 1.05rem;
  box-shadow: var(--shadow-xs);
}

.popup-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.popup-address {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-footer {
  display: flex;
}

.popup-order-btn {
  width: 100%;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 0.15s ease;
}

.popup-order-btn:hover {
  background: var(--primary-hover);
}

/* ==========================================================================
   Store Detail Preview Modal (Cinematic Sheet)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.store-modal-card {
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.open .store-modal-card {
  transform: translateY(0) scale(1);
}

.modal-banner {
  height: 100px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 14px;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: scale(1.06);
}

.modal-body {
  padding: 0 24px 28px 24px;
  overflow-y: auto;
}

.modal-header-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: -36px;
  margin-bottom: 18px;
}

.modal-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-avatar span {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}

.modal-title-group h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.modal-title-group p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.modal-features-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-body);
  border: 1px solid var(--border-hairline);
}

.modal-section-card {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border-hairline);
}

/* Weekly Schedule List in Modal */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  width: 100%;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
  color: var(--text-body);
  transition: background 0.15s ease;
}

.schedule-row.today {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-xs);
}

.schedule-day {
  font-weight: 600;
}

.schedule-hours {
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.modal-info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text-body);
}

.modal-info-row .icon-svg {
  color: var(--text-muted);
  margin-top: 2px;
}

.maps-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 6px;
}

.maps-link:hover {
  text-decoration: underline;
}

.modal-cta-btn {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #065f46 0%, #047857 100%);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: all 0.2s ease;
  margin-top: 6px;
}

.modal-cta-btn:hover {
  background: linear-gradient(135deg, #044e3a 0%, #065f46 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

/* ==========================================================================
   Responsive Breakpoints (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 1024px) {
  .marketplace-main {
    height: calc(100vh - var(--header-height) - 67px);
  }

  .stores-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  }
}

@media (max-width: 768px) {
  .marketplace-header {
    height: auto;
    padding: 12px 16px;
  }

  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .brand-section {
    justify-content: space-between;
  }

  .search-wrapper {
    max-width: 100%;
  }

  .header-actions {
    justify-content: space-between;
    width: 100%;
  }

  .gps-locate-btn, .lang-switch-btn {
    flex: 1;
    justify-content: center;
  }

  .marketplace-filters {
    padding: 10px 16px;
    top: 0;
  }

  .filter-container {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .view-mode-toggle {
    display: inline-flex;
  }

  .marketplace-main {
    height: auto;
    min-height: calc(100vh - 180px);
    display: block;
  }

  /* In Mobile, toggle between List and Map */
  .marketplace-main[data-view="list"] .stores-panel {
    display: block;
    padding: 16px 16px 80px 16px;
  }

  .marketplace-main[data-view="list"] .map-panel {
    display: none;
  }

  .marketplace-main[data-view="map"] .stores-panel {
    display: none;
  }

  .marketplace-main[data-view="map"] .map-panel {
    display: block;
    height: calc(100vh - 200px);
  }

  .stores-grid {
    grid-template-columns: 1fr;
  }
}
