/* ══════════════════════════════════════════
   FreezoneMatch — Interactive UAE Map
   styles.css
   ══════════════════════════════════════════ */

/* ── Custom Properties ─────────────────── */

:root {
  /* Brand */
  --fzm-sage: #359877;
  --fzm-sage-hover: #2D8268;
  --fzm-navy: #041C2C;
  --fzm-navy-mid: #04325e;
  --fzm-gold: #F5C518;
  --fzm-gold-soft: #fef9c3;

  /* Text */
  --fzm-text: #041C2C;
  --fzm-text-secondary: #4A5568;
  --fzm-text-muted: #8896A5;

  /* Backgrounds */
  --fzm-bg-page: #F9F9F9;
  --fzm-bg-warm: #FBF8F5;
  --fzm-bg-warm-md: #F5F1ED;
  --fzm-bg-warm-dk: #E8E4DF;

  /* Borders */
  --fzm-border: #D1CCC6;
  --fzm-border-warm: #E8E4DF;

  /* Layout */
  --fzm-sidebar-w: 380px;
  --fzm-radius-card: 12px;
  --fzm-radius-pill: 9999px;
  --fzm-shadow-sm: 0 1px 3px rgba(4, 28, 44, 0.08);
  --fzm-shadow-md: 0 4px 16px rgba(4, 28, 44, 0.10);
  --fzm-shadow-lg: 0 8px 32px rgba(4, 28, 44, 0.12);

  /* Font */
  --fzm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Animation */
  --fzm-ease-fast: 150ms ease;
  --fzm-ease: 250ms ease;
  --fzm-ease-slow: 400ms ease;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --fzm-ease-fast: 0ms;
    --fzm-ease: 0ms;
    --fzm-ease-slow: 0ms;
  }
}

/* ── Reset & Base ──────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--fzm-font);
  color: var(--fzm-text);
  background: var(--fzm-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Page Layout ───────────────────────── */

.fzm-page {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────── */

.fzm-sidebar {
  width: var(--fzm-sidebar-w);
  min-width: var(--fzm-sidebar-w);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--fzm-border-warm);
  background: white;
  overflow: hidden;
}

.fzm-sidebar__header {
  padding: 20px 20px 12px;
  flex-shrink: 0;
}

.fzm-sidebar__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fzm-sidebar__title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--fzm-navy);
  letter-spacing: -0.01em;
}

.fzm-sidebar__clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--fzm-navy);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.fzm-sidebar__clear-btn:hover {
  background: #c0392b;
  transform: scale(1.1);
}

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

.fzm-sidebar__subtitle {
  font-size: 0.8125rem;
  color: var(--fzm-text-muted);
  margin-top: 2px;
}

/* Mobile-only elements hidden on desktop */
.fzm-sidebar__drag-handle {
  display: none;
}

.fzm-sidebar__expand-icon {
  display: none;
}

/* ── Sidebar List ──────────────────────── */

.fzm-sidebar__list {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--fzm-border) transparent;
}

.fzm-sidebar__list::-webkit-scrollbar { width: 6px; }
.fzm-sidebar__list::-webkit-scrollbar-track { background: transparent; }
.fzm-sidebar__list::-webkit-scrollbar-thumb {
  background: var(--fzm-border);
  border-radius: 3px;
}

.fzm-sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--fzm-ease-fast), border-color var(--fzm-ease-fast);
  outline: none;
}

.fzm-sidebar__item:hover,
.fzm-sidebar__item--highlight {
  background: var(--fzm-bg-warm);
  border-left-color: var(--fzm-sage);
}

.fzm-sidebar__item--active {
  background: var(--fzm-bg-warm-md);
  border-left-color: var(--fzm-navy);
}

.fzm-sidebar__item:focus-visible {
  outline: 2px solid var(--fzm-sage);
  outline-offset: -2px;
}

.fzm-sidebar__item-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  font-size: 0.9375rem;
  font-weight: 700;
  background: var(--fzm-navy);
  color: #fff;
  border: 2px solid transparent;
  transition: all var(--fzm-ease-fast);
}

.fzm-sidebar__item--highlight .fzm-sidebar__item-number,
.fzm-sidebar__item--active .fzm-sidebar__item-number {
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--fzm-navy);
}

.fzm-sidebar__item-logo {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 8px;
  background: #fff;
  border: 1.5px solid var(--fzm-border-warm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--fzm-ease-fast);
}

.fzm-sidebar__item-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.fzm-sidebar__item--highlight .fzm-sidebar__item-logo,
.fzm-sidebar__item--active .fzm-sidebar__item-logo {
  border-color: var(--fzm-sage);
  box-shadow: 0 0 0 2px white, 0 0 0 3.5px var(--fzm-sage);
}

.fzm-sidebar__item-info {
  flex: 1;
  min-width: 0;
}

.fzm-sidebar__item-name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fzm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fzm-sidebar__item-meta {
  display: block;
  font-size: 0.6875rem;
  color: var(--fzm-text-muted);
  margin-top: 1px;
}

.fzm-sidebar__item-chevron {
  color: var(--fzm-text-muted);
  opacity: 0;
  transition: opacity var(--fzm-ease-fast);
  flex-shrink: 0;
}

.fzm-sidebar__item:hover .fzm-sidebar__item-chevron {
  opacity: 1;
}

/* ── Map Container ─────────────────────── */

.fzm-map-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #EAEAEA; /* light grey — matches map land color */
}

.fzm-map {
  width: 100%;
  height: 100%;
  background: #EAEAEA; /* prevents flash before Mapbox renders */
}

/* Loading state */
.fzm-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: #EAEAEA;
  z-index: 10;
  transition: opacity 400ms ease;
}

.fzm-loading__skeleton {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(53, 152, 119, 0.2);
  border-top-color: var(--fzm-sage);
  border-radius: 50%;
  animation: fzm-spin 0.8s linear infinite;
}

.fzm-loading__text {
  font-size: 0.8125rem;
  color: #64748B;
  font-weight: 500;
}

/* Error fallback */
.fzm-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  background: #EAEAEA;
  z-index: 10;
}

.fzm-error__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.fzm-error__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fzm-navy);
  margin-bottom: 6px;
}

.fzm-error__message {
  font-size: 0.875rem;
  color: #64748B;
  max-width: 320px;
}

/* ── Map Pins ──────────────────────────── */

.fzm-pin {
  cursor: pointer;
  position: absolute !important; /* Override Mapbox v3 relative positioning to prevent container inflation */
  top: 0;
  left: 0;
  z-index: 1;
  width: var(--fzm-pin-size, 30px);
  height: var(--fzm-pin-size, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--fzm-ease-fast), width 200ms ease, height 200ms ease;
}

/* Logo pins use a different size track */
.fzm-pin--logo {
  width: var(--fzm-logo-size, 40px);
  height: var(--fzm-logo-size, 40px);
}

/* No entering animation — Mapbox re-triggers animations on marker elements
   which causes pins to remain invisible. Pins appear instantly instead. */

.fzm-pin--hover,
.fzm-pin--selected {
  z-index: 10 !important;
}

.fzm-pin--dimmed {
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
}

/* ── Numbered circle fallback ────────── */

.fzm-pin__circle {
  /* Size driven by CSS custom properties set from JS based on zoom */
  width: var(--fzm-pin-size, 30px);
  height: var(--fzm-pin-size, 30px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fzm-pin-font, 11px);
  font-weight: 700;
  font-family: var(--fzm-font);
  background: var(--fzm-navy);
  color: #fff;
  border: var(--fzm-pin-border, 2.5px) solid var(--fzm-sage);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(53, 152, 119, 0.2);
  transition: transform var(--fzm-ease-fast), box-shadow var(--fzm-ease-fast),
              border-color var(--fzm-ease-fast),
              width 200ms ease, height 200ms ease, font-size 200ms ease;
}

/* Hide number text at far zoom */
[data-zoom-level="far"] .fzm-pin__circle {
  font-size: 0;
  color: transparent;
}

.fzm-pin--hover .fzm-pin__circle {
  transform: scale(1.35);
  box-shadow: 0 0 0 3px rgba(53, 152, 119, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fzm-pin--selected .fzm-pin__circle {
  transform: scale(1.4);
  border-color: var(--fzm-gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.5), 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ── Square logo pin ─────────────────── */

.fzm-pin__logo {
  width: var(--fzm-logo-size, 40px);
  height: var(--fzm-logo-size, 40px);
  border-radius: 6px;
  background: #fff;
  border: 1.5px solid var(--fzm-border-warm);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--fzm-ease-fast), box-shadow var(--fzm-ease-fast),
              width 200ms ease, height 200ms ease, border-color var(--fzm-ease-fast);
}

.fzm-pin__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.fzm-pin--hover .fzm-pin__logo {
  transform: scale(1.3);
  border-color: var(--fzm-sage);
  box-shadow: 0 0 0 2px rgba(53, 152, 119, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fzm-pin--selected .fzm-pin__logo {
  transform: scale(1.35);
  border-color: var(--fzm-gold);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Hide hover tooltip when pin is selected */
.fzm-pin--selected .fzm-tooltip {
  opacity: 0 !important;
  pointer-events: none;
}

/* ── Pin Hover Tooltip ─────────────────── */

.fzm-pin .fzm-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--fzm-ease-fast);
  white-space: nowrap;
  background: white;
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: var(--fzm-shadow-md);
  border: 1px solid var(--fzm-border-warm);
  z-index: 100;
}

/* Only show tooltip on hover when zoomed in enough */
.fzm-pin--hover .fzm-tooltip {
  opacity: 1;
}

[data-zoom-level="far"] .fzm-pin--hover .fzm-tooltip {
  opacity: 0;
}

.fzm-tooltip__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fzm-text);
}

.fzm-tooltip__meta {
  font-size: 0.6875rem;
  color: var(--fzm-text-muted);
  margin-top: 2px;
}

/* ── Emirate Name Labels (HTML overlays) ── */
/* These render ABOVE pin markers in the DOM so they're never hidden */

.fzm-emirate-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: #1A3650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
  pointer-events: auto;
  user-select: none;
  cursor: pointer;
  /* Solid pill background — guarantees readability over any map color */
  background: rgba(255, 255, 255, 0.92);
  padding: 5px 14px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
  transition: opacity 0.3s ease, font-size 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.fzm-emirate-label:hover {
  transform: scale(1.5);
  box-shadow: 0 0 0 3px rgba(53, 152, 119, 0.4), 0 6px 20px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 1);
}

/* Emirate labels sit below freezone pin markers */
.mapboxgl-marker:has(.fzm-emirate-label) {
  z-index: 1 !important;
}

/* ── Emirate Hover Tooltip ─────────────── */

.fzm-emirate-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  transition: opacity var(--fzm-ease-fast);
  background: white;
  color: var(--fzm-text);
  border-radius: 8px;
  padding: 6px 12px;
  box-shadow: var(--fzm-shadow-md);
  border: 1px solid var(--fzm-border-warm);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--fzm-font);
  white-space: nowrap;
  transform: translateX(-50%);
}

.fzm-emirate-tooltip--visible {
  opacity: 1;
}

/* ── Mapbox Popup Override ─────────────── */

.fzm-mapbox-popup .mapboxgl-popup-content {
  padding: 0 !important;
  border-radius: var(--fzm-radius-card) !important;
  box-shadow: var(--fzm-shadow-lg) !important;
  overflow: hidden;
  min-width: 260px;
  background: white !important;
  border: 1px solid var(--fzm-border-warm);
}

.fzm-mapbox-popup .mapboxgl-popup-close-button {
  font-size: 1.25rem;
  color: var(--fzm-text-muted);
  right: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.fzm-mapbox-popup .mapboxgl-popup-close-button:hover {
  color: var(--fzm-text);
  background: var(--fzm-bg-warm);
}

.fzm-mapbox-popup .mapboxgl-popup-tip {
  border-top-color: white !important;
}

/* Popup inner content */
.fzm-popup {
  font-family: var(--fzm-font);
  padding: 16px;
}

.fzm-popup__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.fzm-popup__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--fzm-navy);
  color: #fff;
  border: 3px solid var(--fzm-sage);
}

.fzm-popup__name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--fzm-text);
  line-height: 1.3;
}

.fzm-popup__emirate {
  font-size: 0.75rem;
  color: var(--fzm-text-muted);
  margin-top: 1px;
}

.fzm-popup__grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.fzm-popup__stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.fzm-popup__stat-label {
  color: var(--fzm-text-muted);
  min-width: 80px;
}

.fzm-popup__stat-value {
  font-weight: 600;
  color: var(--fzm-text);
}

.fzm-popup__link {
  display: block;
  padding: 10px 0 2px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fzm-sage);
  text-decoration: none;
  border-top: 1px solid var(--fzm-border-warm);
}

.fzm-popup__link:hover {
  color: var(--fzm-sage-hover);
}

/* ── Sidebar Detail Card ─────────────── */

.fzm-sidebar__detail {
  padding: 0;
  overflow-y: auto;
}

.fzm-detail {
  padding: 20px;
  position: relative;
  animation: fzm-fade-in 200ms ease;
}

.fzm-detail__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--fzm-bg-warm);
  border: 1px solid var(--fzm-border-warm);
  border-radius: 6px;
  cursor: pointer;
  color: var(--fzm-text-muted);
  transition: all var(--fzm-ease-fast);
}

.fzm-detail__close:hover {
  background: var(--fzm-bg-warm-md);
  color: var(--fzm-text);
}

.fzm-detail__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 36px;
}

.fzm-detail__logo {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--fzm-border-warm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fzm-detail__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fzm-detail__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  background: var(--fzm-navy);
  color: #fff;
  border: 3px solid var(--fzm-sage);
}

.fzm-detail__title-group {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.fzm-detail__name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--fzm-text);
  line-height: 1.3;
  margin: 0;
}

.fzm-detail__emirate {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--fzm-text-muted);
  margin-top: 3px;
}

.fzm-detail__stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--fzm-border-warm);
  border-bottom: 1px solid var(--fzm-border-warm);
  margin-bottom: 16px;
}

.fzm-detail__stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--fzm-text-muted);
}

.fzm-detail__stat svg {
  flex-shrink: 0;
  color: var(--fzm-sage);
}

.fzm-detail__stat-label {
  min-width: 48px;
}

.fzm-detail__stat-value {
  font-weight: 600;
  color: var(--fzm-text);
}

.fzm-detail__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--fzm-font);
  color: #fff;
  background: var(--fzm-sage);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--fzm-ease-fast);
}

.fzm-detail__cta:hover {
  background: var(--fzm-sage-hover);
}

.fzm-detail__cta svg {
  flex-shrink: 0;
}

/* ── Reset View Button ─────────────────── */

.fzm-reset {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-family: var(--fzm-font);
  color: var(--fzm-text);
  background: white;
  border: 1px solid var(--fzm-border);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--fzm-shadow-sm);
  transition: background var(--fzm-ease-fast), box-shadow var(--fzm-ease-fast);
}

.fzm-reset:hover {
  background: var(--fzm-bg-warm);
  box-shadow: var(--fzm-shadow-md);
}

.fzm-reset:focus-visible {
  outline: 2px solid var(--fzm-sage);
  outline-offset: 2px;
}

/* ── Animations ────────────────────────── */

@keyframes fzm-marker-enter {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fzm-popup-enter {
  0%   { opacity: 0; transform: translateY(6px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fzm-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@media (prefers-reduced-motion: reduce) {
  .fzm-pin--entering { animation: none !important; opacity: 1; }
  .fzm-loading__skeleton { animation: none !important; }
}

/* ── Responsive: Tablet (≤1024px) ──────── */

@media (max-width: 1024px) {
  .fzm-page {
    flex-direction: column;
  }

  .fzm-sidebar {
    width: 100%;
    min-width: 100%;
    order: 2;
    border-right: none;
    border-top: 1px solid var(--fzm-border-warm);
    max-height: 40vh;
  }

  .fzm-map-wrapper {
    order: 1;
    min-height: 55vh;
  }

  /* Slightly larger touch targets on tablet */
  .fzm-sidebar__item {
    padding: 13px 20px;
    min-height: 48px;
  }

  /* Move reset button away from sidebar on tablet */
  .fzm-reset {
    top: 12px;
    right: 12px;
    left: auto;
    width: 40px;
    height: 40px;
  }

  /* Mapbox controls: move to top-right and size up */
  .mapboxgl-ctrl-bottom-right {
    bottom: auto !important;
    top: 60px !important;
    right: 12px !important;
  }

  .mapboxgl-ctrl-zoom-in,
  .mapboxgl-ctrl-zoom-out {
    width: 36px !important;
    height: 36px !important;
  }

  /* Emirate labels slightly smaller on tablet */
  .fzm-emirate-label {
    font-size: 13px;
    padding: 4px 11px;
  }
}

/* ── Responsive: Mobile (≤640px) ───────── */

@media (max-width: 640px) {
  .fzm-page {
    height: 100dvh;
    position: relative;
  }

  .fzm-map-wrapper {
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  .fzm-sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    border-right: none;
    border-top: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    transition: max-height 300ms ease;
    overflow: hidden;
  }

  .fzm-sidebar--expanded {
    max-height: 80dvh;
    overflow-y: auto;
  }

  /* Drag handle indicator */
  .fzm-sidebar__drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 2px;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
  }

  .fzm-sidebar__drag-handle::after {
    content: '';
    width: 36px;
    height: 4px;
    background: var(--fzm-border);
    border-radius: 2px;
    transition: background 0.2s ease;
  }

  .fzm-sidebar__drag-handle:active::after {
    background: var(--fzm-sage);
  }

  .fzm-sidebar__header {
    padding: 8px 16px 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .fzm-sidebar__title {
    font-size: 1rem;
  }

  .fzm-sidebar__subtitle {
    font-size: 0.75rem;
  }

  /* Expand/collapse chevron indicator */
  .fzm-sidebar__expand-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.625rem;
    transition: transform 0.3s ease;
    vertical-align: middle;
  }

  .fzm-sidebar--expanded .fzm-sidebar__expand-icon {
    transform: rotate(180deg);
  }

  /* Touch-friendly list items */
  .fzm-sidebar__item {
    padding: 12px 16px;
    min-height: 52px;
    gap: 10px;
  }

  .fzm-sidebar__item-name {
    font-size: 0.875rem;
  }

  .fzm-sidebar__item-meta {
    font-size: 0.75rem;
  }

  /* Reset button: top-right, larger touch target */
  .fzm-reset {
    top: 12px;
    right: 12px;
    left: auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  /* Mapbox controls: top-right, above reset, larger */
  .mapboxgl-ctrl-bottom-right {
    bottom: auto !important;
    top: 64px !important;
    right: 12px !important;
  }

  .mapboxgl-ctrl-zoom-in,
  .mapboxgl-ctrl-zoom-out {
    width: 40px !important;
    height: 40px !important;
  }

  /* Emirate labels smaller on mobile */
  .fzm-emirate-label {
    font-size: 11px;
    padding: 3px 9px;
    letter-spacing: 0.10em;
    border-radius: 4px;
  }

  .fzm-emirate-label:hover {
    transform: scale(1.3);
  }

  /* Tooltips: constrain to viewport on mobile */
  .fzm-pin .fzm-tooltip {
    max-width: 200px;
    white-space: normal;
    font-size: 0.75rem;
  }

  /* Detail card: full-width on mobile bottom sheet */
  .fzm-detail {
    padding: 16px;
  }

  .fzm-detail__header {
    gap: 10px;
    margin-bottom: 14px;
  }

  .fzm-detail__logo,
  .fzm-detail__number {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .fzm-detail__number {
    font-size: 0.875rem;
  }

  .fzm-detail__name {
    font-size: 0.875rem;
  }

  .fzm-detail__cta {
    padding: 12px 16px;
    font-size: 0.875rem;
    min-height: 48px;
  }

  /* Popup: responsive sizing */
  .fzm-mapbox-popup .mapboxgl-popup-content {
    min-width: 220px;
    max-width: calc(100vw - 40px);
  }
}

/* ── Responsive: Small Mobile (≤380px) ──── */

@media (max-width: 380px) {
  .fzm-sidebar {
    max-height: 280px;
  }

  .fzm-sidebar--expanded {
    max-height: 75dvh;
  }

  .fzm-emirate-label {
    font-size: 10px;
    padding: 2px 7px;
  }

  .fzm-sidebar__item {
    padding: 10px 12px;
  }

  .fzm-detail {
    padding: 12px;
  }
}
