*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --going:      #16a34a;
  --going-bg:   #dcfce7;
  --maybe:      #d97706;
  --maybe-bg:   #fef3c7;
  --declining:  #dc2626;
  --declining-bg:#fee2e2;
  --primary:    #7c3aed;
  --primary-soft:#a78bfa;
  --primary-bg: #f5f3ff;
  --accent:     #ec4899;
  --bg:         #fdf4ff;
  --card:       #ffffff;
  --text:       #1e1b4b;
  --muted:      #6b7280;
  --border:     #ece9f7;
  --radius:     20px;
  --radius-sm:  12px;
  --shadow:     0 8px 28px rgba(88, 28, 135, 0.08), 0 2px 6px rgba(88, 28, 135, 0.05);
  --shadow-lg:  0 20px 40px rgba(88, 28, 135, 0.12);
}

body {
  font-family: 'Nunito', ui-rounded, -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Segoe UI', system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, #fce7f3 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, #ede9fe 0%, transparent 60%),
    linear-gradient(180deg, #fdf4ff 0%, #fff 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

/* ── HERO ── */
.hero {
  width: 100%;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #f3e8ff;
}
.hero img {
  width: 100%;
  max-width: 600px;
  display: block;
  object-fit: contain;
}

/* ── EVENT INFO ── */
.event-info {
  max-width: 540px;
  margin: 0 auto;
  padding: 24px 20px 0;
  text-align: center;
}
.event-info h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}
.event-date, .event-address {
  font-size: 1.1rem;
  color: var(--text);
  margin: 6px 0;
}

/* ── RSVP SECTION ── */
.rsvp-section {
  max-width: 540px;
  margin: 24px auto 40px;
  padding: 0 20px;
}
.rsvp-section h2 {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.status-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  text-align: center;
  line-height: 1.2;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(88, 28, 135, 0.08);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(88, 28, 135, 0.14); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-going    { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); color: #fff; }
.btn-maybe    { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); color: #fff; }
.btn-declining{ background: linear-gradient(135deg, #f87171 0%, #dc2626 100%); color: #fff; }
.btn-submit   { background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); color: #fff; width: 100%; font-size: 1.05rem; padding: 15px; margin-top: 8px; }
.btn-directions { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; }
.btn-add      { background: var(--primary-bg); color: var(--primary); padding: 8px 14px; font-size: 0.88rem; border: 1.5px solid transparent; box-shadow: none; }
.btn-add:hover { background: #ede9fe; }
.btn-outline  { background: #fff; color: var(--primary); border: 1.5px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.btn-outline:hover { background: var(--primary-bg); border-color: var(--primary-soft); }
.btn-danger   { background: linear-gradient(135deg, #f87171 0%, #dc2626 100%); color: #fff; }

.btn.selected {
  box-shadow: 0 0 0 4px rgba(124,58,237,0.25), 0 6px 16px rgba(88, 28, 135, 0.18);
  transform: translateY(-1px);
}

/* ── RSVP FORM ── */
.rsvp-form {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
  margin-top: 20px;
}
.rsvp-form.hidden { display: none; }

.form-status-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  text-align: center;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="password"],
.field input[type="datetime-local"],
.field input[type="file"] {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
  background: #fafaff;
  color: var(--text);
}
.field input:hover { border-color: #d4d1e8; }
.field input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.guest-section {
  background: linear-gradient(135deg, #faf5ff 0%, #fdf2f8 100%);
  border: 1px solid #f3e8ff;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.guest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 10px;
}
.guest-list { display: flex; flex-direction: column; gap: 8px; }
.guest-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.guest-input-row input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
.guest-input-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.guest-input-row button {
  background: none;
  border: none;
  color: var(--declining);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
}

/* ── ERROR ── */
.error-msg {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 20px;
  font-weight: 600;
  text-align: center;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* ── THANKS PAGE ── */
.thanks-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.thanks-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 44px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.thanks-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, #f59e0b 100%);
}
.thanks-emoji { font-size: 4.5rem; margin-bottom: 16px; animation: pop 0.5s ease-out; }
@keyframes pop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.thanks-card h1 {
  font-size: 2.1rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.thanks-card p { font-size: 1.1rem; margin: 8px 0; }
.thanks-date { color: var(--muted); }
.thanks-footer { margin-top: 20px; font-size: 1.2rem; }
.thanks-address { color: var(--muted); font-size: 0.95rem; margin-top: 8px; }

/* ── ADMIN ── */
.admin-page { background: #f8f9fb; }

.admin-header {
  background: var(--primary);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header h1 { font-size: 1.4rem; color: #fff; }
.admin-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-header .btn-outline { background: transparent; border-color: rgba(255,255,255,0.7); color: #fff; box-shadow: none; }
.admin-header .btn-outline:hover { background: rgba(255,255,255,0.18); border-color: #fff; }
.back-link { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.9rem; display: block; margin-bottom: 4px; }
.back-link:hover { color: #fff; }
.admin-header p { color: rgba(255,255,255,0.85); font-size: 0.95rem; }

.admin-main { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }

/* Admin login card */
.admin-login-card {
  max-width: 360px;
  margin: 80px auto 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 28px;
  text-align: center;
}
.admin-login-card h1 { font-size: 1.6rem; margin-bottom: 24px; }

/* Event cards */
.event-cards { display: flex; flex-direction: column; gap: 20px; }
.event-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.event-card-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  object-position: top;
}
.event-card-body { padding: 20px; }
.event-card-body h2 { font-size: 1.3rem; margin-bottom: 6px; }
.event-card-date { color: var(--muted); margin-bottom: 4px; }
.event-card-url { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
.event-card-url a { color: var(--primary); }

.rsvp-counts { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.count { font-weight: 600; font-size: 0.95rem; }
.count.going { color: var(--going); }
.count.maybe { color: var(--maybe); }
.count.declining { color: var(--declining); }

.event-card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.event-card-actions .btn { padding: 10px 18px; font-size: 0.9rem; }

/* Summary bar */
.summary-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.summary-item { text-align: center; min-width: 80px; }
.summary-num { display: block; font-size: 2rem; font-weight: 800; }
.summary-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.summary-item.going .summary-num   { color: var(--going); }
.summary-item.maybe .summary-num   { color: var(--maybe); }
.summary-item.declining .summary-num { color: var(--declining); }
.summary-item.total .summary-num   { color: var(--primary); }

/* RSVP table */
.rsvp-table-wrap { overflow-x: auto; }
.rsvp-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.rsvp-table th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rsvp-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 0.95rem; }
.rsvp-table tr:last-child td { border-bottom: none; }
.rsvp-table tr:hover td { background: #faf5ff; }
.rsvp-row-going td:first-child   { border-left: 4px solid var(--going); }
.rsvp-row-maybe td:first-child   { border-left: 4px solid var(--maybe); }
.rsvp-row-declining td:first-child { border-left: 4px solid var(--declining); }
.rsvp-date { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

/* Create/Edit form */
.create-form {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  max-width: 600px;
}
.hint { font-size: 0.82rem; color: var(--muted); display: block; margin-top: 4px; }
.slug-preview { display: flex; align-items: center; gap: 0; }
.slug-base { background: #f3f4f6; padding: 13px 10px 13px 14px; border: 2px solid #e5e7eb; border-right: none; border-radius: 10px 0 0 10px; font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.slug-preview input { border-radius: 0 10px 10px 0; }

.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.form-actions .btn { min-width: 140px; text-align: center; }

.current-image { margin-bottom: 12px; }
.current-image img { max-width: 200px; border-radius: 8px; display: block; margin-bottom: 6px; }
.current-image span { font-size: 0.85rem; color: var(--muted); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 1.1rem;
}
.empty-state a { color: var(--primary); font-weight: 600; }

/* Responsive */
@media (min-width: 600px) {
  .event-card { flex-direction: row; }
  .event-card-img { width: 200px; max-height: none; object-fit: cover; }
  .event-cards { gap: 16px; }
}

/* ── Event page polish ── */
.event-shell {
  max-width: 620px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.event-shell .hero {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #fff;
  max-height: none;
  padding: 0;
  border: 1px solid var(--border);
}
.event-shell .hero img {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}
.event-card-main {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 32px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.event-card-main::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, #f59e0b 100%);
}
.event-title {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 18px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.event-date, .event-address {
  font-size: 1.05rem;
  color: var(--text);
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 600;
}
.event-address { color: var(--muted); font-weight: 500; }
.event-date .ico, .event-address .ico {
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-bg);
  flex-shrink: 0;
}
.event-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}
.event-actions .btn { padding: 10px 18px; font-size: 0.92rem; }

.rsvp-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 32px 28px;
  margin: 0;
  max-width: none;
}
.rsvp-section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}

.questions-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px 28px;
  text-align: center;
}
.questions-section h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.questions-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.questions-actions .btn { flex: 1 1 140px; }

.status-buttons { gap: 12px; margin-bottom: 0; }
.status-buttons .btn {
  flex: 1;
  min-width: 120px;
  padding: 16px 14px;
  font-size: 1rem;
}

/* ── Flyer (print-friendly) ── */
.flyer-page { background: #f3f4f6; padding: 0; margin: 0; }
.flyer-toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.flyer-sheet {
  width: 8.5in;
  min-height: 11in;
  margin: 20px auto;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25in;
  overflow: hidden;
}
.flyer-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 10.5in;
  object-fit: contain;
}
.flyer-fallback { text-align: center; padding: 40px; }
.flyer-fallback h1 { font-size: 3rem; color: var(--primary); margin-bottom: 20px; }
.flyer-fallback p { font-size: 1.4rem; margin: 10px 0; }

@media print {
  .no-print { display: none !important; }
  body.flyer-page { background: #fff; }
  .flyer-sheet {
    width: 100%;
    min-height: auto;
    margin: 0;
    box-shadow: none;
    padding: 0;
  }
  .flyer-img { max-height: 10.5in; }
}

@media (max-width: 9in) {
  .flyer-sheet { width: 100%; min-height: auto; box-shadow: none; margin: 0; }
}

/* ── Thanks page extras ── */
.thanks-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 16px;
}
.thanks-actions .btn { width: 100%; }
.thanks-footer-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Admin headcount ── */
.headcount-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 14px;
  padding-top: 2px;
}
.headcount-row strong { color: var(--muted); font-weight: 600; }

.headcount-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  background: #f5f3ff;
  border: 2px solid #e9d5ff;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 28px;
  font-size: 1rem;
}
.headcount-bar strong { color: var(--primary); }
.headcount-pill {
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.headcount-pill.headcount-total { background: var(--primary); color: #fff; }

/* ── Form row (admin) ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field-row .field { margin-bottom: 4px; }
@media (max-width: 500px) { .field-row { grid-template-columns: 1fr; } }

/* ── QR panel ── */
.qr-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.qr-preview { text-align: center; }
.qr-preview img {
  max-width: 100%;
  width: 320px;
  height: 320px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px;
  background:
    conic-gradient(#f3f4f6 90deg, transparent 90deg 180deg, #f3f4f6 180deg 270deg, transparent 270deg) 0 0 / 20px 20px,
    #fff;
}
@media (max-width: 700px) { .qr-panel { grid-template-columns: 1fr; } }

