/* ------------------------------------------------------------------
   Islamic New Year 1448 — RSVP
   Palette: white / deep red / gold / soft beige
   ------------------------------------------------------------------ */

:root {
  --white: #ffffff;
  --beige: #f7f1e3;
  --beige-deep: #efe6cf;
  --green: #9b1c1c;
  --green-deep: #6b1313;
  --green-soft: #b83232;
  --gold: #c9a646;
  --gold-soft: #d8be6f;
  --gold-deep: #8f7426;
  --ink: #1a1f1c;
  --ink-soft: #4a554d;
  --error: #b3261e;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 10px 30px -12px rgba(107, 19, 19, 0.18),
                 0 2px 6px -2px rgba(107, 19, 19, 0.10);
  --shadow-soft: 0 4px 14px -8px rgba(107, 19, 19, 0.25);

  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--beige);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 50% 0%, rgba(201, 166, 70, 0.10), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='%239b1c1c' stroke-opacity='0.07' stroke-width='1'><polygon points='60,4 100,28 100,76 60,100 20,76 20,28'/><polygon points='60,20 86,36 86,68 60,84 34,68 34,36'/><circle cx='60' cy='52' r='14'/><path d='M60,4 L60,100 M20,28 L100,76 M20,76 L100,28'/></g></svg>");
  background-size: auto, 240px 240px;
  background-attachment: fixed;
  background-position: top center, center;
  background-repeat: no-repeat, repeat;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------ */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 22px;
  color: var(--gold-deep);
}

.ornament .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold) 50%, transparent);
  max-width: 120px;
}

.ornament .diamond {
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border: 1.5px solid var(--gold);
  background: transparent;
}

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */

.hero {
  text-align: center;
  padding: 36px 16px 12px;
}

.hero-image {
  display: inline-block;
  margin: 0 auto 22px;
  max-width: 100%;
  padding: 6px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: fadeIn 480ms ease;
  line-height: 0;
}

.hero-image img {
  display: block;
  max-width: min(560px, 100%);
  max-height: 70vh;
  width: auto;
  height: auto;
  border-radius: calc(var(--radius-lg) - 4px);
  background: var(--beige);
}

@media (max-width: 520px) {
  .hero-image img {
    max-width: min(420px, 100%);
    max-height: 60vh;
  }
}

.hero .eyebrow {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-size: 13px;
  margin: 0;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--green-deep);
  font-size: clamp(2.1rem, 6vw, 3.2rem);
  line-height: 1.1;
  margin: 14px 0 6px;
  letter-spacing: 0.01em;
}

.hero h2 {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  margin: 0 0 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero .invitation {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink);
  font-size: clamp(1.05rem, 2.6vw, 1.25rem);
  margin: 18px auto 8px;
  max-width: 520px;
}

/* ------------------------------------------------------------------
   Card
   ------------------------------------------------------------------ */

.card {
  background: var(--white);
  border: 1px solid rgba(201, 166, 70, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 22px;
  margin: 18px 0;
}

.card h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--green-deep);
  font-size: 1.45rem;
  margin: 0 0 14px;
}

/* ------------------------------------------------------------------
   Event details grid
   ------------------------------------------------------------------ */

.details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .details { grid-template-columns: 1fr 1fr; }
}

.detail {
  display: flex;
  flex-direction: column;
  background: var(--beige);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid rgba(155, 28, 28, 0.08);
}

.detail .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.detail .value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  margin-top: 4px;
}

/* ------------------------------------------------------------------
   Countdown
   ------------------------------------------------------------------ */

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  text-align: center;
}

.countdown .unit {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-deep) 100%);
  border-radius: var(--radius-md);
  padding: 14px 6px;
  color: var(--white);
  box-shadow: var(--shadow-soft);
}

.countdown .num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 5vw, 2.1rem);
  line-height: 1;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.countdown .lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 6px;
}

.deadline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(201, 166, 70, 0.5);
  font-size: 0.95rem;
}

.deadline-row .label {
  color: var(--ink-soft);
  font-weight: 500;
}

.deadline-row .value {
  color: var(--green-deep);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.deadline-row.closed .value { color: var(--error); }

/* ------------------------------------------------------------------
   Form
   ------------------------------------------------------------------ */

form .field {
  margin-bottom: 16px;
}

form label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--green-deep);
  margin-bottom: 6px;
}

form .hint {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 4px;
}

form input[type="text"],
form input[type="tel"],
form input[type="password"],
form input[type="search"] {
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid rgba(155, 28, 28, 0.18);
  border-radius: var(--radius-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

form input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(155, 28, 28, 0.12);
}

form input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.10);
}

form .error-text {
  display: none;
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 6px;
}

form .field.has-error .error-text { display: block; }

button {
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 150ms ease, background 150ms ease;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--green) 0%, var(--green-deep) 100%);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.95rem;
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  background: var(--ink-soft);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

.btn-secondary {
  padding: 10px 16px;
  background: var(--white);
  color: var(--green-deep);
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.btn-secondary:hover { background: var(--beige); }

.btn-danger {
  padding: 6px 12px;
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.btn-danger:hover { background: rgba(179, 38, 30, 0.08); }

/* ------------------------------------------------------------------
   Statuses
   ------------------------------------------------------------------ */

.notice {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  margin: 14px 0;
  font-size: 0.98rem;
  border: 1px solid transparent;
  display: none;
}

.notice.is-visible { display: block; animation: fadeIn 240ms ease; }

.notice.success {
  background: rgba(155, 28, 28, 0.06);
  border-color: rgba(155, 28, 28, 0.25);
  color: var(--green-deep);
}

.notice.error {
  background: rgba(179, 38, 30, 0.05);
  border-color: rgba(179, 38, 30, 0.25);
  color: var(--error);
}

.notice.info {
  background: rgba(201, 166, 70, 0.08);
  border-color: rgba(201, 166, 70, 0.35);
  color: var(--gold-deep);
}

.closed-state {
  text-align: center;
  padding: 30px 18px;
}

.closed-state .icon {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--gold-deep);
  margin-bottom: 10px;
}

.closed-state h3 {
  color: var(--green-deep);
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0 0 6px;
}

.closed-state p { color: var(--ink-soft); margin: 0; }

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */

footer {
  text-align: center;
  padding: 30px 18px 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

footer .sig {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--green-deep);
  letter-spacing: 0.05em;
  margin: 0;
}

footer .small {
  font-size: 0.78rem;
  margin-top: 4px;
  color: var(--ink-soft);
}

footer .admin-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.5;
}

/* ------------------------------------------------------------------
   Admin styles
   ------------------------------------------------------------------ */

.admin-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 18px 64px;
}

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.admin-bar h1 {
  font-family: var(--font-display);
  color: var(--green-deep);
  font-size: 1.8rem;
  margin: 0;
}

.admin-bar .me {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: var(--white);
  border: 1px solid rgba(201, 166, 70, 0.3);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

.stat .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.stat .num {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--green-deep);
  font-weight: 600;
  margin-top: 4px;
}

.hero-admin {
  margin-bottom: 18px;
}

.hero-admin-hint {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 14px;
}

.hero-admin-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

@media (min-width: 640px) {
  .hero-admin-row { grid-template-columns: 240px 1fr; }
}

.hero-preview {
  width: 100%;
  min-height: 140px;
  max-height: 280px;
  background: var(--beige-deep);
  border: 1.5px dashed rgba(155, 28, 28, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}

.hero-preview img {
  max-width: 100%;
  max-height: 268px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.hero-preview-empty {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-style: italic;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.hero-controls .btn-primary {
  width: auto;
  padding: 10px 22px;
  font-size: 0.9rem;
}

.hero-file-label {
  cursor: pointer;
  display: inline-block;
}

.hero-filename {
  font-size: 0.85rem;
  color: var(--ink-soft);
  min-width: 0;
  flex: 1 1 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hero-status {
  flex-basis: 100%;
  margin: 4px 0 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.table-wrap {
  background: var(--white);
  border: 1px solid rgba(201, 166, 70, 0.3);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

thead {
  background: var(--beige-deep);
  color: var(--green-deep);
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(155, 28, 28, 0.06);
}

th {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr:hover { background: var(--beige); }

td.id, td.actions { width: 1%; white-space: nowrap; }

.empty {
  padding: 40px;
  text-align: center;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------
   Login
   ------------------------------------------------------------------ */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid rgba(201, 166, 70, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 30px 28px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--green-deep);
  text-align: center;
  margin: 0 0 6px;
  font-size: 1.7rem;
}

.login-card .sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 22px;
}

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 360ms ease; }

@media (max-width: 520px) {
  th, td { padding: 10px 8px; font-size: 0.86rem; }
  .countdown { gap: 6px; }
  .card { padding: 20px 16px; }
}
