/* Fruit Up reusable bottom-sheet motion system */
body.fruit-up-sheet-open { overflow: hidden; }

.fruit-up-bottom-sheet {
  position: fixed;
  inset: auto 0 0;
  width: 100%;
  max-width: none;
  max-height: 94dvh;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.fruit-up-bottom-sheet::backdrop {
  background: rgba(11, 20, 14, .58);
  animation: fruit-up-sheet-backdrop-in var(--motion-duration-quick) var(--motion-ease-enter) both;
}

.fruit-up-sheet-surface {
  --fruit-up-sheet-drag-y: 0px;
  width: min(720px, 100%);
  max-height: min(90dvh, 860px);
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(145, 165, 151, .45);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 -24px 70px rgba(12, 25, 16, .28);
  transform: translateY(var(--fruit-up-sheet-drag-y));
  touch-action: pan-y;
  will-change: transform;
}

.fruit-up-bottom-sheet[open] .fruit-up-sheet-surface {
  animation: fruit-up-sheet-in var(--motion-duration-large) var(--motion-spring-soft-easing) both;
}

.fruit-up-bottom-sheet.is-closing .fruit-up-sheet-surface {
  animation: fruit-up-sheet-out var(--motion-duration-standard) var(--motion-ease-exit) both;
}

.fruit-up-bottom-sheet.is-dragging .fruit-up-sheet-surface {
  transition: none;
}

.fruit-up-bottom-sheet.is-snapping .fruit-up-sheet-surface {
  transition: transform var(--motion-duration-standard) var(--motion-spring-soft-easing);
}

.fruit-up-sheet-handle {
  width: 54px;
  min-height: 44px;
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  align-self: center;
  margin: 0 auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.fruit-up-sheet-handle::after {
  content: "";
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: #c6cec8;
}

.fruit-up-sheet-handle:active { cursor: grabbing; }

.fruit-up-sheet-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.fruit-up-sheet-header h2 { margin: 2px 0 0; font-size: clamp(1.35rem, 5vw, 1.85rem); }
.fruit-up-sheet-header p { margin: 0; color: var(--muted); line-height: 1.4; }
.fruit-up-sheet-close {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--soft);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.fruit-up-sheet-content {
  min-height: 0;
  padding: 18px 20px max(22px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.fruit-up-sheet-content > :first-child { margin-top: 0; }
.fruit-up-sheet-content > :last-child { margin-bottom: 0; }
.fruit-up-sheet-content .community-composer { margin: 0; border: 0; box-shadow: none; }

.fruit-up-sheet-actions,
.fruit-up-sheet-choice-list {
  display: grid;
  gap: 10px;
}

.fruit-up-sheet-choice {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--soft);
  text-align: left;
  cursor: pointer;
}

.fruit-up-sheet-choice[aria-pressed="true"],
.fruit-up-sheet-choice.selected {
  border-color: #91b52d;
  background: #effacb;
  box-shadow: 0 0 0 3px rgba(185, 229, 49, .17);
}
.fruit-up-sheet-close:focus-visible,
.fruit-up-sheet-choice:focus-visible {
  outline: 3px solid rgba(255, 94, 0, .38);
  outline-offset: 2px;
}

.fruit-up-sheet-choice-icon { font-size: 1.4rem; }
.fruit-up-sheet-choice-copy { display: grid; gap: 2px; }
.fruit-up-sheet-choice-copy small { color: var(--muted); line-height: 1.35; }
.fruit-up-sheet-check { color: #486508; font-weight: 950; }
.fruit-up-sheet-empty { padding: 20px; border-radius: 16px; background: var(--soft); text-align: center; }
.fruit-up-sheet-member-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.fruit-up-sheet-member-row:last-child { border-bottom: 0; }
.fruit-up-sheet-member-copy { min-width: 0; display: grid; gap: 2px; }
.fruit-up-sheet-member-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fruit-up-sheet-member-copy small { color: var(--muted); }

html[data-theme="dark"] .fruit-up-sheet-surface {
  color: var(--ink);
  border-color: var(--fruit-up-orange-border, #bf7042);
  background: linear-gradient(165deg, var(--fruit-up-orange-raised, #542814) 0%, var(--fruit-up-orange-surface, #462414) 62%, var(--fruit-up-orange-field, #321b11) 100%);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255, 178, 124, .12);
}
html[data-theme="dark"] .fruit-up-sheet-header { border-color: rgba(255, 174, 116, .24); }
html[data-theme="dark"] .fruit-up-sheet-handle::after { background: #df9160; }
html[data-theme="dark"] .fruit-up-sheet-close {
  color: #fff7f1;
  border-color: #a65d32;
  background: #321b12;
}
html[data-theme="dark"] .fruit-up-sheet-content :where(input, select, textarea) {
  color: #fff9f4;
  border-color: #a65d32;
  background: #321b12;
}
html[data-theme="dark"] .fruit-up-sheet-content :where(.community-composer, .notification-opt-in-panel, .reminder-preferences-panel, .choice, .button.secondary, .fruit-up-sheet-empty) {
  color: #fff7f0;
  border-color: #a65d32;
  background: var(--fruit-up-orange-surface, #462414);
}
html[data-theme="dark"] .fruit-up-sheet-content :where(input, textarea)::placeholder { color: #e6bca6; }
html[data-theme="dark"] .fruit-up-sheet-choice { color: var(--ink); border-color: #9a552e; background: var(--fruit-up-orange-surface, #462414); }
html[data-theme="dark"] .fruit-up-sheet-choice[aria-pressed="true"],
html[data-theme="dark"] .fruit-up-sheet-choice.selected { color: #fff7ef; border-color: #ff9254; background: #6b341a; }
html[data-theme="dark"] .fruit-up-sheet-check { color: #ffb184; }

@keyframes fruit-up-sheet-in {
  from { transform: translateY(104%); opacity: .82; }
  to { transform: translateY(var(--fruit-up-sheet-drag-y)); opacity: 1; }
}

@keyframes fruit-up-sheet-out {
  from { transform: translateY(var(--fruit-up-sheet-drag-y)); opacity: 1; }
  to { transform: translateY(104%); opacity: .82; }
}

@keyframes fruit-up-sheet-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 721px) {
  .fruit-up-bottom-sheet { padding-inline: 18px; }
  .fruit-up-sheet-surface { margin-bottom: 14px; border-bottom: 1px solid rgba(145, 165, 151, .45); border-radius: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .fruit-up-sheet-surface {
    --fruit-up-sheet-drag-y: 0px !important;
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }

  .fruit-up-bottom-sheet::backdrop,
  .fruit-up-bottom-sheet[open] .fruit-up-sheet-surface,
  .fruit-up-bottom-sheet.is-closing .fruit-up-sheet-surface {
    animation: none !important;
  }
  .fruit-up-bottom-sheet.is-snapping .fruit-up-sheet-surface { transition: none !important; }
}
