/* ==========================================================================
   DESIGN TOKENS & ROOT VARIABLES
   ========================================================================== */
:root {
  --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;

  /* Color Palette */
  --bg-page: #FBF9F5;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F6F4EE;
  --bg-card-backdrop: #F3EFE6;

  --text-main: #1C1E21;
  --text-muted: #5E6573;
  --text-light: #8E95A5;

  --border-subtle: #E8E5DC;
  --border-medium: #D5D0C3;
  --border-focus: #1C1E21;

  /* RSVP Response Colors */
  --yes-primary: #0F9D58;
  --yes-bg: #E8F7EE;
  --yes-border: #92D7AF;
  --yes-text: #0B6B3D;

  --maybe-primary: #D97706;
  --maybe-bg: #FEF3C7;
  --maybe-border: #FCD34D;
  --maybe-text: #92400E;

  --no-primary: #64748B;
  --no-bg: #F1F5F9;
  --no-border: #CBD5E1;
  --no-text: #334155;

  /* Brand Accents */
  --brand-gold: #B49651;
  --brand-gold-subtle: #F4EEDC;
  --brand-dark: #1E252B;

  /* Elevation */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 16px 36px -10px rgba(45, 35, 20, 0.12), 0 0 1px rgba(0, 0, 0, 0.15);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-badge {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--bg-surface-subtle);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   LAYOUT WRAPPER
   ========================================================================== */
.main-wrapper {
  max-width: 1100px;
  margin: 2.25rem auto 4.5rem;
  padding: 0 1.5rem;
  flex: 1;
}

.rsvp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

/* ==========================================================================
   INVITATION CARD CONTAINER (A4 / Letter Standard)
   ========================================================================== */
.card-column {
  position: sticky;
  top: 5rem;
  display: flex;
  justify-content: center;
}

.card-wrapper-panel {
  background: var(--bg-card-backdrop);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

/* The Invitation Card Box */
.invitation-card-box {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1.4142;
  /* A4 aspect ratio */
  cursor: default;
  outline: none;
  transition: border var(--transition-fast);
}

.invitation-card-box.drag-over {
  border: 2px dashed var(--yes-primary);
  background: #F4FAF6;
}

/* Placeholder card view */
.card-placeholder-view {
  width: 100%;
  height: 100%;
  padding: 1.25rem;
  display: flex;
  align-items: stretch;
}

.placeholder-border-outline {
  width: 100%;
  height: 100%;
  border: 2px dashed var(--border-medium);
  border-radius: 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 50%, #FAF8F4 0%, #F5F1E9 100%);
  padding: 1.5rem;
}

/* Corner registration marks */
.corner-accents .corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--brand-gold);
  border-style: solid;
}

.corner.tl {
  top: -2px;
  left: -2px;
  border-width: 2px 0 0 2px;
}

.corner.tr {
  top: -2px;
  right: -2px;
  border-width: 2px 2px 0 0;
}

.corner.bl {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 2px 2px;
}

.corner.br {
  bottom: -2px;
  right: -2px;
  border-width: 0 2px 2px 0;
}

.placeholder-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  max-width: 280px;
}

.placeholder-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: #EFE9DC;
  color: var(--brand-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.placeholder-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7D6B40;
  background: #EFE7D2;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.placeholder-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--text-main);
  line-height: 1.25;
}

.placeholder-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Uploaded card preview */
.card-live-preview {
  width: 100%;
  height: 100%;
}

.preview-media-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFF;
}

.preview-media-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-media-container object,
.preview-media-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   RIGHT COLUMN: RSVP & DETAILS
   ========================================================================== */
.details-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Event Metadata Card */
.event-meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
}

.event-type-tag {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-gold);
  margin-bottom: 0.35rem;
}

.event-title {
  font-family: var(--font-display);
  font-size: 2.15rem;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.event-datetime-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.datetime-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   RSVP CONTAINER & ATTENDANCE BUTTONS
   ========================================================================== */
.rsvp-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--text-main);
}

/* Three Large Attendance Buttons */
.attendance-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.btn-rsvp-choice {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  outline: none;
}

.btn-rsvp-choice .choice-label {
  display: flex;
  flex-direction: column;
}

.btn-rsvp-choice .choice-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.btn-rsvp-choice .choice-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-subtle);
  color: var(--text-light);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-rsvp-choice:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Choice Active / Selected States */
.btn-rsvp-choice.choice-yes.selected {
  background: var(--yes-bg);
  border-color: var(--yes-primary);
}

.btn-rsvp-choice.choice-yes.selected .choice-text {
  color: var(--yes-text);
}

.btn-rsvp-choice.choice-yes.selected .choice-icon {
  background: var(--yes-primary);
  color: #FFF;
}

.btn-rsvp-choice.choice-maybe.selected {
  background: var(--maybe-bg);
  border-color: var(--maybe-primary);
}

.btn-rsvp-choice.choice-maybe.selected .choice-text {
  color: var(--maybe-text);
}

.btn-rsvp-choice.choice-maybe.selected .choice-icon {
  background: var(--maybe-primary);
  color: #FFF;
}

.btn-rsvp-choice.choice-no.selected {
  background: var(--no-bg);
  border-color: var(--no-primary);
}

.btn-rsvp-choice.choice-no.selected .choice-text {
  color: var(--no-text);
}

.btn-rsvp-choice.choice-no.selected .choice-icon {
  background: var(--no-primary);
  color: #FFF;
}

/* ==========================================================================
   DYNAMIC RSVP FORM ACCORDION
   ========================================================================== */
.form-accordion {
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, margin-top 0.3s ease;
}

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

.form-accordion.expanded {
  max-height: 500px;
  opacity: 1;
  pointer-events: auto;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.required-star {
  color: #E11D48;
}

.label-with-hint {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-light);
}

.form-control {
  width: 100%;
  padding: 0.75rem 0.95rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  background: #FFF;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(28, 30, 33, 0.08);
}

.field-error {
  font-size: 0.78rem;
  color: #E11D48;
  margin-top: 0.35rem;
  font-weight: 500;
}

/* Guest Counter Stepper */
.stepper-widget {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.stepper-btn {
  background: transparent;
  border: none;
  padding: 0.65rem 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: background var(--transition-fast);
}

.stepper-btn:hover {
  background: #EAE6DC;
}

.stepper-input {
  width: 54px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
}

/* Form Actions */
.form-actions {
  margin-top: 1.5rem;
}

.btn-submit-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--brand-dark);
  color: #FFF;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.95rem 1.5rem;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-submit-primary:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

/* ==========================================================================
   RSVP CONFIRMATION CARD (Post-submit state)
   ========================================================================== */
.rsvp-confirmation-card {
  text-align: center;
  padding: 1.75rem 1rem;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  border-radius: var(--radius-md);
  animation: fadeIn 0.4s ease;
}

.rsvp-confirmation-card.state-yes {
  background: var(--yes-bg);
  border: 1px solid var(--yes-border);
}

.rsvp-confirmation-card.state-yes .confirmation-icon-circle {
  background: var(--yes-primary);
  color: #FFF;
}

.rsvp-confirmation-card.state-yes .confirmation-heading {
  color: var(--yes-text);
}

.rsvp-confirmation-card.state-maybe {
  background: var(--maybe-bg);
  border: 1px solid var(--maybe-border);
}

.rsvp-confirmation-card.state-maybe .confirmation-icon-circle {
  background: var(--maybe-primary);
  color: #FFF;
}

.rsvp-confirmation-card.state-maybe .confirmation-heading {
  color: var(--maybe-text);
}

.rsvp-confirmation-card.state-no {
  background: var(--no-bg);
  border: 1px solid var(--no-border);
}

.rsvp-confirmation-card.state-no .confirmation-icon-circle {
  background: var(--no-primary);
  color: #FFF;
}

.rsvp-confirmation-card.state-no .confirmation-heading {
  color: var(--no-text);
}

.confirmation-icon-circle {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.confirmation-heading {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.25;
}

.confirmation-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 380px;
}

.confirmation-summary-badge {
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-full);
  margin-top: 0.25rem;
}

.btn-edit-rsvp {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-edit-rsvp:hover {
  background: #FFF;
  border-color: var(--text-main);
  transform: translateY(-1px);
}

/* ==========================================================================
   LOCATION CARD
   ========================================================================== */
.location-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
}

.location-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.location-icon-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

.location-subtitle {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-light);
}

.location-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.location-body {
  margin-bottom: 1.25rem;
}

.venue-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.venue-address {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.location-actions-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-view-map {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--yes-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-view-map:hover {
  background: #E8F7EE;
  border-color: var(--yes-border);
  transform: translateY(-1px);
}

/* Add to Calendar Dropdown */
.calendar-dropdown-wrapper {
  position: relative;
}

.btn-add-calendar {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-calendar:hover {
  background: #EAE6DC;
  border-color: var(--border-medium);
}

.calendar-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 190px;
  z-index: 40;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
}

.calendar-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.85rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.calendar-menu-item:hover {
  background: var(--bg-surface-subtle);
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--brand-dark);
  color: #FFF;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 200;
  animation: slideUp 0.3s ease;
}

/* ==========================================================================
   ANIMATIONS & MEDIA QUERIES
   ========================================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tablet & Mobile Breakpoints */
@media (max-width: 960px) {
  .rsvp-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .card-column {
    position: static;
  }

  .card-wrapper-panel {
    max-width: 500px;
  }
}

@media (max-width: 540px) {
  .main-wrapper {
    padding: 0 1rem;
    margin: 1.25rem auto 3rem;
  }

  .event-title {
    font-size: 1.75rem;
  }

  .event-meta-card,
  .rsvp-container-card,
  .location-card {
    padding: 1.25rem 1.25rem;
  }

  .attendance-buttons {
    grid-template-columns: 1fr;
  }

  .btn-rsvp-choice {
    padding: 0.85rem 1rem;
  }

  .location-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-view-map,
  .btn-add-calendar {
    justify-content: center;
    width: 100%;
  }

  .calendar-menu {
    width: 100%;
  }
}