/* 出席回覆表單 sheet（dialog） */

dialog {
  border: none;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
}

dialog::backdrop {
  background: rgba(36, 49, 43, 0.45);
}

.rsvp-dialog {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0;
  width: 100%;
  max-height: 88dvh;
  border-radius: 24px 24px 0 0;
  padding: 1.6rem 1.3rem calc(env(safe-area-inset-bottom, 0px) + 1.6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-out);
}

.rsvp-dialog[open] {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .rsvp-dialog {
    transition: opacity 0.2s linear;
    transform: none;
  }
}

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--gold-soft);
  margin: 0 auto 0.8rem;
}

.sheet-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: var(--touch);
  height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
}

.rsvp-dialog h2 {
  font-family: var(--font-serif-zh);
  font-size: 1.3rem;
  text-align: center;
  margin-bottom: 0.8rem;
}

.form-alert {
  background: #f6e3e1;
  color: var(--accent-red);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

#rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.field-label {
  font-size: 1rem;
  color: var(--sage);
}

.req {
  color: var(--accent-red);
  margin-left: 0.15rem;
}

.field input[type="text"],
.field input[type="tel"],
.field textarea,
#f-lookup-code {
  min-height: var(--touch);
  padding: 0.5rem 0.8rem;
  border: 1.4px solid var(--gold-soft);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}

.field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.char-count {
  align-self: flex-end;
  font-size: 0.75rem;
  color: var(--sage);
}

.field-group {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.side-cards,
.attend-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.side-card,
.attend-card {
  position: relative;
  min-height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.4px solid var(--gold-soft);
  border-radius: 12px;
  padding: 0.6rem;
  text-align: center;
  font-size: 1rem;
}

.side-card input,
.attend-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.side-card:has(input:checked),
.attend-card:has(input:checked) {
  border-color: var(--gold);
  background: var(--gold-soft);
  font-weight: 600;
}

.counts-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.counts-group[hidden] {
  display: none;
}

.stepper-field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-btn {
  width: var(--touch);
  height: var(--touch);
  border-radius: 50%;
  border: 1.4px solid var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage);
}

.stepper input[type="number"] {
  width: 2.6rem;
  font-size: 1rem;
  text-align: center;
  min-height: var(--touch);
  border: 1.4px solid var(--gold-soft);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.consent-field {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--sage);
}

.consent-field input {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 0.1rem;
  accent-color: var(--sage);
}

[aria-invalid="true"] {
  border-color: var(--accent-red) !important;
}

/* ---- 感謝頁 ---- */

.rsvp-view[hidden] {
  display: none !important;
}

#rsvp-view-thanks {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.thanks-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: check-pop 0.5s var(--ease-out);
}

@keyframes check-pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.edit-code-display {
  font-family: var(--font-en);
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-weight: 600;
}

.edit-code-display.copy-failed {
  user-select: all;
  -webkit-user-select: all;
}

.thanks-note {
  font-size: 1rem;
  color: var(--sage);
}

@media (prefers-reduced-motion: reduce) {
  .thanks-check { animation: none; }
}

/* ---- 隱私說明 dialog ---- */

.privacy-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(90vw, 360px);
  max-height: 80dvh;
  border-radius: 18px;
  padding: 1.6rem 1.3rem;
  overflow-y: auto;
}

.privacy-dialog h2 {
  font-family: var(--font-serif-zh);
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.privacy-dialog p {
  font-size: 1rem;
  color: var(--sage);
  line-height: 1.6;
  margin-bottom: 0.6rem;
}
