/* ============================================================
   لوحة الطبقات — تُفتح من زر «الطبقات» في العمود الأيسر
   ============================================================ */
.amtar-pl {
  position: absolute;
  z-index: 600;
  display: none;
  direction: rtl;
  font-family: inherit;
  width: min(268px, calc(100vw - 24px));
}

.amtar-pl.is-open { display: block; }

.amtar-lp {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(11, 44, 58, .18), 0 0 0 1px rgba(11, 44, 58, .06);
  overflow: hidden auto;
  max-height: inherit;
  overscroll-behavior: contain;
}

/* الموقع يلوّن أشرطة التمرير بالأخضر الداكن عالمياً، فتظهر شريحة ثقيلة
   على حافّة اللوحة. نجعلها رفيعة وهادئة داخل لوحتنا فقط. */
.amtar-lp::-webkit-scrollbar { width: 6px; }
.amtar-lp::-webkit-scrollbar-track { background: transparent; }
.amtar-lp::-webkit-scrollbar-thumb {
  background: #DDE3E7;
  border-radius: 999px;
}
.amtar-lp::-webkit-scrollbar-thumb:hover { background: #C3CCD3; }
.amtar-lp { scrollbar-width: thin; scrollbar-color: #DDE3E7 transparent; }

.amtar-lp-title {
  padding: 13px 15px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .4px;
  color: #8A9199;
}

.amtar-lp-sep { height: 1px; background: #EEF2F4; margin: 4px 0; }

/* --- شكل الخريطة: مفتاح مقسّم --- */
.amtar-lp-seg {
  display: flex;
  margin: 0 12px 12px;
  padding: 3px;
  background: #F1F5F9;
  border-radius: 11px;
  gap: 2px;
}

.amtar-lp-seg-btn {
  appearance: none;
  flex: 1;
  border: 0;
  background: none;
  color: #5b6067;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.amtar-lp-seg-btn:hover:not(.is-on) { color: #16211F; }

.amtar-lp-seg-btn.is-on {
  background: #fff;
  color: #173F3A;
  box-shadow: 0 1px 3px rgba(11, 44, 58, .16);
}

/* --- مفتاح الخدمات المدفوعة --- */
.amtar-lp-switch {
  appearance: none;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: start;
  padding: 8px 15px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.amtar-lp-sw {
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #DDE3E7;
  position: relative;
  transition: background .18s ease;
}

.amtar-lp-sw::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s ease;
}

.amtar-lp-switch.is-on .amtar-lp-sw { background: #173F3A; }
.amtar-lp-switch.is-on .amtar-lp-sw::after { transform: translateX(-16px); }

.amtar-lp-swtxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.amtar-lp-swtxt b { font-size: 12.5px; font-weight: 700; color: #16211F; }
.amtar-lp-swtxt i { font-style: normal; font-size: 10px; color: #8A9199; }

.amtar-lp-warn {
  margin: 0 12px 8px;
  padding: 7px 10px;
  border-radius: 9px;
  background: #FFF7E6;
  color: #8A5A00;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
}

/* --- صفوف الطبقات --- */
.amtar-lp-list { padding: 0 8px 4px; display: flex; flex-direction: column; gap: 1px; }

.amtar-lp-row {
  appearance: none;
  position: relative;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: start;
  padding: 10px 12px 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .16s ease;
}

.amtar-lp-row:hover:not(:disabled) { background: #F8FAFC; }
.amtar-lp-row.is-on { background: color-mix(in srgb, var(--lp-c) 10%, #fff); }
.amtar-lp-row:disabled { cursor: default; opacity: .7; }

/* علامة الاختيار تمتلئ بلون الطبقة عند تشغيلها */
/* المربّع غير المحدّد كان أبيض بحدّ فاتح فلا يكاد يُرى على خلفية بيضاء.
   حدّ أغمق وخلفية رمادية خفيفة تجعله واضحاً كعنصر قابل للضغط. */
.amtar-lp-tick {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 2px solid #AEB8C0;
  background: #F1F5F9;
  position: relative;
  transition: background .16s ease, border-color .16s ease;
}

.amtar-lp-row:hover:not(:disabled) .amtar-lp-tick { border-color: #7C8791; }

.amtar-lp-row.is-on .amtar-lp-tick {
  background: var(--lp-c);
  border-color: var(--lp-c);
}

.amtar-lp-row.is-on .amtar-lp-tick::after {
  content: "";
  position: absolute;
  inset-inline-start: 5px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.amtar-lp-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: #16211F;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amtar-lp-q {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  color: #5b6067;
  background: #F1F5F9;
  border-radius: 6px;
  padding: 3px 7px;
}

.amtar-lp-q.is-out { background: #FEE2E2; color: #991B1B; }

.amtar-lp-row.is-busy::after {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid rgba(91, 96, 103, .3);
  border-top-color: #173F3A;
  border-radius: 50%;
  animation: amtar-pl-spin .7s linear infinite;
}

@keyframes amtar-pl-spin { to { transform: rotate(360deg); } }

/* --- لوحات البيانات المجمّعة --- */
.amtar-lp-data { padding: 10px 15px; border-top: 1px solid #EEF2F4; }

.amtar-lp-data h4 {
  margin: 0 0 7px;
  font-size: 11px;
  font-weight: 800;
  color: #173F3A;
}

.amtar-pl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  padding: 4px 0;
  border-bottom: 1px solid #F5F8F9;
}

.amtar-pl-row:last-child { border-bottom: 0; }
.amtar-pl-row span { color: #5b6067; }
.amtar-pl-row b { color: #16211F; font-weight: 600; text-align: end; }
.amtar-pl-empty { font-size: 11px; color: #8A9199; }

/* --- الإجراءات --- */
.amtar-lp-actions {
  display: flex;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid #EEF2F4;
  margin-top: 4px;
}

.amtar-lp-actions button {
  appearance: none;
  flex: 1;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 9px 8px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid #DDE3E7;
  background: #fff;
  color: #16211F;
  transition: background .16s ease;
}

.amtar-lp-actions button:first-child {
  background: #173F3A;
  border-color: #173F3A;
  color: #fff;
}

.amtar-lp-actions button:first-child:hover { filter: brightness(1.15); }
.amtar-lp-actions button:last-child:hover { background: #F1F5F9; }

.amtar-lp-seg-btn:focus-visible,
.amtar-lp-row:focus-visible,
.amtar-lp-switch:focus-visible,
.amtar-lp-actions button:focus-visible {
  outline: 2px solid #173F3A;
  outline-offset: -2px;
}

/* --- الرسائل --- */
.amtar-pl-note {
  display: none;
  padding: 9px 15px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #16211F;
  background: #F1F5F9;
  border-top: 1px solid #EEF2F4;
}

.amtar-pl-note.is-on { display: block; }
.amtar-pl-note.is-error { background: #FEF2F2; color: #991B1B; }

/* --- بطاقات البيانات فوق الخريطة --- */
.leaflet-tooltip.amtar-pl-badge {
  background: #0B1F1B;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .9);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  direction: rtl;
  pointer-events: none;
}

.leaflet-tooltip.amtar-pl-badge::before { display: none; }

.amtar-pl-marker {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35));
  cursor: pointer;
  transition: filter .16s ease;
}

.amtar-pl-marker:hover { filter: drop-shadow(0 3px 7px rgba(0, 0, 0, .5)); }

.amtar-pl-badge-parcels { background: #0F766E; }
.amtar-pl-badge-public-services { background: #3730A3; font-weight: 700; }
.amtar-pl-badge-moj-transactions { background: #9A3412; }
.amtar-pl-badge-rer-transactions { background: #991B1B; }
.amtar-pl-badge-rental-transactions { background: #065F46; }

.leaflet-container.amtar-pl-hide-badges .leaflet-tooltip.amtar-pl-badge { display: none; }

@media (max-width: 800px) {
  .amtar-pl { width: min(246px, calc(100vw - 24px)); }
  .amtar-lp-name { font-size: 12px; }
  .amtar-lp-swtxt i { display: none; }
}

:fullscreen .amtar-pl { z-index: 10001; }

@media (prefers-reduced-motion: reduce) {
  .amtar-lp-seg-btn, .amtar-lp-row, .amtar-lp-sw, .amtar-lp-sw::after,
  .amtar-lp-tick, .amtar-lp-actions button, .amtar-pl-marker { transition: none; }
  .amtar-lp-row.is-busy::after { animation: none; }
}

/* ============================================================
   بطاقة تفاصيل العنصر
   بديل نوافذ ليفلِت المنبثقة: amtar-map.js يغلق كل .leaflet-popup
   ليحوّل الضغط إلى لوحة العقارات، فتفاصيلنا كانت تُمحى. هذه بطاقتنا.
   ============================================================ */
.amtar-pd::-webkit-scrollbar { width: 6px; }
.amtar-pd::-webkit-scrollbar-track { background: transparent; }
.amtar-pd::-webkit-scrollbar-thumb { background: #DDE3E7; border-radius: 999px; }

.amtar-pd {
  scrollbar-width: thin;
  scrollbar-color: #DDE3E7 transparent;
  position: absolute;
  z-index: 620;
  display: none;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 24px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(11, 44, 58, .22), 0 0 0 1px rgba(11, 44, 58, .06);
  direction: rtl;
  overflow: hidden auto;
  overscroll-behavior: contain;
  font-family: inherit;
}

.amtar-pd.is-on { display: block; }

/* --- الرأس: شريط لوني يعرّف الطبقة --- */
.amtar-pd-head {
  position: relative;
  padding: 14px 16px 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pd-accent) 12%, #fff), #fff);
  border-bottom: 1px solid #EEF2F4;
}

.amtar-pd-head::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--pd-accent);
}

.amtar-pd-src {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #fff;
  background: var(--pd-accent);
  border-radius: 5px;
  padding: 2px 7px;
  margin-bottom: 7px;
}

.amtar-pd-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #16211F;
  line-height: 1.4;
}

.amtar-pd-head p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: #5b6067;
  line-height: 1.5;
}

.amtar-pd-close {
  position: absolute;
  inset-inline-end: 10px;
  top: 10px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .85);
  color: #16211F;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background .16s ease;
}

.amtar-pd-close:hover { background: #E2E8F0; }

/* --- القيمة الأبرز والإحصاءات --- */
.amtar-pd-key { padding: 13px 16px; border-bottom: 1px solid #EEF2F4; }

.amtar-pd-headline {
  font-size: 21px;
  font-weight: 800;
  color: #16211F;
  line-height: 1.2;
  letter-spacing: -.2px;
}

.amtar-pd-stats {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.amtar-pd-stat {
  flex: 1;
  background: #F8FAFC;
  border: 1px solid #EEF2F4;
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}

.amtar-pd-stat i {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: #5b6067;
  margin-bottom: 3px;
}

.amtar-pd-stat b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #16211F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- الصفوف --- */
.amtar-pd-rows { padding: 6px 16px 10px; }

.amtar-pd-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #F5F8F9;
}

.amtar-pd-row:last-child { border-bottom: 0; }
.amtar-pd-row span { color: #5b6067; flex: 0 0 auto; }
.amtar-pd-row b {
  color: #16211F;
  font-weight: 600;
  text-align: end;
  min-width: 0;
  word-break: break-word;
}

.amtar-pd-place {
  padding: 10px 16px;
  background: #F8FAFC;
  border-top: 1px solid #EEF2F4;
  font-size: 11.5px;
  font-weight: 600;
  color: #173F3A;
  line-height: 1.6;
}

.amtar-pd-extra { border-top: 1px solid #EEF2F4; padding: 12px 16px; background: #FCFDFD; }

.amtar-pd-extra h4 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #173F3A;
}

.amtar-pd-empty { font-size: 11.5px; color: #5b6067; }

.amtar-pd-foot { padding: 12px 16px 14px; border-top: 1px solid #EEF2F4; }

.amtar-pd-act {
  appearance: none;
  width: 100%;
  border: 0;
  background: #173F3A;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 11px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: filter .16s ease;
}

.amtar-pd-act:hover:not(:disabled) { filter: brightness(1.15); }
.amtar-pd-act:disabled { opacity: .6; cursor: default; }
.amtar-pd-act:focus-visible { outline: 2px solid #173F3A; outline-offset: 2px; }

@media (max-width: 800px) {
  .amtar-pd { width: min(290px, calc(100vw - 24px)); border-radius: 14px; }
  .amtar-pd-head { padding: 12px 14px 11px; }
  .amtar-pd-head h3 { font-size: 14px; }
  .amtar-pd-headline { font-size: 19px; }
  .amtar-pd-key, .amtar-pd-rows, .amtar-pd-place { padding-inline: 14px; }
}
