:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fb;
  --card: #fff;
  --ink: #12243f;
  --mut: #5b6b82;
  --red: #d7141a;
  --teal: #0f7c86;
  --line: #e3e9f1;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --input: #fff;
  --on-soft: #e7f4f5;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1626;
  --card: #16223a;
  --ink: #eaf0fa;
  --mut: #9fb0c9;
  --line: #26354f;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --input: #1c2b48;
  --on-soft: #1a3a42;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Cairo, Tahoma, sans-serif;
  line-height: 1.7;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-x: hidden;
  max-width: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

.leaflet-container img {
  max-width: none;
}

.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;
}

.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 5vw;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.theme-toggle {
  margin-inline-start: auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.theme-toggle-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle-moon {
  display: inline;
}

.top img {
  height: 64px;
  width: auto;
}

.top b {
  font-size: 15px;
}

.hero {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: center;
  background: url("../img/hero.jpg") center/cover;
  color: #fff;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(270deg, rgba(8, 30, 60, 0.92), rgba(15, 124, 134, 0.55));
}

.hero-inner {
  position: relative;
  padding: 40px 5vw;
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(26px, 5vw, 52px);
  margin: 0 0 14px;
  font-weight: 800;
  line-height: 1.3;
}

.hero p {
  font-size: 17px;
  margin: 0 0 24px;
  opacity: 0.95;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--red);
  color: #fff;
  padding: 10px 26px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 600;
}

.wrap {
  max-width: 1150px;
  margin: auto;
  padding: 0 5vw 8px;
  min-width: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: -28px;
  position: relative;
  z-index: 2;
}

.stats div {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
  min-width: 0;
}

.stats b {
  display: block;
  font-size: 30px;
  color: var(--red);
}

.stats .stat-hotline b,
.stats .stat-hotline a {
  color: var(--teal);
}

.stats a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
}

h2 {
  font-size: clamp(22px, 4vw, 28px);
  margin: 48px 0 8px;
}

.sub {
  color: var(--mut);
  margin: 0 0 18px;
}

.finder {
  display: grid;
  grid-template-columns: minmax(280px, 46%) 1fr;
  grid-template-areas:
    "map filters"
    "map results";
  gap: 12px 26px;
  align-items: start;
}

.filters-sticky {
  grid-area: filters;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.tools {
  display: flex;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}

.search {
  flex: 1 1 auto;
  min-width: 0;
}

.search input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 8px 14px;
  -webkit-appearance: none;
  appearance: none;
}

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

.search input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.btn-near {
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-near.on {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-card {
  grid-area: map;
  background: var(--card);
  border-radius: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  position: sticky;
  top: 12px;
  min-width: 0;
}

.results {
  grid-area: results;
  min-width: 0;
}

#map {
  height: 480px !important;
  min-height: 480px !important;
  width: 100%;
  border-radius: 10px;
  direction: ltr;
}

.leaflet-container {
  width: 100% !important;
  height: 480px !important;
  font-family: Cairo, Tahoma, sans-serif;
}

.map-note {
  margin: 8px 4px 0;
  font-size: 12px;
  color: var(--mut);
  text-align: center;
}

.picked {
  margin-top: 10px;
  background: var(--on-soft);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--teal);
  border-radius: 12px;
  padding: 12px 14px;
}

.picked[hidden] {
  display: none;
}

.picked h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--teal);
  line-height: 1.4;
}

.picked .meta,
.picked .dist {
  margin: 0;
  font-size: 13px;
  color: var(--mut);
}

.picked .dist {
  font-weight: 700;
  color: var(--red);
  margin-top: 4px;
}

.picked .actions {
  margin-top: 10px;
}

.count {
  margin: 4px 0 10px;
  font-size: 14px;
  color: var(--mut);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.empty {
  grid-column: 1 / -1;
  color: var(--mut);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 22px;
  padding: 8px 14px;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chip:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.chip.on {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.chip i {
  font-style: normal;
  opacity: 0.75;
}

.c {
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--teal);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
}

.c:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.c.is-on {
  border-color: var(--teal);
  background: var(--on-soft);
  box-shadow: var(--shadow);
}

.c h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--teal);
  line-height: 1.45;
}

.c .meta,
.c .dist {
  margin: 0;
  font-size: 13px;
  color: var(--mut);
}

.c .dist {
  font-weight: 700;
  color: var(--red);
  margin-top: 4px;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.act {
  flex: 1;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--line);
}

.act-dir {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

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

.pin {
  background: transparent;
  border: 0;
}

.pin span {
  display: block;
  width: 18px;
  height: 18px;
  background: var(--teal);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(15, 124, 134, 0.45);
}

.pin.is-on span {
  background: var(--red);
  width: 22px;
  height: 22px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  font-family: Cairo, Tahoma, sans-serif;
  margin: 10px 12px;
  text-align: right;
  direction: rtl;
}

.leaflet-popup-content strong {
  display: block;
  color: var(--teal);
}

.leaflet-popup-content span {
  color: var(--mut);
  font-size: 13px;
}

.centre-popup .leaflet-popup-content {
  margin: 8px 10px;
  min-width: 0;
}

.centre-popup .actions {
  margin-top: 8px;
}

.centre-popup .act {
  min-height: 40px;
  font-size: 13px;
}

.assoc {
  direction: ltr;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
}

.assoc img {
  height: 84px;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.call {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.call div {
  background: linear-gradient(135deg, #0f7c86, #12365f);
  color: #fff;
  border-radius: 18px;
  padding: 24px;
}

.call small {
  opacity: 0.85;
  display: block;
}

.call a {
  color: #fff;
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 800;
  text-decoration: none;
  direction: ltr;
  display: flex;
  align-items: center;
  min-height: 44px;
  text-align: right;
  margin: 4px 0;
}

.thx {
  text-align: center;
  margin: 44px 0 0;
  padding: 26px 5vw calc(88px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

.thx p {
  margin: 4px 0;
}

.thx b {
  color: var(--red);
  font-size: 20px;
}

.fab-call {
  display: none;
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 16px;
  right: auto;
  z-index: 1200;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 28px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(215, 20, 26, 0.35);
  direction: ltr;
}

.status-error {
  background: #fff3f3;
  color: #8a1f1f;
  border: 1px solid #f0c2c2;
  border-radius: 12px;
  padding: 12px 14px;
}

.toast {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1300;
  background: var(--ink);
  color: var(--card);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  max-width: 90vw;
}

@media (max-width: 760px) {
  .top {
    padding: 8px 5vw;
  }

  .top img {
    height: 48px;
  }

  .top b {
    font-size: 13px;
    line-height: 1.4;
  }

  .hero {
    min-height: 0;
  }

  .hero-inner {
    padding: 22px 5vw 20px;
  }

  .hero h1 {
    font-size: 22px;
    margin-bottom: 12px;
  }

  .hero p {
    display: none;
  }

  .hero .btn {
    font-size: 14px;
    padding: 8px 16px;
    min-height: 40px;
  }

  .stats {
    margin-top: 14px;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stats div:last-child {
    grid-column: 1 / -1;
  }

  .stats b {
    font-size: 24px;
  }

  h2 {
    margin: 22px 0 6px;
  }

  .sub {
    margin-bottom: 12px;
    font-size: 14px;
  }

  .finder {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }

  .filters-sticky {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    margin-inline: -5vw;
    padding: 8px 5vw 8px;
    gap: 8px;
  }

  .map-card {
    order: 2;
    position: static;
    padding: 0;
    width: calc(100% + 10vw);
    max-width: none;
    margin-inline: -5vw;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .picked {
    margin: 10px 5vw 0;
  }

  .map-note {
    margin: 8px 5vw 10px;
  }

  .results {
    order: 3;
  }

  .chips-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 8px 4px;
    scroll-padding-inline: 16px;
    gap: 6px;
  }

  .chips-bar::-webkit-scrollbar {
    display: none;
  }

  #map,
  .leaflet-container {
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
    border-radius: 0;
    width: 100%;
  }

  .leaflet-control-zoom a {
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
  }

  .cards {
    grid-template-columns: 1fr;
    padding-bottom: 72px;
  }

  .fab-call {
    display: inline-flex;
    align-items: center;
  }

  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}
