/* Brand palette — RaffleStub-spec.md §2 (Branding) */
:root {
  --teal-dark: #0b4d3d;   /* primary */
  --teal-mid: #1d9e75;    /* secondary */
  --coral: #d85a30;       /* accent */
  --mint: #eff6f5;        /* background */
  --white: #ffffff;       /* surface */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--mint);
  color: var(--teal-dark);
}

.topbar {
  background: var(--teal-dark);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Brand mark — RaffleStub-spec.md §2. The <symbol> it references lives in
   partials/topbar.ejs (currentColor-based, so it inherits this element's
   color automatically). */
.mark-icon {
  display: block;
  width: 30px;
  height: 19px;
  flex-shrink: 0;
}

.rs-accent {
  fill: var(--coral);
}

.wordmark {
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

/* Wraps the topbar's icon+wordmark so it's clickable (logged out -> landing
   page, logged in -> dashboard) without changing how it looks. */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(11, 77, 61, 0.15);
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--teal-mid);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

.btn-accent {
  background: var(--coral);
}

.btn-google {
  background: var(--white);
  color: var(--teal-dark);
  border: 1px solid #cfe3df;
}

/* The icon inside a .btn — a stroked line icon sized to sit next to the
   label at the button's own font size (see the icon-* symbols in
   partials/mark-defs.ejs). */
.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Wraps a cluster of adjacent .btn elements (an event's action buttons, a
   card's header actions) so they wrap onto new lines with breathing room
   instead of the browser's default inline flow, where buttons with no
   margin of their own would run edge-to-edge. */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

form.stacked label {
  display: block;
  font-weight: 600;
  margin: 0.9rem 0 0.3rem;
}

form.stacked input[type="email"],
form.stacked input[type="password"],
form.stacked input[type="number"],
form.stacked input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cfe3df;
  border-radius: 8px;
  font-size: 1rem;
}

form.stacked .btn {
  margin-top: 1.2rem;
  width: 100%;
  text-align: center;
  border: none;
}

.form-footer {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.form-footer a {
  color: var(--teal-mid);
}

.flash {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.flash-success {
  background: #e2f3ec;
  color: var(--teal-dark);
  border: 1px solid var(--teal-mid);
}

.flash-error {
  background: #fbe8e2;
  color: var(--coral);
  border: 1px solid var(--coral);
}

.divider {
  text-align: center;
  color: #7fa79a;
  margin: 1rem 0;
  font-size: 0.85rem;
}

/* Event list + badges */
.event-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.event-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #e3efec;
}

.event-list a {
  color: var(--teal-dark);
  font-weight: 600;
  text-decoration: none;
  margin-right: auto;
}

.event-delete-form {
  margin: 0;
}

.btn-link-danger {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--coral);
  cursor: pointer;
  text-decoration: underline;
}

.btn-link-danger:hover {
  color: #b8481f;
}

.staff-invite-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.staff-invite-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #e3efec;
}

.staff-invite-qr {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid #e3efec;
}

.staff-invite-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.staff-invite-info a {
  display: block;
  color: var(--teal-mid);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .staff-invite-row { flex-wrap: wrap; }
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-active { background: #e2f3ec; color: var(--teal-dark); }
.badge-closed { background: #eee; color: #666; }
.badge-billing-free_trial { background: #e2f3ec; color: var(--teal-mid); }
.badge-billing-unpaid { background: #fbe8e2; color: var(--coral); }
.badge-billing-paid { background: #e2f3ec; color: var(--teal-dark); }

/* Event setup form */
.field-group {
  margin: 0.9rem 0;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.3rem 0;
  font-weight: 400;
}

.radio-row input {
  width: auto;
}

.prize-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0;
}

.prize-row input[type="text"] {
  flex: 1;
  margin: 0;
}

.prize-row input[readonly] {
  background: var(--mint);
  color: #5c8a7d;
}

.prize-row .btn,
.prize-row .badge {
  flex-shrink: 0;
}

/* form.stacked .btn sets width:100% for the form's main submit button —
   needs an ID-strength selector to actually override that here, since
   .prize-row .btn alone loses the specificity tie (both have 2 classes,
   but "form.stacked .btn" also matches the extra "form" element). */
#prize-rows .btn {
  width: auto;
}

.hint {
  color: #5c8a7d;
  font-size: 0.85rem;
  margin: 0.2rem 0 0;
}

.hint a {
  word-break: break-all;
}

.error-list {
  background: #fbe8e2;
  border: 1px solid var(--coral);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: var(--coral);
}

.error-list ul {
  margin: 0;
  padding-left: 1.1rem;
}

.detail-row {
  padding: 0.4rem 0;
  border-bottom: 1px solid #e3efec;
}

.detail-row dt {
  font-size: 0.8rem;
  color: #5c8a7d;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-row dd {
  margin: 0.1rem 0 0;
}

/* Ticket list */
table.tickets {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.tickets th,
table.tickets td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid #e3efec;
}

table.tickets th {
  color: #5c8a7d;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-unclaimed, .badge-pending { background: #eee; color: #666; }
.badge-drawn { background: #fdf1d8; color: #a06a1e; }
.badge-claimed { background: #e2f3ec; color: var(--teal-dark); }
.badge-void { background: #fbe8e2; color: var(--coral); }

/* Draw / presentation mode (spec §8) — full-bleed, no dashboard chrome,
   large text so it reads on a mirrored/cast display from across a room. */
.draw-screen {
  min-height: 100vh;
  background: var(--teal-dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
}

.draw-exit {
  position: fixed;
  top: 1rem;
  left: 1rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.9rem;
}

.draw-exit:hover { color: var(--white); }

.draw-screen h1 {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
}

.draw-screen p.draw-sub {
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0;
}

.btn-draw {
  display: inline-block;
  background: var(--coral);
  color: var(--white);
  border: none;
  border-radius: 10px;
  padding: 1rem 2.2rem;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0.5rem;
}

.btn-draw:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-draw-secondary {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

/* Drum stage — tickets tumble in a circular cage (like a real bingo drum)
   until "Pick winner" decelerates it and the whole drum fades away in
   favor of the big .reveal-ticket below. Sized with clamp()/vw so it
   scales smoothly from phone to laptop rather than jumping at a
   breakpoint. */
.drum-wrap {
  position: relative;
  width: clamp(220px, 62vw, 420px);
  aspect-ratio: 1 / 1;
  margin: 1.5rem auto;
}

.drum-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 45%),
    var(--teal-dark);
  border: 8px solid;
  border-image: linear-gradient(135deg, #cfeae6, #6f9a92 35%, #1c352c 70%, #cfeae6) 1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Wire-cage texture. */
.drum-mesh {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 14px);
  pointer-events: none;
}

.drum-tickets {
  position: absolute;
  inset: 0;
}

/* Center axle, like a real bingo cage's rotating spindle — purely
   decorative, doesn't move. */
.drum-axle {
  position: absolute;
  top: 50%;
  left: 5%;
  right: 5%;
  height: 4px;
  background: linear-gradient(90deg, #cfeae6, #6f9a92, #cfeae6);
  transform: translateY(-50%);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.drum-axle::before,
.drum-axle::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #cfeae6;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.drum-axle::before { left: -6px; }
.drum-axle::after { right: -6px; }

/* The exit chute the winner conceptually "falls" out of — decorative. */
.drum-chute {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 13%;
  min-width: 36px;
  height: 18px;
  background: var(--teal-dark);
  border: 3px solid #6f9a92;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.ticket-chip {
  position: absolute;
  width: 62px;
  aspect-ratio: 160 / 100;
  background: var(--mint);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  margin-left: -31px; /* centers the chip on its left/top orbit point */
  margin-top: -19.4px;
}

/* Shared by the drum's small tickets (.ticket-chip) and the big
   .reveal-ticket — not scoped to either parent, so both get it. */
.chip-svg {
  display: block;
  width: 100%;
  height: 100%;
  color: var(--teal-dark);
}

.chip-code-text {
  fill: currentColor;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Base "big ticket" card — a real-size rendering of the same mini-ticket
   used in the shuffle pile (.chip-svg / .chip-code-text), not plain text
   or a separate QR image, so it reads as one actual ticket object.
   .reveal-ticket (the draw's winner reveal) and .ticket-graphic (the real,
   scannable ticket on public/ticket.ejs) both build on this. */
.ticket-graphic {
  width: 360px;
  max-width: 88vw;
  aspect-ratio: 160 / 100;
  background: var(--mint);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(11, 77, 61, 0.25);
  margin: 1.5rem auto;
}

/* Point-of-sale "have the buyer scan this" moment — bigger than the
   standard ticket size, since the QR actually needs to be scanned right
   then, not just saved for later. Compound selector (not just
   .ticket-graphic-lg alone) so this reliably beats .ticket-graphic's own
   width rules regardless of source order — same specificity otherwise. */
.ticket-graphic.ticket-graphic-lg {
  width: 460px;
}

@media (max-width: 600px) {
  .ticket-graphic.ticket-graphic-lg { width: 320px; }
}

/* The pre-confirm/post-confirm draw reveal adds the coral ring + pop-in —
   purely cosmetic emphasis that doesn't belong on an ordinary ticket. */
.reveal-ticket {
  box-shadow: 0 0 0 3px var(--coral), 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: draw-pop 0.4s ease-out;
}

@keyframes draw-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 600px) {
  .ticket-graphic { width: 290px; }
  .ticket-chip { width: 46px; margin-left: -23px; margin-top: -14.4px; }
}

.draw-video {
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  margin: 1rem 0;
}

.draw-error {
  background: rgba(216, 90, 48, 0.25);
  border: 1px solid var(--coral);
  border-radius: 8px;
  padding: 0.75rem 1.2rem;
  margin: 1rem 0;
}

/* Public ticket page — event info header; the ticket itself below is
   .ticket-graphic (real brand-mark shape + embedded scannable QR, see
   public/ticket.ejs and the shared .ticket-graphic/.chip-svg rules). */
.ticket {
  max-width: 380px;
  margin: 1.5rem auto;
}

.ticket__main {
  padding: 0 1.5rem;
  text-align: center;
}

.ticket__main h2 {
  margin: 0 0 0.25rem;
  color: var(--teal-dark);
}

/* ===== Landing page ===== */

.landing h1, .landing h2, .landing h3 {
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  text-wrap: balance;
}

.landing-hero-band {
  background: var(--teal-dark);
  color: var(--white);
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  max-width: 1080px;
  margin: 0 auto;
}

.landing-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.landing-nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.landing-nav-links a:not(.btn) {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.landing-nav-links a:not(.btn):hover {
  color: var(--white);
}

.landing-hero {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4.5rem;
}

.landing-hero-copy {
  flex: 1 1 380px;
}

.landing-hero-copy h1 {
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.12;
  margin: 0 0 1rem;
}

.landing-lede {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
  max-width: 42ch;
  margin: 0 0 1.75rem;
}

.landing-cta-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.landing-hint {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.landing-hero-art {
  position: relative;
  flex: 1 1 320px;
  min-height: 260px;
}

.hero-ticket {
  position: absolute;
  width: 190px;
  aspect-ratio: 160 / 100;
  background: var(--mint);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.landing-section {
  padding: 4rem 1.5rem;
  text-align: center;
  background: var(--white);
}

.landing-section-alt {
  background: var(--mint);
}

.landing-section-dark {
  background: var(--teal-dark);
  color: var(--white);
}

.landing-section h2 {
  font-size: 1.9rem;
  font-weight: 800;
  color: inherit;
  margin: 0 0 1rem;
}

.landing-section-lede {
  max-width: 56ch;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #5c8a7d;
}

.landing-section-dark .landing-section-lede {
  color: rgba(255, 255, 255, 0.85);
}

.landing-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
  max-width: 1080px;
  margin: 2rem auto 0;
  text-align: left;
}

.landing-step h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--teal-dark);
  margin: 0 0 0.4rem;
}

.landing-step p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #5c8a7d;
  margin: 0;
}

.landing-footer {
  background: var(--teal-dark);
  color: var(--white);
  text-align: center;
  padding: 3.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.landing-legal {
  max-width: 52ch;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.55;
  margin: 0.5rem 0 0;
}

.landing-legal a {
  color: rgba(255, 255, 255, 0.8);
}

/* Privacy Policy / Terms of Service prose */
.legal h1 {
  margin-top: 0;
}

.legal h2 {
  font-size: 1.1rem;
  margin: 1.6rem 0 0.5rem;
}

.legal p,
.legal li {
  line-height: 1.6;
}

.legal ul {
  padding-left: 1.3rem;
}

@media (max-width: 760px) {
  .landing-hero { flex-direction: column; padding: 1rem 1.5rem 2rem; }
  .landing-hero-copy h1 { font-size: 2.1rem; }
  .landing-hero-art { flex-basis: auto; width: 100%; min-height: 190px; margin-top: 1.5rem; }
  .hero-ticket { width: 140px; }
}

/* Admin dashboard (organizer directory) — wider than the default .page
   since it's a data table, plus a compact inline credits form that doesn't
   need form.stacked's full-width single-column layout. */
.page-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.admin-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.admin-stats strong {
  display: block;
  font-size: 1.4rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid #e2ece9;
  white-space: nowrap;
}

.admin-table tbody tr:hover {
  background: var(--mint);
}

.credits-form {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.credits-form input[type="number"] {
  width: 4.5rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #cfe3df;
  border-radius: 6px;
  font-size: 0.9rem;
}

.credits-form .btn,
.comp-form .btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
