/* HDFZ Sheets, Drawers & Overlays - iOS Native Polish */

/* 1. Modal Backdrop */
.hdfz-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--hdfz-duration-sheet) var(--hdfz-ease-transition);
}
.hdfz-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* 2. iOS BottomSheet */
.hdfz-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  max-height: 92vh;
  background: var(--hdfz-surface);
  border-top-left-radius: var(--hdfz-radius-card);
  border-top-right-radius: var(--hdfz-radius-card);
  box-shadow: var(--hdfz-shadow-sheet);
  border-top: 1px solid var(--hdfz-line);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateY(105%);
  transition: transform var(--hdfz-duration-sheet) var(--hdfz-ease-sheet);
  will-change: transform;
  touch-action: none;
}
.hdfz-bottom-sheet.is-open {
  transform: translateY(0);
}

/* Sheet Grabber Handle */
.sheet-grabber-wrap {
  width: 100%;
  padding: 12px 0 8px 0;
  display: flex;
  justify-content: center;
  cursor: grab;
}
.sheet-grabber {
  width: 36px;
  height: 5px;
  border-radius: var(--hdfz-radius-pill);
  background: var(--hdfz-line-strong);
}

/* Sheet Header */
.sheet-header {
  padding: 8px 22px 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hdfz-line);
}
.sheet-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hdfz-ink);
}
.sheet-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--hdfz-surface-muted);
  border: none;
  color: var(--hdfz-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sheet-close-btn:active {
  transform: scale(0.9);
}

/* Sheet Scroll Body */
.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  touch-action: pan-y;
}

.sheet-footer {
  padding: 16px 22px calc(env(safe-area-inset-bottom, 0px) + 16px) 22px;
  border-top: 1px solid var(--hdfz-line);
  background: var(--hdfz-surface);
  display: flex;
  gap: 12px;
}

/* 3. Floating Toast (Capsule) */
.hdfz-toast-wrap {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 1200;
  padding: 0 16px;
}
@media (min-width: 900px) {
  .hdfz-toast-wrap {
    bottom: 30px;
  }
}

.hdfz-toast {
  background: rgba(32, 46, 39, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: var(--hdfz-radius-pill);
  box-shadow: var(--hdfz-shadow-float);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.92rem;
  font-weight: 500;
  max-width: 90%;
  pointer-events: auto;
  transform: translateY(24px) scale(0.94);
  opacity: 0;
  transition: transform 0.28s var(--hdfz-ease-sheet), opacity 0.28s ease;
}
.hdfz-toast.is-show {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.hdfz-toast-undo {
  color: var(--hdfz-lime);
  font-weight: 700;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--hdfz-radius-pill);
}
.hdfz-toast-undo:active {
  opacity: 0.7;
}

/* 4. Context Menu / Popover */
.hdfz-popover-menu {
  position: absolute;
  background: var(--hdfz-surface);
  border-radius: var(--hdfz-radius-md);
  border: 1px solid var(--hdfz-line);
  box-shadow: var(--hdfz-shadow-float);
  padding: 6px;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  z-index: 1100;
  animation: popoverFadeIn 0.18s var(--hdfz-ease-transition);
}
@keyframes popoverFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.popover-item {
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--hdfz-radius-xs);
  border: none;
  background: transparent;
  color: var(--hdfz-ink);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  width: 100%;
}
.popover-item:hover {
  background: var(--hdfz-surface-muted);
}
.popover-item.is-danger {
  color: var(--hdfz-over);
}
