/* Only Games — base styles.
   Colors taken from the logo (plan section 7.4): red, blue, yellow, green,
   on a light background, with the logo's dark navy for text. */

:root {
  --navy: #16325c;
  --red: #d9443b;
  --blue: #2b7bd6;
  --yellow: #f2b632;
  --green: #3a9a4c;

  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1b2a44;
  --muted: #5b6678;
  --border: #e2e0d8;

  --max-width: 1100px;
  --radius: 12px;
  --navbar-height: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: "Heebo", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}

a { color: var(--blue); }

img { max-width: 100%; display: block; }

/* The whole site (header/main/footer) sits inside this one column, at
   every screen size — so content is always centered with a visible
   margin, never stretched edge-to-edge on a phone. Above the desktop
   breakpoint the margin grows and the white body background (with the
   light-blue gaming-icon pattern) shows in the side margins instead. */
.site-container {
  background: var(--bg);
  max-width: calc(100% - 24px);
  margin: 0 auto;
}

@media (min-width: 1100px) {
  body {
    background-image: url("../img/pattern-games.svg");
    background-repeat: repeat;
    background-size: 240px 240px;
  }
  .site-container {
    max-width: 1160px;
    margin: 0 auto;
    box-shadow: 0 30px 80px -45px rgba(22, 50, 92, 0.35), 0 0 0 1px var(--border);
  }
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

.top-stripe { height: 5px; display: flex; }
.top-stripe span { flex: 1; }
.top-stripe span:nth-child(1) { background: var(--red); }
.top-stripe span:nth-child(2) { background: var(--blue); }
.top-stripe span:nth-child(3) { background: var(--yellow); }
.top-stripe span:nth-child(4) { background: var(--green); }

/* ---------- Header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--navbar-height);
  gap: 16px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--navy);
  font-weight: 800;
  font-size: 1.15rem;
}
.brand img { width: 40px; height: 40px; }

.nav-toggle {
  display: none; /* shown only below the mobile breakpoint, further down */
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.site-nav a:hover { color: var(--blue); }

.nav-social {
  display: none; /* shown only inside the mobile menu, below */
  gap: 14px;
}

.nav-separator {
  color: var(--border);
  font-weight: 400;
  user-select: none;
}

@media (max-width: 780px) {
  .nav-toggle { display: flex; }

  /* A "|" divider only makes sense in the desktop horizontal row; in
     the mobile dropdown's stacked layout it would sit alone on its own
     line, so it's hidden there instead. */
  .nav-separator { display: none; }

  .site-nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 16px 16px;
    gap: 4px;
  }
  .site-nav.open { display: flex; }
  .site-nav a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
  }
  .nav-social {
    display: flex;
    padding-top: 12px;
    color: var(--navy);
  }
}

/* ---------- Flash messages ---------- */

.flash-list { margin-top: 16px; }
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-weight: 500;
}
.flash-success { background: color-mix(in srgb, var(--green) 16%, white); color: #1f5c2c; }
.flash-error { background: color-mix(in srgb, var(--red) 14%, white); color: #8a231d; }

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

.hero {
  padding: 48px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--navy);
  margin: 0 0 12px;
  font-weight: 800;
}
.hero p.subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto;
}
.hero p.intro {
  max-width: 720px;
  margin: 20px auto 0;
}

section.content-section {
  padding: 32px 0;
}
section.content-section h2 {
  color: var(--navy);
  font-size: 1.6rem;
  margin-bottom: 20px;
}

/* ---------- Event cards ---------- */

.event-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 700px) {
  /* auto-fit + justify-content: center means a partial row (e.g. just
     one event) sits centered on desktop instead of stuck to one side,
     while a full row still spreads normally across the width. */
  .event-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
    justify-content: center;
  }
}

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
}
.event-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--border);
}
.event-card .event-card-body { padding: 16px; }
.event-card h3 { margin: 0 0 6px; color: var(--navy); font-size: 1.15rem; }
.event-card .event-meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 8px; }
.event-card .btn { margin-top: 10px; }

.empty-note {
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

/* ---------- Buttons & forms ---------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}
.btn:hover { filter: brightness(0.92); }
.btn.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
  padding: 10px 20px;
}
.btn.btn-small {
  padding: 5px 12px;
  font-size: 0.85rem;
}
.btn.btn-outline.btn-small { padding: 3px 10px; border-width: 1px; }

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
}
.inline-form input[type="text"] {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  width: 140px;
}
.actions-cell { display: flex; flex-direction: column; align-items: flex-start; }

.sign-in-buttons {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-weight: 600;
}
.btn-google:hover { background: var(--bg); }

form.stacked-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
}
@media (min-width: 700px) {
  form.stacked-form { max-width: 640px; margin: 0 auto; }
}
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.field textarea { min-height: 120px; resize: vertical; }
.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
}
.field-checkbox input { width: 20px; height: 20px; margin-top: 2px; }

/* honeypot field: present for bots, invisible to people */
.hp-field {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 28px 0;
  background: var(--surface);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-social {
  display: flex;
  gap: 16px;
  color: var(--navy);
}
.social-icon { color: inherit; display: inline-flex; }
.social-icon:hover { color: var(--blue); }

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

.admin-login-wrap {
  max-width: 420px;
  margin: 64px auto;
  padding: 0 16px;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.admin-nav {
  display: flex;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.admin-nav a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 600;
}
.admin-nav a:hover { color: var(--blue); }

.back-link {
  margin: 0 0 16px;
  font-size: 0.92rem;
}
.back-link a { color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--blue); text-decoration: underline; }

.admin-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-list-header h1 { margin: 0; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: start;
}
.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.9rem; }

.admin-table tr.row-handled { opacity: 0.55; }
.message-body-cell {
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.status-draft { background: var(--border); color: var(--muted); }
.status-open { background: color-mix(in srgb, var(--green) 20%, white); color: #1f5c2c; }
.status-closed { background: color-mix(in srgb, var(--yellow) 28%, white); color: #7a5b00; }
.status-done { background: color-mix(in srgb, var(--blue) 18%, white); color: var(--navy); }

/* Registration statuses (My events page, and later the admin registrations
   screen in step 5) — distinct values from the event statuses above. */
.status-pending_payment { background: color-mix(in srgb, var(--yellow) 28%, white); color: #7a5b00; }
.status-confirmed { background: color-mix(in srgb, var(--green) 20%, white); color: #1f5c2c; }
.status-cancelled { background: var(--border); color: var(--muted); }
.status-removed { background: color-mix(in srgb, var(--red) 16%, white); color: #8a231d; }

/* ---------- Admin: event form ---------- */

.event-form textarea#description { min-height: 160px; }
.event-form small {
  color: var(--muted);
  font-size: 0.85rem;
}
.md-preview-label {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.md-preview {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 4px;
  background: var(--bg);
}
.md-preview :first-child { margin-top: 0; }
.current-image-preview {
  margin-top: 10px;
  max-width: 240px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ---------- Public: event page ---------- */

.event-page { padding: 24px 0 48px; }
.event-hero-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.event-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 800px) {
  .event-layout { grid-template-columns: 2fr 1fr; align-items: start; }
}
.event-subtitle { color: var(--muted); font-size: 1.15rem; margin-top: -8px; }
.event-description :first-child { margin-top: 0; }

.player-list {
  columns: 2;
  gap: 20px;
}
@media (min-width: 500px) {
  .player-list { columns: 3; }
}

.event-details-box, .event-join-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.event-details-box { margin-bottom: 16px; }
.event-details-box h2 { margin-top: 0; font-size: 1.1rem; }
.event-details-box dl { margin: 0; }
.event-details-box dt { color: var(--muted); font-size: 0.85rem; margin-top: 12px; }
.event-details-box dt:first-child { margin-top: 0; }
.event-details-box dd { margin: 2px 0 0; font-weight: 600; }
.address-text { font-weight: 400; color: var(--muted); }

.event-join-box .btn { width: 100%; text-align: center; }

.past-events-heading { margin-top: 40px; }
.event-grid-past { opacity: 0.85; }

/* ---------- Registration status + payment (event join box, My events) ---------- */

.registration-status {
  font-weight: 700;
  margin: 0 0 8px;
}
.payment-link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}
/* Colors are generic brand-ish accents, not the services' exact official
   colors — easy to tweak in one place if you'd rather match precisely. */
.payment-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.payment-link-btn:hover { border-color: currentColor; }
.payment-link-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  flex: none;
}
.payment-link-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex: none;
  display: block;
}
.payment-link-logo-paybox { border-radius: 0; } /* transparent background, no corners to round */

/* Bit's and PayBox's real brand colors, sampled from their official
   logos above; the generic fallback is still an approximate accent. */
.payment-link-bit { color: #00353b; }
.payment-link-paybox { color: #2ea7eb; }
.payment-link-generic { color: var(--blue); }
.payment-link-generic .payment-link-icon { background: var(--blue); }

.event-join-box form { margin: 0; }
.event-join-box .field-checkbox { margin-bottom: 14px; }

.my-events-list {
  display: grid;
  gap: 12px;
}
.my-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-decoration: none;
  color: var(--text);
}
.my-event-row:hover { border-color: var(--blue); }

/* ---------- Hero carousel (between the nav bar and the page content) ---------- */

.hero-carousel {
  position: relative;
  width: 100%;
  height: calc(var(--navbar-height) * 2);
  overflow: hidden;
  background: var(--bg);
}
.hero-carousel-track {
  display: flex;
  height: 100%;
  direction: ltr; /* keeps slide-advance math simple regardless of the page's RTL direction */
  transition: transform 0.6s ease;
}
.hero-carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* display: contents removes the link from the box model entirely, so its
   clickable area becomes exactly the rendered <img> below — not the
   full-width slide box, which would otherwise include the empty
   letterboxed space around a contain-fit image. */
.hero-carousel-slide-link { display: contents; }
.hero-carousel-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.hero-carousel-dots {
  position: absolute;
  bottom: 8px;
  inset-inline: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.hero-carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(22, 50, 92, 0.25);
  cursor: pointer;
}
.hero-carousel-dot.active { background: var(--navy); }

/* Physical left/right (not RTL-logical) on purpose, matching the track's
   forced direction: ltr — left always means "previous", right always
   means "next", regardless of the page's own RTL layout. */
.hero-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.hero-carousel-arrow:hover { background: #fff; }
.hero-carousel-arrow-prev { left: 10px; }
.hero-carousel-arrow-next { right: 10px; }
