/* The RSVP form (components/rsvp-form.js). Its .form-group and .submit-btn
   are reused by the role proposal. */

/* Slim, faint scrollbar over the cream form; the transparent border
   keeps the visible thumb thinner than its hit area and off the edge.
   Bottom inset clears the card's rounded corner. */
.rsvp-body::-webkit-scrollbar {
  width: 10px;
}

.rsvp-body::-webkit-scrollbar-track {
  background: transparent;
  margin-top: 8px;
  margin-bottom: 24px;
}

.rsvp-body::-webkit-scrollbar-thumb {
  background: rgba(99, 107, 47, 0.18);
  background-clip: padding-box;
  border: 3px solid transparent;
  border-radius: 10px;
}

.rsvp-body::-webkit-scrollbar-thumb:hover {
  background-color: rgba(99, 107, 47, 0.45);
}

.rsvp-body::-webkit-scrollbar-button {
  display: none;
}

/* Firefox (Chrome 121+ ignores ::-webkit-scrollbar if these are set, so gate them) */
@supports not selector(::-webkit-scrollbar) {
  .rsvp-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 107, 47, 0.25) transparent;
  }
}

/* Header band */
.rsvp-header {
  position: relative;
  flex-shrink: 0;
  z-index: 2;
  text-align: center;
  padding: 0.6rem 2rem 1.7rem;
  color: var(--cream);
  background: linear-gradient(155deg, var(--olive-deep), var(--olive) 130%);
  overflow: hidden;
}

.rsvp-header::before {
  content: "";
  position: absolute;
  inset: -60% -20% auto -20%;
  height: 150%;
  background: radial-gradient(closest-side, rgba(219, 164, 0, 0.28), transparent 70%);
  pointer-events: none;
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 10px;
  background: rgba(251, 246, 235, 0.4);
  margin: 12px auto 6px;
}

@media (min-width: 640px) {
  .sheet-handle {
    display: none;
  }
}

.rsvp-icon {
  position: relative;
  width: 44px;
  height: 44px;
  margin: 0.4rem auto 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(251, 246, 235, 0.12);
  border: 1px solid rgba(219, 164, 0, 0.55);
  color: var(--gold);
}

.rsvp-icon svg {
  width: 20px;
  height: 20px;
}

.rsvp-eyebrow {
  position: relative;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.4rem;
}

.rsvp-title {
  position: relative;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 2.5rem);
  margin: 0 0 0.35rem;
  color: var(--cream);
}

.rsvp-sub {
  position: relative;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: rgba(251, 246, 235, 0.78);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

.rsvp-thankyou {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.25rem 1.5rem;
  color: var(--cream);
  background: linear-gradient(155deg, var(--olive-deep), var(--olive) 130%);
  border-radius: 26px;
  animation: rsvp-thankyou-in 0.4s ease;
}

.rsvp-thankyou.is-visible {
  display: flex;
}

.rsvp-thankyou .rsvp-icon {
  margin: 0 auto 1rem;
}

.rsvp-thankyou .rsvp-sub {
  max-width: 420px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--cream);
}

.rsvp-thankyou .rsvp-thankyou-note {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  color: rgba(251, 246, 235, 0.88);
}

.rsvp-thankyou-close {
  margin-top: 1.5rem;
  padding: 0.75em 1.8em;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.rsvp-sub-date {
  display: inline-block;
  margin-top: 0.35rem;
  white-space: nowrap;
}

/* Frozen-invite subtitle: a solid sienna pill so the lock reads at a glance
   against the olive header. The cream ring keeps sienna from muddying into
   the olive (the two sit close in luminance). */
.locked-chip {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--sienna);
  border: 1px solid rgba(251, 246, 235, 0.55);
  color: var(--cream);
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.locked-contact {
  display: block;
  margin-top: 0.55rem;
  color: var(--cream);
}

/* Keyboard-open state (mobile): collapse the olive header band down to a
   compact title bar so the form gets that vertical real estate. The header
   is sticky, so on browsers that never resize the viewport for the
   keyboard (Messenger's WebView) it would otherwise eat the top of the
   only visible strip the guest has left. */
.rsvp-header {
  transition: padding 0.3s ease;
}

.rsvp-icon,
.rsvp-eyebrow,
.rsvp-sub,
.rsvp-title {
  transition: opacity 0.25s ease, height 0.3s ease, margin 0.3s ease, font-size 0.3s ease;
}

@media (max-width: 639px) {
  .modal.keyboard-open .rsvp-header {
    padding-top: 0;
    padding-bottom: 0.7rem;
  }

  .modal.keyboard-open .rsvp-icon,
  .modal.keyboard-open .rsvp-eyebrow,
  .modal.keyboard-open .rsvp-sub {
    height: 0;
    margin-top: 0;
    margin-bottom: 0;
    opacity: 0;
    overflow: hidden;
    border-width: 0;
    pointer-events: none;
  }

  .modal.keyboard-open .rsvp-title {
    font-size: 1.4rem;
    margin: 0;
  }

  /* Fallback for browsers that don't resize the viewport for the keyboard
     (Messenger's WebView). We get no signal about the keyboard's height,
     so anchor the card to the top of the screen and cap it to the upper
     portion — above where an Android keyboard typically sits — and let the
     card's own scrolling reach the rest of the fields. Only applied when
     we've detected the viewport did NOT respond. */
  .modal.keyboard-open.kb-fallback {
    align-items: flex-start;
  }

  .modal.keyboard-open.kb-fallback .modal-content {
    max-height: calc(var(--vvh) * 0.54);
    border-radius: 0 0 26px 26px;
  }
}

/* Body / form */
.rsvp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background-color: var(--cream);
  padding: 1.7rem 1.7rem 2rem;
}

@media (min-width: 640px) {
  .rsvp-body {
    padding: 2rem 2.4rem 2.4rem;
  }
}

.rsvp-seats-note {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--olive-deep);
  text-align: left;
  margin: 0 0 1.25rem;
}

.rsvp-seats-note strong {
  font-weight: 700;
  color: var(--olive);
}

.decline-message {
  display: none;
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--sienna);
  text-align: left;
  background: rgba(166, 63, 0, 0.07);
  border-radius: 12px;
  padding: 0.75em 1em;
  margin: -0.4rem 0 1.25rem;
}

/* The party lists grow with the invite, so they can't share the 300px
   cap the collapsible form groups use — that clipped guests past ~6
   (and open-seat guest cards past ~2). */
#otherGuestsGroup,
#partyMemberGroup {
  max-height: none;
}

#othersDeclineMessage {
  margin-top: 0;
}

#othersDeclineMessage.is-joyful {
  color: #8A6500;
  background: rgba(219, 164, 0, 0.14);
}

.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
  overflow: hidden;
  max-height: 300px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.35s ease;
}

.form-group.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.form-group label,
.segment-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  color: var(--charcoal-soft);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--olive);
  opacity: 0.6;
  pointer-events: none;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group textarea {
  width: 100%;
  padding: 0.85em 1em 0.85em 2.6em;
  border: 1.5px solid rgba(75, 81, 36, 0.14);
  border-radius: 14px;
  background-color: var(--cream-2);
  font-family: var(--font-body);
  font-size: 0.94rem;
  color: var(--charcoal);
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.form-group textarea {
  padding-left: 1em;
  resize: vertical;
  min-height: 64px;
}

.form-group textarea.short-field {
  min-height: 40px;
}

.form-group input.short-field {
  padding-top: 0.55em;
  padding-bottom: 0.55em;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--sienna);
  background-color: var(--cream);
  box-shadow: 0 0 0 4px rgba(166, 63, 0, 0.1);
}

/* Segmented attendance control */
.segmented {
  display: flex;
  gap: 0.6rem;
}

.segment-item {
  position: relative;
  flex: 1;
  display: flex;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8em 0.5em;
  border-radius: 14px;
  border: 1.5px solid rgba(75, 81, 36, 0.14);
  background: var(--cream-2);
  color: var(--charcoal-soft);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.segment svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.segment:hover {
  border-color: rgba(166, 63, 0, 0.4);
}

.segmented input:checked + .segment {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--cream);
  box-shadow: 0 6px 16px rgba(99, 107, 47, 0.28);
}

.segmented input#att-no:checked + .segment {
  background: var(--sienna);
  border-color: var(--sienna);
  box-shadow: 0 6px 16px rgba(166, 63, 0, 0.25);
}

.segmented input:focus-visible + .segment {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Guest stepper */
.stepper {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 168px;
  border: 1.5px solid rgba(75, 81, 36, 0.14);
  border-radius: 14px;
  overflow: hidden;
  background: var(--cream-2);
}

.stepper-btn {
  width: 42px;
  border: none;
  background: transparent;
  color: var(--olive);
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.stepper-btn:hover {
  background: rgba(99, 107, 47, 0.12);
}

.stepper-btn:active {
  color: var(--sienna);
}

.stepper input {
  border: none;
  background: transparent;
  text-align: center;
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--charcoal);
  appearance: textfield;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Submit Button */
.submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, var(--olive), var(--olive-mid));
  color: var(--cream);
  border: none;
  padding: 1em 1.5em;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 0.4rem;
  transition: all 0.3s ease;
  box-shadow: 0 10px 26px rgba(99, 107, 47, 0.32);
}

.submit-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.25s ease;
}

.submit-btn:hover {
  background: linear-gradient(135deg, var(--sienna), #8a3400);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(166, 63, 0, 0.32);
}

.submit-btn:hover svg {
  transform: translateX(3px);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.submit-btn:disabled:hover {
  background: linear-gradient(135deg, var(--olive), var(--olive-mid));
}


.segmented .segment.is-selected {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--cream);
  box-shadow: 0 6px 16px rgba(99, 107, 47, 0.28);
}

.segmented .segment.attend-no.is-selected {
  background: var(--sienna);
  border-color: var(--sienna);
  box-shadow: 0 6px 16px rgba(166, 63, 0, 0.25);
}

.other-guests-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.other-guest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px dotted rgba(75, 81, 36, 0.3);
}

.other-guest-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.other-guest-name {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--charcoal);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guest-attend-toggle {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.guest-attend-btn {
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--charcoal-soft);
  background: var(--cream-2);
  border: 1.5px solid rgba(75, 81, 36, 0.14);
  border-radius: 999px;
  padding: 0.5em 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.guest-attend-btn:hover {
  border-color: rgba(166, 63, 0, 0.4);
}

.guest-attend-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.guest-attend-btn.attend-yes.is-selected {
  background: var(--olive);
  border-color: var(--olive);
  color: var(--cream);
  box-shadow: 0 4px 12px rgba(99, 107, 47, 0.28);
}

.guest-attend-btn.attend-no.is-selected {
  background: var(--sienna);
  border-color: var(--sienna);
  color: var(--cream);
  box-shadow: 0 4px 12px rgba(166, 63, 0, 0.25);
}

/* Suggested replacements: only on invites that don't require the main
   guest, and only once someone is marked "No". Like the party
   list, it grows with each row, so it can't keep the 300px cap. */
#replacementGroup {
  max-height: none;
}

.replacement-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.replacement-list:not(:empty) {
  margin-bottom: 0.75rem;
}

.replacement-row {
  border: 1.5px dashed rgba(75, 81, 36, 0.25);
  border-radius: 14px;
  padding: 0.75rem;
}

.replacement-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.replacement-row-title {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal-soft);
}

.replacement-remove {
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sienna);
  background: none;
  border: none;
  padding: 0.3em 0;
  cursor: pointer;
}

.replacement-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.form-group .replacement-fields input[type="text"] {
  padding: 0.55em 1em;
}

.replacement-fields .replacement-nickname {
  grid-column: 1 / -1;
}

.add-replacement-btn {
  display: block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--olive-deep);
  background: var(--cream-2);
  border: 1.5px dashed rgba(75, 81, 36, 0.35);
  border-radius: 14px;
  padding: 0.85em 1em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-replacement-btn:hover {
  border-color: rgba(166, 63, 0, 0.4);
  color: var(--sienna);
}

.add-replacement-btn[hidden] {
  display: none;
}

.replacement-note {
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--charcoal-soft);
  margin: 0.6rem 0 0;
}

.replacement-note .deadline-highlight {
  white-space: nowrap;
}

.replacement-note[hidden] {
  display: none;
}

.returning-status {
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--olive-deep);
  min-height: 1.2em;
  margin: 0.7rem 0 0;
}

.returning-status.is-error {
  color: var(--sienna);
}

/* Frozen invite: the admin has locked this RSVP, so every control stays
   visible (showing the saved answers) but can't be changed. */
.rsvp-body.is-frozen .segment,
.rsvp-body.is-frozen textarea {
  cursor: not-allowed;
  opacity: 0.6;
}
