@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

/* ── Site shell ──────────────────────────────────────────────────────────────
   Colors and type only. Every class name and selector below is unchanged:
   the pages bind to these names in JS, so renaming one breaks a page silently.

   The .invite-card block further down is DELIBERATELY untouched. That block is
   the customer's invitation itself — the guest sees it, the customer paid for
   that exact look, and utils/cardImage.js screenshots it with Puppeteer to send
   on WhatsApp. Restyling it would change invitations that are already paid for.
   ───────────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif;
  /* A flat ground instead of a three-stop gradient: the panels below are white,
     and they only read as raised against a single calm colour. */
  background: #F4F1F9;
  min-height: 100vh;
  margin: 0;
  direction: rtl;
  color: #241B33;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  background: #4A2D77;
  color: #fff;
  padding: 18px 28px;
  font-family: 'Amiri', serif;
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.layout {
  display: flex;
  gap: 32px;
  padding: 32px 24px 60px;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
  align-items: flex-start;
}

.form-panel {
  flex: 1.1;
  min-width: 380px;
  /* White, not a lavender tint. A panel the same hue as the page has no edge,
     which is most of why the old screens read as flat. */
  background: #FFFFFF;
  border: 1px solid #E5DEF2;
  border-radius: 14px;
  padding: 28px 32px;
  box-shadow: 0 10px 28px rgba(74,45,119,0.07);
}

.preview-panel {
  flex: 1;
  min-width: 340px;
  position: sticky;
  top: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.form-panel h3 {
  font-family: 'Amiri', serif;
  font-size: 24px;
  color: #4A2D77;
  margin-top: 0;
  border-bottom: 1px solid #E5DEF2;
  padding-bottom: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}

.field-grid .full { grid-column: 1 / -1; }

.form-panel label {
  display: block;
  font-size: 13.5px;
  /* Darkened from #6b6b6b: the old grey failed contrast at this size. */
  color: #5A5568;
  margin: 14px 0 6px;
  font-weight: 600;
}

.form-panel input,
.form-panel textarea,
.form-panel select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #D6C9EC;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  color: #241B33;
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-panel input:focus,
.form-panel textarea:focus,
.form-panel select:focus {
  outline: none;
  border-color: #4A2D77;
  box-shadow: 0 0 0 3px rgba(74,45,119,0.12);
  background: #fff;
}

.form-panel textarea { resize: vertical; min-height: 50px; }

.section-divider {
  margin: 28px 0 8px;
  border: none;
  border-top: 1px solid #E5DEF2;
}

.map-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(36,27,51,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.map-modal.open { display: flex; }

.map-modal-inner {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 24px 56px rgba(36,27,51,0.28);
}

.btn {
  display: inline-block;
  background: #4A2D77;
  color: #fff;
  border: none;
  /* 46px tall at this padding — above the 44px touch target minimum. */
  padding: 13px 28px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 18px;
  transition: background-color 0.15s;
}

.btn:hover { background: #3E2663; }
/* Secondary is an outline, not grey fill: grey read as "disabled" next to the
   primary button, and white text on #888 fails contrast anyway. */
.btn.secondary {
  background: #FFFFFF;
  color: #4A2D77;
  border: 1.5px solid #D6C9EC;
}
.btn.secondary:hover { background: #F4F1F9; border-color: #4A2D77; }
.btn.wa { background: #1DA851; }
.btn.wa:hover { background: #17843F; }
.btn.decline { background: #A6332F; }
.btn.decline:hover { background: #872825; }

/* --- Invitation card --- */
.invite-card {
  width: 380px;
  max-width: 100%;
  background: #faf8fd;
  border: 2px solid #c9b8e3;
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 6px 20px rgba(107,75,161,0.12);
  background-image: radial-gradient(circle at top left, rgba(201,184,227,0.15), transparent 60%);
  font-family: 'Amiri', 'Traditional Arabic', serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.invite-card .card-text-content {
  width: 100%;
}

/* When a template's artwork is concentrated at the top, flip the content order
   so the text block sits in the empty area at the bottom instead */
.invite-card.decoration-top {
  flex-direction: column-reverse;
}

/* Soft shadow for legibility over busy/dark photo backgrounds — applied whenever a
   custom background image is set, regardless of which text color the template picked */
.invite-card.has-bg-image :not(.venue a) {
  text-shadow: 0 1px 3px rgba(255,255,255,0.55);
}

.invite-card .basmala {
  font-size: 13px;
  color: var(--general-color, #1a1a1a);
  margin-bottom: 6px;
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .verse {
  font-size: 13px;
  color: var(--general-color, #1a1a1a);
  line-height: 1.9;
  margin-bottom: 18px;
  text-wrap: balance;
  font-weight: normal;
  opacity: 0.72;
  max-width: 82%;
  margin-left: auto;
  margin-right: auto;
}

.invite-card .heading {
  font-size: 14px;
  color: var(--general-color, #1a1a1a);
  margin-bottom: 6px;
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .families-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.invite-card .family-col {
  flex: 0 1 auto;
  max-width: 45%;
  min-width: 0;
  text-align: center;
}

.invite-card .family-prefix {
  font-size: 14px;
  color: var(--names-color, #1a1a1a);
  font-weight: bold;
}

/* Permanent, small rightward nudge for the bride's "آل"/prefix label specifically —
   applies to every invitation, not a per-event adjustment */
.invite-card .family-prefix-bride {
  transform: translateX(6px);
}

.invite-card .family-name {
  font-size: 22px;
  font-weight: bold;
  color: var(--names-color, #1a1a1a);
}
.invite-card.names-large .family-name { font-size: 28px; }

.invite-card .subline {
  font-size: 13px;
  color: var(--general-color, #1a1a1a);
  margin-bottom: 10px;
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .names-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 4px;
}

.invite-card .name-col {
  flex: 0 1 auto;
  max-width: 45%;
  min-width: 0;
}

.invite-card .relation-label {
  font-size: 12px;
  color: var(--general-color, #1a1a1a);
  margin-bottom: 2px;
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .names-divider {
  flex: 0 0 auto;
  align-self: center;
  padding: 0 22px;
  color: var(--general-color, #1a1a1a);
  font-weight: bold;
}

/* Give the main couple names row a bit more breathing room than the family row above —
   two short first names ("العباس"/"أمل") sitting right against "من" looked too cramped */
.invite-card .names-row .names-divider {
  padding: 0 44px;
}

.invite-card .lineage {
  font-size: 12px;
  color: var(--general-color, #1a1a1a);
}

.invite-card .name-main {
  color: var(--names-color, #1a1a1a);
  font-size: 18px;
  font-weight: bold;
}
.invite-card.names-large .name-main { font-size: 24px; }

.invite-card .name-en {
  font-size: 11px;
  color: var(--general-color, #1a1a1a);
  opacity: 0.8;
  font-family: 'Amiri', serif; /* Latin text always reads fine in Amiri's Latin glyphs */
  direction: ltr;
}

.invite-card .guest-name {
  font-size: 16px;
  font-weight: bold;
  margin: 16px 0 6px;
  color: var(--names-color, #4b2e83);
}

.invite-card .details {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--general-color, #1a1a1a);
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .extra-times {
  font-size: 12px;
  color: var(--general-color, #555);
  margin-bottom: 8px;
  opacity: 0.72;
}

.invite-card .venue {
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--general-color, #1a1a1a);
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .venue a {
  color: var(--names-color, #4b2e83);
  text-decoration: none;
}

.invite-card .closing {
  font-size: 12px;
  color: var(--general-color, #1a1a1a);
  margin-top: 10px;
  font-weight: normal;
  opacity: 0.72;
}

.invite-card .icon-notices {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
  font-size: 16px;
  opacity: 0.75;
}

/* --- Site shell continues --- */

.text-color-btn.active-color-btn {
  outline: 2px solid #4A2D77;
  outline-offset: 2px;
}

.nudge-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #D6C9EC;
  background: #fff;
  color: #4A2D77;
  font-size: 14px;
  cursor: pointer;
}
.nudge-btn:hover { background: #F4F1F9; border-color: #4A2D77; }

.rsvp-verify {
  text-align: center;
  margin: 18px auto 0;
  max-width: 320px;
}
.rsvp-verify label {
  display: block;
  font-size: 13.5px;
  color: #5A5568;
  margin-bottom: 8px;
}
.rsvp-verify input {
  width: 130px;
  text-align: center;
  letter-spacing: 8px;
  font-size: 20px;
  padding: 12px;
  border: 1px solid #D6C9EC;
  border-radius: 10px;
  direction: ltr;
}
.rsvp-error {
  color: #A6332F;
  font-size: 12.5px;
  margin-top: 8px;
  min-height: 16px;
}

.rsvp-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.rsvp-status {
  margin-top: 16px;
  font-weight: bold;
}

table.guest-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13.5px;
}

table.guest-table th, table.guest-table td {
  border: 1px solid #ECE6F5;
  padding: 10px 8px;
  text-align: right;
}

table.guest-table th {
  background: #F4F1F9;
  color: #4A2D77;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge.pending { background: #EFEDF3; color: #5A5568; }
.badge.confirmed { background: #D9F0E1; color: #15682F; }
.badge.declined { background: #F8DEDD; color: #8E2A26; }
