/* aerial-map.css — ظاهر ابزار «نقشه هوایی آنلاین» (فقط در همین صفحه بار می‌شود) */
.am, .am-guide, .am-links, .am-cta { --am-accent: var(--accent, #2563eb); --am-accent-dark: var(--accent-dark, #1d4ed8); --am-border: var(--border, #e2e6f0);
      --am-text: var(--text, #1a1f36); --am-muted: var(--text-light, #5a6282); --am-radius: 12px;
      margin: 8px 0 20px; font-family: var(--font, 'Dana', system-ui, sans-serif); }
.am *, .am *::before, .am *::after { box-sizing: border-box; }
.am-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool-intro { font-size: 16px; margin-bottom: 14px; }

/* ---------- جستجو ---------- */
.am-search { position: relative; z-index: 6; margin-bottom: 10px; }
.am-search__box { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--am-border); border-radius: var(--am-radius);
                  padding: 6px 12px 6px 6px; box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.06)); transition: border-color .15s; }
.am-search__box:focus-within { border-color: var(--am-accent); }
.am-search__box > svg { flex: none; color: var(--am-muted); }
.am-search__input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--am-text); padding: 9px 0; }
.am-search__input::-webkit-search-cancel-button { display: none; }
.am-search__clear { flex: none; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f0f2f8; color: var(--am-muted); font-size: 20px; line-height: 1; cursor: pointer; }
.am-search__go { flex: none; border: 0; border-radius: 9px; background: var(--am-accent); color: #fff; font: inherit; font-weight: 700; font-size: 14px; padding: 10px 18px; cursor: pointer; }
.am-search__go:hover { background: var(--am-accent-dark); }
.am-suggest { position: absolute; inset-inline: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--am-border);
              border-radius: var(--am-radius); box-shadow: var(--shadow-lg, 0 8px 40px rgba(0,0,0,.1)); max-height: min(60vh, 380px); overflow: auto; }
.am-suggest li { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--am-text); }
.am-suggest li small { color: var(--am-muted); font-size: 12.5px; margin-inline-start: auto; text-align: end; }
.am-suggest li[aria-selected="true"], .am-suggest li:hover { background: var(--blue-light, #eff6ff); }
.am-suggest .am-suggest__note { cursor: default; color: var(--am-muted); font-size: 13px; }
.am-suggest .am-suggest__note:hover { background: none; }
.am-search__msg { margin: 6px 4px 0; font-size: 13.5px; color: var(--am-muted); }

/* ---------- صحنه نقشه ---------- */
.am-stage { position: relative; height: clamp(480px, 76vh, 820px); border-radius: var(--am-radius); overflow: hidden; background: #dfe6ee;
            border: 1px solid var(--am-border); isolation: isolate; }
.page-type-tool .am-stage { width: min(100vw - 32px, 1480px); margin-inline: calc((100% - min(100vw - 32px, 1480px)) / 2); }
.am-map { position: absolute; inset: 0; }
.am-stage:fullscreen, .am-stage.maplibregl-pseudo-fullscreen { width: 100vw !important; height: 100vh !important; margin: 0 !important; border-radius: 0; border: 0; }
.am-loading { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px;
              background: #e9eef4; color: var(--am-muted); font-size: 15px; }
.am-loading.is-error { color: #991b1b; background: #fef2f2; flex-direction: column; gap: 12px; }
.am-loading[hidden] { display: none; }

/* کنترل‌های خود MapLibre */
.am .maplibregl-ctrl-group { border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,.18); overflow: hidden; }
.am .maplibregl-ctrl-group button { width: 38px; height: 38px; }
.am .maplibregl-ctrl-attrib { font-size: 11px; direction: ltr; }
.am .maplibregl-ctrl-scale { direction: ltr; font-size: 11px; border-color: #1f2937; color: #1f2937; background: rgba(255,255,255,.8); }

/* ---------- نوع نقشه ---------- */
.am-layers { position: absolute; z-index: 3; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px;
             background: #fff; border-radius: 12px; box-shadow: 0 1px 8px rgba(0,0,0,.2); max-width: calc(100% - 130px); }
.am-layer { border: 0; background: transparent; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--am-text); padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.am-layer[aria-pressed="true"] { background: var(--am-accent); color: #fff; }
.am-labels { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--am-text); padding: 0 10px 0 8px; border-inline-start: 1px solid var(--am-border); margin-inline-start: 4px; cursor: pointer; white-space: nowrap; }
.am-labels input { width: 16px; height: 16px; accent-color: var(--am-accent); }
.am-labels[hidden] { display: none; }

/* ---------- نوار ابزار ---------- */
.am-tools { position: absolute; z-index: 3; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.am-tools__group { display: flex; flex-direction: column; background: #fff; border-radius: 12px; box-shadow: 0 1px 8px rgba(0,0,0,.2); overflow: hidden; }
.am-tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 62px; min-height: 54px; padding: 6px 2px; border: 0;
           border-bottom: 1px solid #f0f2f8; background: #fff; color: var(--am-text); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; }
.am-tools__group .am-tool:last-child { border-bottom: 0; }
.am-tool:hover:not([disabled]) { background: #f4f7ff; color: var(--am-accent-dark); }
.am-tool[aria-pressed="true"] { background: var(--am-accent); color: #fff; }
.am-tool[disabled] { opacity: .45; cursor: default; }
.am-tool--danger:hover:not([disabled]) { background: #fef2f2; color: #b91c1c; }
.am-tool:focus-visible, .am-layer:focus-visible, .am-panel__btn:focus-visible, .am-btn:focus-visible { outline: 2px solid var(--am-accent); outline-offset: 2px; }

/* ---------- پنل نتیجه ---------- */
.am-panel { position: absolute; z-index: 3; left: 62px; top: 64px; width: 350px; max-width: calc(100% - 150px); max-height: calc(100% - 100px); display: flex; flex-direction: column;
            background: #fff; border-radius: 14px; box-shadow: 0 4px 24px rgba(0,0,0,.22); overflow: hidden; }
.am-panel[hidden] { display: none; }
.am-panel__head { display: flex; align-items: center; gap: 4px; padding: 8px 12px 8px 8px; border-bottom: 1px solid #f0f2f8; flex: none; }
.am-panel__title { flex: 1; margin: 0; font-size: 15px; font-weight: 800; color: var(--am-text); border: 0; padding: 0; line-height: 1.6; }
.am-panel__btn { flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; background: transparent; color: var(--am-muted); cursor: pointer; }
.am-panel__btn:hover { background: #f0f2f8; }
.am-panel__body { padding: 12px; overflow: auto; font-size: 14px; line-height: 1.75; color: var(--am-text); }
.am-panel.is-collapsed .am-panel__body { display: none; }
.am-panel.is-collapsed [data-panel="toggle"] svg { transform: rotate(180deg); }
.am-kv { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; margin: 0 0 10px; }
.am-kv dt { color: var(--am-muted); font-size: 12.5px; white-space: nowrap; }
.am-kv dd { margin: 0; font-weight: 700; direction: ltr; text-align: left; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.am-big { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.am-big div { flex: 1 1 120px; background: #f4f7ff; border-radius: 10px; padding: 8px 10px; }
.am-big span { display: block; font-size: 12px; color: var(--am-muted); }
.am-big b { display: block; font-size: 17px; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.am-copy { border: 0; background: #f0f2f8; color: var(--am-text); border-radius: 7px; font: inherit; font-size: 12px; padding: 4px 9px; cursor: pointer; white-space: nowrap; }
.am-copy:hover { background: #e2e6f0; }
.am-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.am-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--am-border);
          background: #fff; color: var(--am-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.am-btn:hover { background: #f4f7ff; }
.am-btn--primary { background: var(--am-accent); border-color: var(--am-accent); color: #fff; }
.am-btn--primary:hover { background: var(--am-accent-dark); color: #fff; }
.am-btn--danger { color: #b91c1c; border-color: #fecaca; }
.am-btn--danger:hover { background: #fef2f2; }
.am-btn[disabled] { opacity: .5; cursor: default; }
.am-hint { margin: 0 0 10px; font-size: 13px; color: var(--am-muted); }
.am-warn { margin: 0 0 10px; padding: 8px 10px; border-radius: 9px; background: #fffbeb; color: #92400e; font-size: 13px; }
.am-table-wrap { max-height: 190px; overflow: auto; border: 1px solid #f0f2f8; border-radius: 9px; margin-top: 8px; }
.am-table { width: 100%; border-collapse: collapse; font-size: 12px; direction: ltr; font-variant-numeric: tabular-nums; }
.am-table th, .am-table td { padding: 5px 7px; text-align: left; border-bottom: 1px solid #f0f2f8; white-space: nowrap; }
.am-table th { position: sticky; top: 0; background: #f8f9fc; font-weight: 700; color: var(--am-muted); }
.am-table td button { border: 0; background: none; color: #b91c1c; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; }
.am-list { list-style: none; margin: 0; padding: 0; }
.am-list li { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid #f0f2f8; }
.am-list li:last-child { border-bottom: 0; }
.am-list button.am-list__pick { flex: 1; text-align: start; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--am-text); cursor: pointer; padding: 4px; }
.am-list small { color: var(--am-muted); white-space: nowrap; }
details.am-more { margin-top: 8px; }
details.am-more summary { cursor: pointer; font-size: 13px; color: var(--am-accent-dark); font-weight: 600; padding: 4px 0; }

.am-toast { position: absolute; z-index: 5; left: 50%; bottom: 46px; transform: translateX(-50%); max-width: min(92%, 460px); background: #1a1f36; color: #fff; font-size: 13.5px; line-height: 1.7;
            padding: 9px 16px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.3); text-align: center; }
.am-toast[hidden] { display: none; }
.am-toast button { margin-inline-start: 10px; border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 7px; font: inherit; font-size: 12.5px; padding: 3px 10px; cursor: pointer; }

/* ---------- نشانگرهای روی نقشه ---------- */
.am-vertex { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--am-accent, #2563eb); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: grab; }
.am-vertex::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; }
.am-vertex.is-first { border-color: #16a34a; }
.am-vertex.is-picked { background: var(--am-accent, #2563eb); }
.am-mid { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.85); border: 2px dashed var(--am-accent, #2563eb); cursor: copy; }
.am-mid::after { content: ''; position: absolute; inset: -10px; border-radius: 50%; }
.am-seg { direction: ltr; background: rgba(255,255,255,.92); color: #1a1f36; font: 600 11px/1.5 system-ui, sans-serif; padding: 1px 6px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.3); white-space: nowrap; pointer-events: none; }
.am-pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; background: #dc2626; border: 3px solid #fff; transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.am-me { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(37,99,235,.35), 0 1px 5px rgba(0,0,0,.4); }

/* ---------- زیر نقشه ---------- */
.am-credit { margin: 8px 2px 0; font-size: 12px; color: var(--am-muted); direction: rtl; }
.am-credit span[dir="ltr"] { unicode-bidi: isolate; }
.am-disclaimer { margin: 6px 2px 0; padding: 10px 12px; font-size: 13.5px; line-height: 1.9; color: #7c2d12; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; }
.am-guide { margin: 26px 0 18px; }
.am-guide h2, .am-cta h2 { font-size: 20px; font-weight: 800; margin: 0 0 10px; color: var(--am-text); border: 0; padding: 0; }
.am-guide ol { margin: 0; padding-inline-start: 22px; font-size: 15px; line-height: 2; }
.am-guide li { margin-bottom: 4px; }
.am-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 22px; }
.am-link { display: block; padding: 14px 16px; border: 1px solid var(--am-border); border-radius: 12px; background: #fff; text-decoration: none; color: var(--am-text); transition: border-color .15s, box-shadow .15s; }
.am-link:hover { border-color: var(--am-accent); box-shadow: var(--shadow, 0 4px 16px rgba(0,0,0,.08)); }
.am-link strong { display: block; font-size: 15px; color: var(--am-accent-dark); margin-bottom: 4px; }
.am-link span { display: block; font-size: 13px; color: var(--am-muted); line-height: 1.8; }
.am-cta { display: flex; align-items: center; gap: 18px; margin: 0 0 30px; padding: 20px 22px; border-radius: 14px; background: var(--blue-light, #eff6ff); border: 1px solid var(--blue-border, #bfdbfe); }
.am-cta__text { flex: 1; }
.am-cta p { margin: 0; font-size: 14.5px; line-height: 1.95; color: var(--am-text); }
.am-cta__opt { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; cursor: pointer; }
.am-cta__opt[hidden] { display: none; }
.am-cta__opt input { width: 17px; height: 17px; accent-color: var(--am-accent); }
.am-cta__btn { flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 22px; border-radius: 10px; background: var(--am-accent); color: #fff; font-weight: 800; font-size: 15px; text-decoration: none; }
.am-cta__btn:hover { background: var(--am-accent-dark); color: #fff; }

/* ---------- موبایل و تبلت ---------- */
@media (max-width: 900px) {
  .am-stage { height: clamp(430px, 74vh, 640px); height: clamp(430px, 74svh, 640px); }
  .page-type-tool .am-stage { width: 100vw; margin-inline: calc((100% - 100vw) / 2); border-radius: 0; border-inline: 0; }
  .am-layers { top: 8px; max-width: calc(100% - 110px); }
  .am-layer { padding: 8px 10px; font-size: 13px; }
  .am-labels { padding: 0 6px; font-size: 12px; }
  .am-tools { top: auto; right: 0; left: 0; bottom: 0; flex-direction: row; align-items: center; gap: 0; height: 64px; box-sizing: border-box; padding: 0 8px; background: #fff;
              box-shadow: 0 -1px 8px rgba(0,0,0,.18); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .am-tools::-webkit-scrollbar { display: none; }
  .am-tools__group { flex-direction: row; box-shadow: none; border-radius: 0; flex: none; }
  .am-tools__group + .am-tools__group { border-inline-start: 1px solid var(--am-border); margin-inline-start: 4px; padding-inline-start: 4px; }
  .am-tool { width: auto; min-width: 56px; height: 52px; min-height: 0; padding: 4px 5px; border-bottom: 0; border-radius: 9px; white-space: nowrap; }
  .am .maplibregl-ctrl-bottom-right, .am .maplibregl-ctrl-bottom-left { bottom: 66px; }
  .am-panel { left: 8px; right: 8px; top: auto; bottom: 72px; width: auto; max-width: none; max-height: 52%; border-radius: 14px; }
  /* روی گوشی پیام‌ها بالای نقشه می‌آیند تا روی کادر نتیجه نیفتند */
  .am-toast { top: 58px; bottom: auto; }
  .am-links { grid-template-columns: 1fr; }
  .am-cta { flex-direction: column; align-items: stretch; text-align: start; }
  .am-search__go { padding: 10px 14px; }
  .am-stage:fullscreen .am-panel, .am-stage.maplibregl-pseudo-fullscreen .am-panel { max-height: 46%; }
}
@media (max-width: 380px) {
  .am-layer { padding: 7px 8px; font-size: 12.5px; }
  .am-tool { min-width: 52px; font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) { .am * { transition: none !important; } }
