@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #102824;
  --muted: #61736f;
  --paper: #f8faf8;
  --panel: #ffffff;
  --line: #e2ebe7;
  --brand: #0b6b5f;
  --brand-deep: #092f2a;
  --brand-soft: #e5f3ef;
  --gold: #d3a647;
  --areas: #16856f;
  --hospitals: #d84d5d;
  --oil: #8a623c;
  --projects: #315fa5;
  --shadow: 0 18px 50px rgba(11, 45, 39, .14);
  --header-height: 72px;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.skip-link {
  position: fixed;
  top: -80px;
  right: 16px;
  z-index: 5000;
  color: #fff;
  background: var(--brand-deep);
  padding: 10px 14px;
  border-radius: 10px;
}
.skip-link:focus { top: 12px; }

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  background: var(--brand-deep);
  color: #fff;
  border-bottom: 3px solid var(--gold);
  position: relative;
  z-index: 1000;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
}

.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
}
.brand-mark svg { width: 25px; fill: #fff; }

.brand-copy { display: grid; line-height: 1.5; }
.brand-copy strong { font-size: 15px; font-weight: 800; }
.brand-copy small { color: #bcd5cf; font-size: 10px; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-inline-start: auto;
}
.top-nav a, .nav-button {
  color: #d9ebe6;
  background: none;
  border: 0;
  padding: 8px 0;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
}
.top-nav a:hover, .nav-button:hover { color: #fff; }

.release-badge {
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.2);
  color: #f3dcad;
  background: rgba(211,166,71,.1);
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}

.atlas-app {
  height: calc(100dvh - var(--header-height));
  display: grid;
  grid-template-columns: 390px 1fr;
  direction: rtl;
}

.sidebar {
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 700;
}

.sidebar-handle { display: none; }

.sidebar-head {
  padding: 24px 24px 14px;
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
}
.sidebar-head h1 {
  margin: 0 0 7px;
  font-size: 21px;
  line-height: 1.6;
  letter-spacing: -.02em;
}
.sidebar-head > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.9;
}

.search-box {
  margin: 0 24px 17px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: #f8fbfa;
  border-radius: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search-box:focus-within {
  background: #fff;
  border-color: #84bbae;
  box-shadow: 0 0 0 4px rgba(11,107,95,.09);
}
.search-box svg {
  width: 19px;
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}
.search-box input::placeholder { color: #91a19d; }
.search-box button {
  display: none;
  border: 0;
  background: #e8efed;
  color: #647570;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.search-box.has-value button { display: grid; place-items: center; }

.filters-section { padding: 0 24px 17px; border-bottom: 1px solid var(--line); }
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-title-row h2 { margin: 0; font-size: 11px; font-weight: 800; }
.text-button {
  border: 0;
  background: none;
  color: var(--brand);
  padding: 4px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.category-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px;
}
.category-filter {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #435652;
  transition: transform .18s, border-color .18s, background .18s;
}
.category-filter:hover { transform: translateY(-1px); border-color: #b4c9c3; }
.category-filter.active { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 8%, white); color: var(--ink); }
.filter-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--cat) 12%, white);
  color: var(--cat);
  font-size: 13px;
}
.filter-label { font-size: 10px; font-weight: 700; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.filter-count { margin-inline-start: auto; color: #7d8d89; font-size: 9px; }

.results-section {
  min-height: 0;
  padding: 17px 14px 0 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.results-section > .section-title-row { padding-right: 10px; }
.results-count { color: #7a8985; font-size: 9px; }
.results-list {
  min-height: 0;
  overflow-y: auto;
  padding: 0 10px 16px 0;
  scrollbar-width: thin;
  scrollbar-color: #bdcbc7 transparent;
}
.result-card {
  width: 100%;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: right;
  border: 1px solid transparent;
  border-bottom-color: #eef3f1;
  background: #fff;
  padding: 11px 8px;
  cursor: pointer;
  border-radius: 12px;
  transition: background .18s, border-color .18s;
}
.result-card:hover, .result-card:focus-visible { background: #f7fbf9; border-color: #dce9e5; outline: 0; }
.result-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--cat);
  font-size: 16px;
  box-shadow: 0 5px 12px color-mix(in srgb, var(--cat) 25%, transparent);
}
.result-copy { min-width: 0; }
.result-copy strong { display: block; font-size: 10px; line-height: 1.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-copy small { color: #788984; font-size: 8px; }
.result-arrow { color: #9aaba6; font-size: 16px; transform: rotate(90deg); }

.empty-state { text-align: center; color: var(--muted); padding: 36px 10px; }
.empty-state > span { display: block; font-size: 34px; color: #aebcb8; }
.empty-state strong { font-size: 12px; }
.empty-state p { font-size: 9px; margin: 6px 0 0; }

.sidebar-footer {
  padding: 10px 24px;
  color: #768783;
  background: #f8faf9;
  border-top: 1px solid var(--line);
  font-size: 8px;
  line-height: 1.8;
}
.data-dot { display: inline-block; width: 7px; height: 7px; margin-inline-end: 5px; border-radius: 50%; background: var(--gold); }

.map-shell { min-width: 0; position: relative; direction: ltr; background: #d9e2de; }
#map { width: 100%; height: 100%; z-index: 1; background: #dfe7e4; }
.leaflet-container { font-family: "Noto Kufi Arabic", Tahoma, Arial, sans-serif; }
.leaflet-control-attribution { font-size: 8px !important; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 6px 20px rgba(17,48,42,.15) !important; margin-top: 18px !important; margin-left: 18px !important; }
.leaflet-control-zoom a { border: 0 !important; color: var(--brand-deep) !important; }

.map-actions {
  position: absolute;
  left: 18px;
  top: 98px;
  z-index: 500;
  display: grid;
  gap: 7px;
}
.map-actions button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: 0 5px 18px rgba(17,48,42,.15);
  cursor: pointer;
}
.map-actions svg { width: 18px; fill: none; stroke: var(--brand-deep); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.map-actions button:hover { background: var(--brand-soft); }

.map-legend {
  position: absolute;
  left: 18px;
  bottom: 25px;
  z-index: 500;
  direction: rtl;
  width: 153px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(9px);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 8px 25px rgba(17,48,42,.13);
  border-radius: 13px;
  padding: 11px 12px;
}
.map-legend > strong { display: block; margin-bottom: 7px; font-size: 9px; }
.legend-item { display: flex; align-items: center; gap: 7px; padding: 3px 0; color: #60716d; font-size: 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 15%, white); }

.map-notice {
  position: absolute;
  z-index: 800;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  direction: rtl;
  color: #fff;
  background: rgba(9,47,42,.92);
  box-shadow: var(--shadow);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 9px;
  white-space: nowrap;
}

.atlas-marker-wrap { background: none; border: 0; }
.atlas-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  color: #fff;
  background: var(--cat);
  border: 3px solid #fff;
  box-shadow: 0 6px 17px rgba(9,47,42,.3);
  transition: transform .18s;
}
.atlas-marker span { transform: rotate(45deg); font-size: 13px; line-height: 1; }
.atlas-marker:hover { transform: rotate(-45deg) scale(1.12); }
.user-location { width: 16px; height: 16px; background: #2679db; border: 4px solid white; border-radius: 50%; box-shadow: 0 0 0 7px rgba(38,121,219,.2); }

.atlas-popup { direction: rtl; text-align: right; min-width: 235px; padding: 3px; }
.popup-category { display: inline-flex; align-items: center; gap: 5px; color: var(--cat); background: color-mix(in srgb, var(--cat) 9%, white); padding: 4px 8px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.atlas-popup h3 { margin: 9px 0 4px; font-size: 13px; line-height: 1.7; }
.atlas-popup p { color: #5d6f6a; font-size: 9px; line-height: 1.9; margin: 0 0 9px; }
.popup-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.popup-meta span { color: #687975; background: #f2f6f4; border-radius: 7px; padding: 4px 6px; font-size: 7px; }
.popup-actions { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.popup-actions a { display: flex; justify-content: center; align-items: center; min-height: 34px; border-radius: 9px; text-decoration: none; font-size: 8px; font-weight: 800; }
.wiki-link { color: #fff; background: var(--brand); padding: 0 10px; }
.source-link { color: var(--brand); border: 1px solid #bfd6d0; padding: 0 9px; }
.leaflet-popup-content-wrapper { border-radius: 15px; box-shadow: 0 14px 42px rgba(9,47,42,.2); }
.leaflet-popup-content { margin: 13px; }

.mobile-panel-toggle { display: none; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4,28,24,.68);
  backdrop-filter: blur(7px);
}
.dialog-backdrop[hidden] { display: none; }
.welcome-card, .about-card {
  width: min(515px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 26px;
  padding: 34px;
  box-shadow: 0 30px 90px rgba(0,0,0,.25);
  animation: dialogIn .28s ease-out;
}
@keyframes dialogIn { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.welcome-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 24px; background: var(--brand-soft); }
.welcome-icon svg { width: 45px; fill: var(--brand); }
.release-pill { display: inline-block; color: #84611e; background: #fbf2da; border-radius: 999px; padding: 5px 9px; font-size: 8px; font-weight: 800; }
.welcome-card h2, .about-card h2 { margin: 11px 0 8px; font-size: 21px; line-height: 1.7; }
.welcome-card > p, .about-card > p { color: var(--muted); margin: 0 auto 17px; max-width: 440px; font-size: 10px; line-height: 2; }
.welcome-features { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.welcome-features span { color: #42615a; background: #f1f6f4; border: 1px solid #e1ebe7; border-radius: 9px; padding: 7px 9px; font-size: 8px; }
.primary-button { width: 100%; min-height: 47px; border: 0; border-radius: 13px; color: #fff; background: var(--brand); font-weight: 800; font-size: 11px; cursor: pointer; box-shadow: 0 8px 20px rgba(11,107,95,.2); }
.primary-button:hover { background: #085a50; }
.welcome-card > small { display: block; color: #82928e; margin-top: 12px; font-size: 7px; }

.about-card { position: relative; text-align: right; }
.about-card .eyebrow { text-align: right; }
.close-dialog { position: absolute; left: 18px; top: 16px; width: 34px; height: 34px; border: 0; background: #eef3f1; border-radius: 50%; cursor: pointer; }
.about-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.about-links a { display: grid; place-items: center; min-height: 42px; color: var(--brand); text-decoration: none; border: 1px solid #bdd6d0; border-radius: 11px; font-size: 9px; font-weight: 800; }

noscript { position: fixed; inset: auto 0 0; z-index: 5000; color: #fff; background: #a72d3a; padding: 12px; text-align: center; }

@media (max-width: 940px) {
  .atlas-app { grid-template-columns: 340px 1fr; }
  .top-nav { gap: 14px; }
  .top-nav a { display: none; }
}

@media (max-width: 720px) {
  :root { --header-height: 62px; }
  .site-header { padding: 0 13px; gap: 10px; }
  .brand-mark { width: 35px; height: 35px; }
  .brand-copy strong { font-size: 12px; }
  .brand-copy small { font-size: 8px; }
  .top-nav { display: none; }
  .release-badge { margin-inline-start: auto; font-size: 8px; padding: 6px 8px; }
  .atlas-app { display: block; position: relative; }
  .map-shell { width: 100%; height: 100%; }
  .sidebar {
    position: absolute;
    z-index: 750;
    right: 9px;
    left: 9px;
    bottom: 9px;
    height: min(53dvh, 520px);
    border: 0;
    border-radius: 20px;
    box-shadow: 0 -8px 40px rgba(9,47,42,.2);
    transition: transform .28s ease;
  }
  .sidebar.mobile-collapsed { transform: translateY(calc(100% + 18px)); }
  .sidebar-handle { display: block; position: absolute; z-index: 2; top: 7px; left: 50%; transform: translateX(-50%); width: 42px; height: 4px; background: #ced9d5; border-radius: 99px; }
  .sidebar-head { padding: 20px 18px 10px; }
  .sidebar-head h1 { font-size: 15px; }
  .sidebar-head > p:last-child { display: none; }
  .search-box { margin: 0 18px 12px; height: 43px; }
  .filters-section { padding: 0 18px 12px; }
  .category-filter { height: 38px; }
  .results-section { padding: 12px 9px 0 18px; }
  .sidebar-footer { display: none; }
  .map-legend { display: none; }
  .map-actions { top: 92px; }
  .mobile-panel-toggle {
    display: flex;
    position: absolute;
    z-index: 720;
    bottom: 18px;
    right: 50%;
    transform: translateX(50%);
    align-items: center;
    gap: 8px;
    color: #fff;
    background: var(--brand-deep);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 999px;
    padding: 10px 15px;
    box-shadow: 0 8px 24px rgba(9,47,42,.28);
    font-size: 9px;
    font-weight: 800;
  }
  .mobile-panel-toggle.panel-open { bottom: calc(min(53dvh, 520px) + 17px); }
  .mobile-panel-toggle.panel-open .toggle-arrow { transform: rotate(180deg); }
  .map-notice { bottom: 70px; max-width: calc(100vw - 28px); overflow: hidden; text-overflow: ellipsis; }
  .welcome-card, .about-card { padding: 27px 20px; border-radius: 22px; }
  .welcome-card h2, .about-card h2 { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
