/* =========================================================
   theme-sheet.css — مظهر النافذة السفلية (BottomSheet) + محتوى تفاصيل المنطقة
   لا يغيّر الهيكل ولا الـ z-index (تبقى في bottom-sheet.css)
   ========================================================= */

:root {
  --bs-transition: transform 0.36s var(--ease-spring);
}

/* ─── الـ overlay: تعتيم أخضر خفيف + blur ─────────────────── */
.bs-overlay {
  background: rgba(23, 63, 48, 0.30);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* ─── الحاوية ─────────────────────────────────────────────── */
.bs {
  border-radius: 24px 24px 0 0;
  background: var(--color-cream);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-bottom: none;
  box-shadow: 0 -12px 40px rgba(23, 63, 48, 0.22), 0 -1px 0 rgba(255, 255, 255, 0.7) inset;
  font-family: var(--font, "Thmanyah", "Tajawal", system-ui, sans-serif);
  color: var(--color-text);
  /* مدة الإخفاء المتأخر تطابق مدة الانزلاق (0.36s) حتى لا يُقطع الإغلاق */
  transition: var(--bs-transition), visibility 0s linear 0.36s;
}
.bs--visible {
  transition: var(--bs-transition), visibility 0s;
}
@media (min-width: 768px) {
  .bs { max-width: 560px; }
}

/* ─── المقبض وزر الإغلاق ──────────────────────────────────── */
.bs__handle {
  padding: 10px 0 6px;
}
.bs__bar {
  width: 44px;
  height: 5px;
  background: rgba(36, 92, 69, 0.25);
  border-radius: 999px;
  opacity: 1;
  transition: width 0.2s var(--ease-out), background-color 0.2s ease;
}
.bs__handle:active .bs__bar {
  width: 56px;
  background: rgba(36, 92, 69, 0.5);
}
.bs__close {
  top: 10px;
  width: 34px;
  height: 34px;
  background: rgba(36, 92, 69, 0.08);
  color: var(--color-primary);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
@media (hover: hover) {
  .bs__close:hover { background: rgba(36, 92, 69, 0.16); }
}
.bs__close:active {
  background: var(--color-primary);
  color: #fff;
  transform: scale(0.9);
}
.bs__close:focus-visible {
  outline: 3px solid rgba(36, 92, 69, 0.35);
  outline-offset: 2px;
}

/* ─── المحتوى ─────────────────────────────────────────────── */
.bs__body {
  padding: 0 18px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px) + var(--bs-hidden, 0px));
  scrollbar-width: thin;
  scrollbar-color: var(--color-natural) transparent;
}
.bs__body::-webkit-scrollbar { width: 4px; }
.bs__body::-webkit-scrollbar-thumb { background: var(--color-natural); border-radius: 4px; }

/* العنوان محاذٍ للبداية (اليمين) وزر الإغلاق على اليسار */
.bs__title {
  margin: 2px 0 14px;
  padding-inline-end: 44px;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--color-dark);
  text-align: start;
}
.bs__subtitle {
  margin: -8px 0 14px;
  text-align: start;
  color: var(--c-text-muted);
}

/* ─── صندوق الإجمالي ──────────────────────────────────────── */
.tree-zone-total-box {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 18px;
  padding: 22px 16px 20px;
  background: linear-gradient(135deg, #2f7a5b 0%, var(--color-primary) 55%, var(--color-dark) 100%);
  border: none;
  border-radius: 22px;
  box-shadow: 0 12px 26px rgba(36, 92, 69, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-align: center;
}
/* دوائر زخرفية خفيفة (أوراق/تموّج) خلف المحتوى */
.tree-zone-total-box::before,
.tree-zone-total-box::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.tree-zone-total-box::before { width: 150px; height: 150px; top: -60px; inset-inline-end: -40px; }
.tree-zone-total-box::after  { width: 100px; height: 100px; bottom: -48px; inset-inline-start: -24px; background: rgba(164, 195, 162, 0.16); }

.tree-zone-total-num {
  margin: 0;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.tree-zone-total-lbl {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.88);
}

/* ─── تفصيل الأنواع ───────────────────────────────────────── */
.tree-zone-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* عنوان اختياري للقسم (يحتاج عنصراً HTML: <h4 class="tree-zone-section-title">الأنواع</h4>) */
.tree-zone-section-title {
  margin: 4px 0 8px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-primary);
}

.tree-zone-species-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid rgba(36, 92, 69, 0.08);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(23, 63, 48, 0.05), 0 4px 10px rgba(23, 63, 48, 0.04);
  transition: transform 0.15s var(--ease-out), background-color 0.15s ease;
}
.tree-zone-species-row:active {
  transform: scale(0.985);
  background: var(--color-bg-green);
}
.tz-species-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-text);
}
/* نقطة خضراء صغيرة قبل الاسم */
.tz-species-name::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-natural);
  box-shadow: 0 0 0 3px rgba(164, 195, 162, 0.28);
}
.tz-species-count {
  flex: none;
  min-width: 40px;
  padding: 3px 12px;
  background: var(--color-bg-green);
  color: var(--color-primary);
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.tree-zone-empty {
  margin: 8px 0;
  padding: 22px 16px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--c-text-muted);
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px dashed rgba(36, 92, 69, 0.2);
  border-radius: 16px;
}

/* دخول متدرّج للمحتوى عند فتح الشيت */
.bs--visible .tree-zone-total-box { animation: zoneRise 0.45s var(--ease-out) both; }
.bs--visible .tree-zone-species-row { animation: zoneRise 0.4s var(--ease-out) both; }
.bs--visible .tree-zone-species-row:nth-child(1) { animation-delay: 0.06s; }
.bs--visible .tree-zone-species-row:nth-child(2) { animation-delay: 0.10s; }
.bs--visible .tree-zone-species-row:nth-child(3) { animation-delay: 0.14s; }
.bs--visible .tree-zone-species-row:nth-child(4) { animation-delay: 0.18s; }
.bs--visible .tree-zone-species-row:nth-child(5) { animation-delay: 0.22s; }
.bs--visible .tree-zone-species-row:nth-child(n+6) { animation-delay: 0.26s; }
@keyframes zoneRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ─── النماذج داخل الشيت (تبنّي/بلاغ) بنفس الهوية ─────────── */
.sheet-form label {
  color: var(--color-dark);
  font-weight: 700;
}
.sheet-form input,
.sheet-form select,
.sheet-form textarea {
  border: 1.5px solid rgba(36, 92, 69, 0.16);
  border-radius: 14px;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sheet-form input:focus,
.sheet-form select:focus,
.sheet-form textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(36, 92, 69, 0.12);
}
.sheet-form .form-submit {
  padding: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2f7a5b, var(--color-primary));
  box-shadow: 0 8px 18px rgba(36, 92, 69, 0.28);
  transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.sheet-form .form-submit:active {
  transform: scale(0.97);
  box-shadow: 0 3px 8px rgba(36, 92, 69, 0.25);
}
.sheet-form .form-submit:disabled {
  background: #cfd8d2;
  box-shadow: none;
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .bs--visible .tree-zone-total-box,
  .bs--visible .tree-zone-species-row { animation: none !important; }
  :root { --bs-transition: transform 0.01ms; }
}

