/* ============================================================
   DESIGN TOKENS
   Elegant "event ticket" feel for guest-facing pages,
   calm/efficient utility feel for staff-facing pages.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  /* palette */
  --ink: #111615;          /* near-black background, warm not blue */
  --ink-raised: #1A2120;   /* card / surface */
  --ink-line: #2B3432;     /* hairline borders on dark */
  --ivory: #F3EFE6;        /* primary text on dark */
  --ivory-dim: #A9AFA9;    /* secondary text on dark */
  --gold: #C9A876;         /* signature accent */
  --gold-soft: #E4D3AE;
  --emerald: #3C7A64;      /* success / checked-in */
  --emerald-soft: #E4F1EC;
  --clay: #B5654A;         /* warning / already scanned */
  --clay-soft: #F6E5DE;

  /* type */
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'Manrope', system-ui, sans-serif;

  --radius: 14px;
}

:root[data-theme="light"] {
  --ink: #F7F4EC;          /* warm off-white background */
  --ink-raised: #FFFFFF;   /* card / surface */
  --ink-line: #E3DCC9;     /* hairline borders on light */
  --ivory: #211D14;        /* primary text on light */
  --ivory-dim: #6E6A5C;    /* secondary text on light */
  --gold: #A9813F;         /* signature accent, darkened for contrast */
  --gold-soft: #EFE1C4;
  --emerald: #2F6753;
  --emerald-soft: #DCEFE7;
  --clay: #9C4A31;
  --clay-soft: #F3DED3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--ink);
  color: var(--ivory);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* only elements that opt in (.table-scroll) should scroll sideways */
  position: relative;
}

/* Subtle logo watermark behind all page content */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('../assets/logo.webp') no-repeat center center;
  background-size: min(75vw, 570px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }

/* --------- Brand logo --------- */
.brand-logo {
  height: 96px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}
.brand-logo-small {
  height: 42px;
  margin-right: 6px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* --------- Buttons --------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 13px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--gold);
  color: #1A1300;
  box-shadow: 0 4px 14px -4px rgba(201,168,118,0.5);
}
.btn-primary:hover { opacity: 0.92; box-shadow: 0 6px 18px -4px rgba(201,168,118,0.6); }
.btn-ghost {
  background: transparent;
  border-color: var(--ink-line);
  color: var(--ivory);
}
.btn-ghost:hover { border-color: var(--gold); box-shadow: 0 2px 10px -4px rgba(201,168,118,0.35); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* --------- Inputs --------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  min-width: 0; /* let flex items (e.g. inside .btn-group) shrink instead of overflowing on narrow screens */
  flex: 1 1 140px;
}
.field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ivory-dim);
}
.field input, .field select {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  color: var(--ivory);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  width: 100%;
  min-width: 0;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
}

/* --------- Card --------- */
.card {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 28px;
}

/* --------- Top bar (staff pages) --------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ink-line);
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ink);
}
.topbar .brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-style: italic;
  color: var(--gold);
}
.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.topbar nav a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ivory-dim);
  white-space: nowrap;
}
.topbar nav a.active, .topbar nav a:hover { color: var(--gold); }

/* --------- Stat strip --------- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.stat {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
}
.stat .num {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}
.stat .label {
  margin-top: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ivory-dim);
}
.stat-filter {
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.stat-filter:hover { border-color: var(--gold); transform: translateY(-2px); }
.stat-filter.active-filter {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

/* --------- Table --------- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ink-line); white-space: nowrap; }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ivory-dim);
  font-weight: 600;
}
tr.checked-in td:first-child { border-left: 3px solid var(--emerald); }
tr.vip-row { background: rgba(201,168,118,0.06); }
tr.row-clickable { cursor: pointer; }
tr.row-clickable:hover { background: rgba(201,168,118,0.06); }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pill-in { background: var(--emerald-soft); color: var(--emerald); }
.pill-out { background: rgba(255,255,255,0.08); color: var(--ivory-dim); }
.pill-sent { background: var(--clay-soft); color: var(--clay); }
.pill-read { background: rgba(201,168,118,0.18); color: var(--gold); }

.vip-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #1A1300;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 10px;
}

/* --------- Invite card (guest-facing, signature element) --------- */
.ticket {
  background: linear-gradient(180deg, var(--ink-raised), var(--ink));
  border: 1px solid var(--gold);
  border-radius: 18px;
  padding: 40px 32px 32px;
  text-align: center;
  position: relative;
  box-shadow: 0 0 0 1px rgba(201,168,118,0.15), 0 30px 60px -20px rgba(0,0,0,0.6);
}
.ticket .eyebrow {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.ticket h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-style: italic;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ivory);
}
.ticket .sub {
  color: var(--ivory-dim);
  font-size: 13px;
  margin-bottom: 28px;
}
.ticket .event-details {
  background: rgba(201,168,118,0.08);
  border: 1px solid var(--ink-line);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 4px;
  text-align: left;
}
.ticket .event-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
}
.ticket .event-line {
  font-size: 13px;
  color: var(--ivory-dim);
  line-height: 1.6;
}
.ticket .perforation {
  position: relative;
  border-top: 1px dashed var(--ink-line);
  margin: 28px 0;
}
.ticket .perforation::before, .ticket .perforation::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 20px;
  height: 20px;
  background: var(--ink);
  border-radius: 50%;
}
.ticket .perforation::before { left: -40px; }
.ticket .perforation::after { right: -40px; }
.ticket .qr-frame {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--gold-soft);
}
.ticket .qr-frame canvas, .ticket .qr-frame img { display: block; }
.ticket .guest-id {
  margin-top: 16px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ivory-dim);
}

/* --------- Popup / toast (scanner) --------- */
.scan-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10,12,11,0.75);
  backdrop-filter: blur(6px);
  z-index: 50;
  padding: 24px;
}
.scan-overlay.show { display: flex; }
.scan-card {
  background: var(--ink-raised);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: pop 0.25s ease;
}
.scan-card.welcome { border: 1px solid var(--emerald); }
.scan-card.warn { border: 1px solid var(--clay); }
.scan-card.error { border: 1px solid var(--clay); }
.scan-card .icon { font-size: 40px; margin-bottom: 10px; }
.scan-card h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 30px;
  margin: 0 0 6px;
}
.scan-card p { color: var(--ivory-dim); font-size: 14px; margin: 0; }
@keyframes pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --------- Footer --------- */
.site-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--ivory-dim);
}

/* --------- Send-queue tracker (import page) --------- */
.send-queue-tracker {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 55;
  background: var(--ink-raised);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  max-width: 280px;
}

/* --------- Utility --------- */
.muted { color: var(--ivory-dim); }
.center { text-align: center; }
.mt-24 { margin-top: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }
.hidden { display: none !important; }

/* --------- Theme toggle --------- */
.theme-toggle {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ink-line);
  background: var(--ink-raised);
  color: var(--ivory);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}
.theme-toggle:hover { transform: scale(1.06); }

/* --------- Responsive breakpoints --------- */
@media (max-width: 900px) {
  .container-wide { padding: 24px 16px 48px; }
  .card { padding: 20px; }
}

@media (max-width: 600px) {
  .topbar { padding: 14px 16px; }
  .container, .container-wide { padding: 24px 14px 48px; }
  .card { padding: 18px; }
  .btn { padding: 12px 16px; font-size: 13px; }
}

@media (max-width: 480px) {
  .stat-strip { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat .num { font-size: 26px; }
  .ticket { padding: 32px 20px 24px; }
  .ticket h1 { font-size: 32px; }
  .ticket .perforation::before { left: -20px; }
  .ticket .perforation::after { right: -20px; }
}
@media (max-width: 380px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
