/* css/components/tree-sheet.css */

.tree-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-bottom-sheet, 1100);
  background: var(--store-sheet-bg, #fff);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: var(--tree-sheet-transition, transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1));
  height: 75vh;   /* احتياطي للمتصفحات القديمة */
  height: 75dvh;  /* يتكيّف تلقائياً مع ظهور/اختفاء شريط العنوان */
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  will-change: transform;
}

.tree-bottom-sheet.visible {
  transform: translateY(0);
}

/* Drag handle */
.tree-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 8px;
  cursor: grab;
  touch-action: pan-y;
  flex-shrink: 0;
}
.tree-sheet-handle:active {
  cursor: grabbing;
}
.handle-bar {
  width: 45px;
  height: 5px;
  background: var(--store-sheet-handle, #cbd5e1);
  border-radius: 4px;
  opacity: 0.8;
}

/* Content area
   --sheet-hidden: الجزء المخفي من الشيت أسفل الشاشة (يضبطه tree-sheet.js)،
   نضيفه للـ padding السفلي حتى تصل الأزرار الأخيرة إلى الجزء الظاهر.
   env(safe-area-inset-bottom) يحتاج viewport-fit=cover في وسم الـ viewport. */
.tree-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 20px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px) + var(--sheet-hidden, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  direction: rtl;
}

.tree-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}
.tree-logo {
  width: 50px;
  height: 50px;
  background: #e8f5e9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: var(--c-accent);
  flex-shrink: 0;
  overflow: hidden;
}
.tree-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: var(--c-text);
}

.tree-notes {
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 12px 0;
}

/* Action buttons */
.tree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 15px;
}
.action-btn {
  background: #f3f4f6;
  border: none;
  border-radius: 40px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.action-btn.share {
  background: var(--c-accent, #3498db);
  color: white;
  width: auto;
  margin-top: 0;
}
.action-btn:active { transform: scale(0.96); }

/* Responsive small screens */
@media (max-width: 480px) {
  .tree-actions { gap: 8px; }
  .action-btn { padding: 6px 10px; font-size: 0.75rem; }
  .tree-name { font-size: 1.1rem; }
}

@media (max-height: 700px) {
  .tree-name { font-size: 1.1rem; }
}

/* عداد المشاهدات */
.tree-view-counter {
  background: #f0f2f5;
  border-radius: 30px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: #2c3e50;
  display: inline-block;
  margin: 5px 0 10px;
  direction: ltr;
  text-align: center;
  width: fit-content;
}