/* map.4irq.com. Logical properties follow the document direction; the map
   buttons stay physically on the left in both languages (owner UI rule). */

@font-face {
  font-family: "Cairo";
  src: url("/fonts/Cairo-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cairo";
  src: url("/fonts/Cairo-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --teal: #0e9f8e;
  --teal-dark: #0b6e63;
  --corpus: #3559d9;
  --hazard: #d9480f;
  --ink: #17212b;
  --muted: #5b6875;
  --line: #d9e0e7;
  --paper: #ffffff;
  --shadow: 0 4px 18px rgba(23, 33, 43, 0.18);
  --radius: 14px;
  color-scheme: light;
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--paper);
}

body {
  overflow: hidden;
}

body.page {
  overflow: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

a {
  color: var(--teal-dark);
}

/* --- map ---------------------------------------------------------------- */

/* maplibre-gl.css loads after this file and sets .maplibregl-map and the
   control corners, so these rules need the higher specificity. */
.map,
.map.maplibregl-map {
  position: fixed;
  inset: 0;
}

.map-loading {
  position: absolute;
  inset-block-start: 50%;
  inset-inline: 0;
  text-align: center;
  color: var(--muted);
}

.map[data-state="ready"] .map-loading {
  display: none;
}

.map[data-state="unavailable"] .map-loading {
  display: none;
}

.map .maplibregl-ctrl-top-left {
  top: 112px;
  left: 0;
}

.map-buttons {
  position: fixed;
  left: 10px;
  top: 196px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}

.round-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.round-button svg {
  fill: var(--teal);
}

.puck svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.puck-arrow {
  fill: var(--teal);
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linejoin: round;
}

/* The open card's place; a ring, never the location arrow. */
.selected-place {
  width: 26px;
  height: 26px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 2px #ffffff;
  pointer-events: none;
}

/* Names the orange report dots whenever some are drawn. */
.legend {
  position: fixed;
  left: 10px;
  bottom: 34px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.legend[hidden] {
  display: none;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--hazard);
}

.attribution {
  position: fixed;
  right: 8px;
  bottom: 6px;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  direction: ltr;
}

/* --- search ------------------------------------------------------------- */

.top-bar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 16px;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  max-width: 440px;
}

.search-box input {
  width: 100%;
  height: 46px;
  padding-inline: 16px;
  border: 1px solid var(--line);
  border-radius: 23px;
  background: var(--paper);
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 16px;
}

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

.search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px 0;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.option {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  cursor: pointer;
}

.option[aria-selected="true"],
.option:hover {
  background: #e7f6f4;
}

.option-name {
  font-weight: 700;
}

.option-meta {
  color: var(--muted);
  font-size: 13px;
}

.search-status:empty {
  display: none;
}

.search-status {
  margin: 6px 0 0;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.top-links {
  display: flex;
  gap: 6px;
  margin-inline-start: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

/* --- sheets ------------------------------------------------------------- */

.sheet {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 5;
  max-height: 62vh;
  overflow-y: auto;
  padding: 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.card-head {
  position: relative;
  padding-inline-end: 40px;
}

.card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.4;
}

.card-secondary,
.card-meta {
  margin: 4px 0 0;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card-close {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #eef2f5;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.badge {
  padding: 1px 8px;
  border-radius: 10px;
  background: #eef2f5;
  font-size: 12px;
}

.badge.verified {
  background: #e1f5f2;
  color: var(--teal-dark);
}

.badge.corpus {
  background: #e7ecfc;
  color: var(--corpus);
}

.badge.report {
  background: #fbe9e1;
  color: #a5360b;
}

.card-body p {
  margin: 10px 0 0;
}

.card-photo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  margin-top: 12px;
  border-radius: 10px;
}

.photo-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 8px;
}

.photo-strip img {
  height: 96px;
  border-radius: 8px;
}

.card-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.button.link {
  border: 0;
  padding: 0;
  min-height: 32px;
  color: var(--teal-dark);
}

.toast:empty {
  display: none;
}

.toast {
  position: fixed;
  inset-inline: 16px;
  inset-block-end: 40px;
  z-index: 6;
  margin: 0 auto;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
  text-align: center;
}

/* --- plain pages --------------------------------------------------------- */

.page-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  line-height: 1.7;
}

.credits section {
  margin-top: 28px;
}

/* --- wide screens --------------------------------------------------------- */

@media (min-width: 768px) {
  .map .maplibregl-ctrl-top-left {
    top: 66px;
  }

  .map-buttons {
    top: 150px;
  }

  .sheet {
    inset-inline-start: 16px;
    inset-inline-end: auto;
    inset-block-start: 76px;
    inset-block-end: auto;
    width: 380px;
    max-height: calc(100vh - 100px);
    border-radius: var(--radius);
  }

  html[dir="ltr"] .sheet {
    inset-inline-start: auto;
    right: 16px;
  }
}

/* --- the editor page (/edit, DEV-CLAUDE-MAC-MINI-260) --------------------- */

/* The page swaps whole sections with the hidden attribute; no display rule
   below may show one of them again (smoke finding: «خروج» signed out). */
.edit-page [hidden] {
  display: none !important;
}

.edit-page {
  min-height: 100vh;
  background: var(--paper);
}

.edit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-block-end: 1px solid var(--line);
}

.edit-heading {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1.15rem;
}

.chip.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.sign-in h2 {
  margin-block: 8px 12px;
}

.sign-in-code {
  width: min(320px, 80vw);
  margin-block: 8px 16px;
}

.sign-in-qr {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sign-in-steps {
  padding-inline-start: 22px;
}

.sign-in-status {
  color: var(--muted);
}

.sign-in-confirm {
  font-size: 1.1rem;
}

.editor {
  display: flex;
  height: calc(100vh - 64px);
}

.edit-map {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.edit-panel {
  flex: 0 0 380px;
  max-width: 45vw;
  overflow-y: auto;
  padding: 12px 16px 24px;
  border-inline-start: 1px solid var(--line);
}

.edit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block-end: 12px;
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-block-end: 18px;
}

.edit-form h4,
.edit-place h3 {
  margin: 4px 0;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.edit-hint {
  margin: 4px 0;
  color: var(--muted);
}

.edit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.edit-row {
  padding: 8px 0;
  border-block-end: 1px solid var(--line);
  list-style: none;
}
