/* ── Map canvas ── */
.amlaki-map {
  width: 100%;
  height: 320px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--afram-border, rgba(127, 127, 127, 0.25));
  z-index: 1;
  background: color-mix(in srgb, var(--afram-accent, #0284c7) 6%, #0f172a);
}

.amlaki-map--tall {
  height: min(68vh, 620px);
  min-height: 340px;
}

.leaflet-container {
  font-family: inherit;
}

/* ── Page layout ── */
.amlaki-page.amlaki-public-map {
  padding-top: 0.85rem !important;
  padding-bottom: 2.5rem;
}

.amlaki-map-page__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.amlaki-map-page__intro h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  line-height: 1.25;
}

.amlaki-map-page__sub {
  margin: 0.35rem 0 0;
  color: var(--afram-text-muted, #94a3b8);
  font-size: 0.92rem;
}

.amlaki-map-page__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.amlaki-map-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.amlaki-map-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--afram-surface, rgba(12, 20, 34, 0.78));
  border: 1px solid var(--afram-border, rgba(255, 255, 255, 0.09));
  color: var(--afram-text-muted, #94a3b8);
}

.amlaki-map-stat i {
  font-size: 0.95rem;
  color: var(--afram-accent, #38bdf8);
}

.amlaki-map-stat--accent {
  border-color: color-mix(in srgb, var(--afram-accent, #0284c7) 35%, transparent);
  background: color-mix(in srgb, var(--afram-accent, #0284c7) 12%, transparent);
  color: var(--afram-text, inherit);
}

.amlaki-map-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.95rem 0.42rem 0.48rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--afram-accent, #0284c7) 28%, rgba(255, 255, 255, 0.1));
  background: linear-gradient(135deg, #2563eb 0%, #0284c7 52%, var(--brand-accent, #0d9f7a) 100%);
  color: #fff !important;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--afram-accent, #0284c7) 32%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.amlaki-map-list-btn__icon {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.amlaki-map-list-btn__label {
  padding-inline-end: 0.1rem;
}

@media (hover: hover) {
  .amlaki-map-list-btn:hover {
    color: #fff !important;
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow:
      0 14px 28px color-mix(in srgb, var(--afram-accent, #0284c7) 38%, transparent),
      inset 0 1px 0 rgba(255, 255, 255, 0.22);
  }
}

.amlaki-map-list-btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.amlaki-map-empty .amlaki-map-list-btn {
  margin-top: 0.15rem;
}

/* ── Map stage + overlay ── */
.amlaki-map-stage {
  position: relative;
  border-radius: 18px;
  overflow: visible;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.amlaki-map-stage .leaflet-container {
  border-radius: 18px;
}

.amlaki-map-stage .amlaki-map {
  border: 0;
  border-radius: 0;
  height: min(68vh, 620px);
  min-height: 340px;
}

.amlaki-map-stage__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.85rem;
}

.amlaki-map-hint {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: min(92%, 26rem);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.amlaki-map-hint.is-hidden {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.amlaki-map-hint i {
  color: #fbbf24;
  font-size: 1rem;
}

.amlaki-map-legend {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
}

.amlaki-map-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #e2e8f0;
}

.amlaki-map-legend__item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.amlaki-map-legend__item--sale i { background: #2563eb; }
.amlaki-map-legend__item--rent i { background: var(--brand-accent, #0d9f7a); }
.amlaki-map-legend__item--search i { background: #f59e0b; border-radius: 50%; transform: none; }

/* ── Sidebar panel ── */
.amlaki-map-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 6.5rem);
}

.amlaki-map-panel__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--afram-border, rgba(255, 255, 255, 0.09));
  background: var(--afram-surface, rgba(12, 20, 34, 0.78));
  color: inherit;
  font-weight: 700;
  font-size: 0.88rem;
}

.amlaki-map-filters {
  background: var(--afram-surface, rgba(12, 20, 34, 0.78));
  border: 1px solid var(--afram-border, rgba(255, 255, 255, 0.09));
  border-radius: 16px;
  padding: 0.85rem;
  max-height: min(46vh, 420px);
  overflow: auto;
  scrollbar-width: thin;
}

.amlaki-map-filter-section + .amlaki-map-filter-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--afram-border, rgba(255, 255, 255, 0.08));
}

.amlaki-map-filter-section__title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--afram-text, inherit);
}

.amlaki-map-filter-section__title i {
  color: var(--afram-accent, #38bdf8);
  font-size: 0.95rem;
}

.amlaki-map-filter-hint,
.amlaki-map-filters .form-label {
  font-size: 0.76rem;
  margin-bottom: 0.25rem;
}

.amlaki-map-filter-hint {
  margin: 0.45rem 0 0;
  color: var(--afram-text-muted, #94a3b8);
  line-height: 1.5;
}

.amlaki-map-reset {
  margin-top: 0.85rem;
}

/* ── Filters ── */
.amlaki-radius-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.amlaki-radius-chip {
  border: 1px solid var(--afram-border, rgba(127, 127, 127, 0.35));
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.amlaki-radius-chip.is-active {
  background: linear-gradient(135deg, var(--afram-accent, #0284c7), var(--brand-accent, #0d9f7a));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--afram-accent, #0284c7) 30%, transparent);
}

.amlaki-map-amenities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.65rem;
}

.amlaki-map-amenities .form-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  margin: 0;
}

/* ── Results ── */
.amlaki-map-results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--afram-surface, rgba(12, 20, 34, 0.78));
  border: 1px solid var(--afram-border, rgba(255, 255, 255, 0.09));
  border-radius: 16px;
  padding: 0.85rem;
}

.amlaki-map-results__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.amlaki-map-results__head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.amlaki-map-results__count {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--afram-text-muted, #94a3b8);
}

.amlaki-public-map__results {
  flex: 1;
  min-height: 120px;
  max-height: min(36vh, 340px);
  overflow: auto;
  scrollbar-width: thin;
  padding-inline-end: 0.15rem;
}

.amlaki-map-result {
  border: 1px solid var(--afram-border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--afram-accent, #0284c7) 4%, transparent);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.amlaki-map-result + .amlaki-map-result {
  margin-top: 0.55rem;
}

.amlaki-map-result.is-active {
  border-color: color-mix(in srgb, var(--afram-accent, #0284c7) 55%, transparent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--afram-accent, #0284c7) 18%, transparent);
  transform: translateY(-1px);
}

.amlaki-map-result__link {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.55rem;
  text-decoration: none !important;
  color: inherit;
}

.amlaki-map-result__media {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  min-height: 72px;
  background: linear-gradient(145deg, #123047, #0b1726);
}

.amlaki-map-result__media img {
  width: 100%;
  height: 100%;
  min-height: 72px;
  object-fit: cover;
  display: block;
}

.amlaki-map-result__placeholder {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: var(--afram-accent, #38bdf8);
  font-size: 1.35rem;
}

.amlaki-map-result__deal {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  background: rgba(15, 23, 42, 0.78);
}

.amlaki-map-result__deal--sale { background: #2563eb; }
.amlaki-map-result__deal--rent { background: var(--brand-accent, #0d9f7a); }

.amlaki-map-result__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.amlaki-map-result__title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.amlaki-map-result__loc {
  margin: 0;
  font-size: 0.72rem;
  color: var(--afram-text-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.amlaki-map-result__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.7rem;
  color: var(--afram-text-muted, #94a3b8);
}

.amlaki-map-result__price {
  margin-top: auto;
  padding-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--afram-accent, #38bdf8);
}

.amlaki-map-empty {
  text-align: center;
  padding: 1.5rem 0.75rem;
  color: var(--afram-text-muted, #94a3b8);
}

.amlaki-map-empty i {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 0.45rem;
  color: var(--afram-accent, #38bdf8);
}

.amlaki-map-empty p {
  margin: 0 0 0.75rem;
  font-size: 0.86rem;
  line-height: 1.6;
}

/* ── Pins ── */
.amlaki-pin.leaflet-div-icon,
.amlaki-pin {
  background: transparent !important;
  border: 0 !important;
}

.amlaki-pin svg {
  display: block;
  width: 30px;
  height: 45px;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.28));
  pointer-events: none;
}

.leaflet-marker-pane .amlaki-pin {
  transition: transform 0.15s ease;
}

.leaflet-marker-pane .amlaki-pin:hover {
  transform: scale(1.06);
  z-index: 999 !important;
}

/* ── Leaflet chrome ── */
html[data-theme="light"] .leaflet-bar a {
  background: #fff;
  color: #0f172a;
  border-bottom-color: #e2e8f0;
}

html[data-theme="light"] .leaflet-bar a:hover {
  background: #f8fafc;
}

html[data-theme="light"] .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.92);
  color: #64748b;
}

html[data-theme="light"] .leaflet-popup-content-wrapper,
html[data-theme="light"] .leaflet-popup-tip {
  background: #fff;
  color: #0f172a;
}

.leaflet-popup-content {
  margin: 0.65rem 0.75rem;
  line-height: 1.5;
}

.amlaki-map-popup__title {
  font-weight: 800;
  color: var(--afram-accent, #0284c7);
  text-decoration: none;
}

.amlaki-map-popup__title:hover {
  text-decoration: underline;
}

.amlaki-map-popup__meta,
.amlaki-map-popup__loc {
  font-size: 0.78rem;
  color: #64748b;
}

.amlaki-map-popup__price {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
}

/* ── Light theme ── */
html[data-theme="light"] .amlaki-public-map .amlaki-map-page__intro h1,
html[data-theme="light"] .amlaki-public-map .amlaki-map-results__head h2 {
  color: #0f172a;
}

html[data-theme="light"] .amlaki-public-map .amlaki-map-page__sub,
html[data-theme="light"] .amlaki-public-map .amlaki-map-results__count,
html[data-theme="light"] .amlaki-public-map .amlaki-map-filter-hint {
  color: #64748b;
}

html[data-theme="light"] .amlaki-map-stat,
html[data-theme="light"] .amlaki-map-filters,
html[data-theme="light"] .amlaki-map-results,
html[data-theme="light"] .amlaki-map-panel__toggle {
  background: #fff;
  border-color: #e2e8f0;
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .amlaki-map-stat--accent {
  background: color-mix(in srgb, #0284c7 8%, #fff);
  border-color: color-mix(in srgb, #0284c7 22%, #e2e8f0);
}

html[data-theme="light"] .amlaki-map-list-btn {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow:
    0 10px 22px rgba(2, 132, 199, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

html[data-theme="light"] .amlaki-map-stage {
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .amlaki-map-hint {
  background: rgba(255, 255, 255, 0.94);
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

html[data-theme="light"] .amlaki-map-legend {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e8f0;
}

html[data-theme="light"] .amlaki-map-legend__item {
  color: #334155;
}

html[data-theme="light"] .amlaki-radius-chip {
  background: #fff;
  border-color: #e2e8f0;
  color: #334155;
}

html[data-theme="light"] .amlaki-map-result {
  background: #f8fafc;
  border-color: #e2e8f0;
}

html[data-theme="light"] .amlaki-map-result__loc,
html[data-theme="light"] .amlaki-map-result__meta {
  color: #64748b;
}

html[data-theme="light"] .amlaki-map-result__price {
  color: #0284c7;
}

html[data-theme="light"] .amlaki-map-filter-section + .amlaki-map-filter-section {
  border-top-color: #e2e8f0;
}

html[data-theme="light"] .amlaki-map-filters .form-control,
html[data-theme="light"] .amlaki-map-filters .form-select {
  background: #fff;
  border-color: #e2e8f0;
  color: #0f172a;
}

/* ── Optional map (forms) ── */
.amlaki-optional-map {
  border: 1px dashed rgba(127, 127, 127, 0.35);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(127, 127, 127, 0.04);
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .amlaki-page.amlaki-public-map {
    padding-top: 0.7rem !important;
  }

  .amlaki-map-page__head {
    flex-direction: column;
    align-items: stretch;
  }

  .amlaki-map-page__actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .amlaki-map-list-btn {
    margin-inline-start: auto;
  }

  .amlaki-map-panel {
    position: static;
    max-height: none;
  }

  .amlaki-map-filters {
    max-height: none;
  }

  .amlaki-map-stage .amlaki-map {
    height: 46vh;
    min-height: 280px;
  }

  .amlaki-public-map__results {
    max-height: none;
  }

  .amlaki-map-legend {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .amlaki-map-result__link {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .amlaki-map-amenities {
    grid-template-columns: 1fr;
  }
}
