/* LMU Fixture board styling. Plain CSS, no framework. */

:root {
  --c-bg: #f6f7f9;
  --c-fg: #1a1c20;
  --c-muted: #6b7280;
  --c-border: #d8dde4;
  --c-card: #ffffff;
  --c-club: #0c8a4d;        /* LMU green */
  --c-club-dark: #06632f;
  --c-warn: #b45309;
  --c-error: #b91c1c;

  --tier-senior: #2563eb;
  --tier-u16_18: #4338ca;
  --tier-u15:    #6d28d9;
  --tier-u14:    #9333ea;
  --tier-u12_13: #be185d;
  --tier-u10_11: #ea580c;
  --tier-7v7:    #15803d;
  --tier-4v4:    #047857;
  --tier-unknown: #4b5563;

  --slot-w: 56px;
  --row-h: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-fg);
  font-size: 14px;
}

a { color: var(--c-club-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .link-button {
  font: inherit;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}
button:hover { border-color: var(--c-club); }
button.link-button { border: 0; padding: 0; color: var(--c-club-dark); background: none; }
button.danger { color: var(--c-error); border-color: var(--c-error); }

input[type=text], input[type=password], input[type=date], input[type=time],
select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-card);
}

form.inline { display: inline-block; }

.muted { color: var(--c-muted); }
.error { color: var(--c-error); }
.warn  { color: var(--c-warn); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--c-club);
  color: white;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar a { color: white; }
.topbar .brand a { font-weight: 600; font-size: 16px; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }
.tabs { display: flex; gap: 0; align-items: stretch; height: 100%; margin: -10px 0; }
.tabs .tab {
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: rgba(255,255,255,0.85);
  border-bottom: 3px solid transparent;
  text-decoration: none;
  font-weight: 500;
}
.tabs .tab:hover { color: white; background: rgba(0,0,0,0.1); text-decoration: none; }
.tabs .tab.active {
  color: white;
  border-bottom-color: white;
  background: rgba(0,0,0,0.15);
}
.map-wrap {
  margin-top: 16px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  overflow: auto;
  max-width: 100%;
}
.map-img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---- Home / All games tab ---------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.featured-section {
  background: linear-gradient(135deg, #fef3c7 0%, #fef9e6 100%);
  border: 1px solid #fcd34d;
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 24px;
}
.featured-section h2 { margin: 0; font-size: 16px; color: #78350f; }
.featured-list { list-style: none; padding: 0; margin: 0; }
.featured-item {
  background: white;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.featured-item.pinned {
  border-color: #f59e0b;
  border-left: 4px solid #f59e0b;
}
.featured-content { flex: 1; }
.featured-title { display: block; margin-bottom: 4px; }
.featured-body { font-size: 13px; color: var(--c-fg); margin: 4px 0; }
.featured-link { font-size: 12px; }
.featured-actions { display: flex; gap: 8px; flex-shrink: 0; }
.featured-actions .link-button { font-size: 12px; }
.featured-actions .danger { color: var(--c-error); }
.pin-badge { margin-right: 6px; }

.featured-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
  border: 1px solid #fde68a;
  padding: 12px 14px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.featured-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--c-muted);
}
.featured-form .inline-row {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--c-fg);
}
.featured-form button[type="submit"] {
  align-self: flex-start;
  background: var(--c-club);
  color: white;
  border-color: var(--c-club);
}

.day-heading {
  margin: 16px 0 8px;
  padding-left: 4px;
  border-left: 4px solid var(--c-club);
  font-size: 16px;
}
.day-heading.today {
  border-left-width: 6px;
  background: linear-gradient(90deg, rgba(12,138,77,0.12), transparent 40%);
  padding: 4px 4px 4px 8px;
}
.today-badge {
  display: inline-block;
  background: var(--c-club);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  margin-left: 6px;
  vertical-align: middle;
}
.games-list { list-style: none; padding: 0; margin: 0; }
.game-row {
  display: grid;
  grid-template-columns: 60px 70px 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 13px;
}
.game-row.is-home { border-left: 4px solid var(--c-club); }
.game-row.is-away { border-left: 4px solid #94a3b8; opacity: 0.92; }
.game-row .time { font-weight: 600; }
.game-row .vs { color: var(--c-muted); margin: 0 4px; }
.game-row .lmu { color: var(--c-club-dark); }
.game-row .meta { font-size: 11px; color: var(--c-muted); }
.game-row .round {
  margin-left: 6px;
  background: rgba(0,0,0,0.05);
  padding: 1px 5px;
  border-radius: 2px;
}
.game-row .venue { font-size: 12px; color: var(--c-muted); }
.game-row .feature-btn {
  font-size: 18px;
  color: #d97706;
  padding: 0 6px;
  cursor: pointer;
  background: none;
  border: 0;
}
.game-row .feature-btn:hover { color: #b45309; }
.game-row {
  grid-template-columns: 60px 70px 1fr 1fr 1fr auto;
}
.home-away-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
}
.home-away-badge.home { background: var(--c-club); color: white; }
.home-away-badge.away { background: #cbd5e1; color: #1e293b; }
@media (max-width: 800px) {
  .game-row {
    grid-template-columns: 50px 60px 1fr;
    grid-template-rows: auto auto;
  }
  .game-row .meta, .game-row .venue { grid-column: 1 / -1; }
}

/* ---- Changeroom / Canteen allocation tables ---------------------------- */
table.alloc-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 4px;
}
table.alloc-table th, table.alloc-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
  vertical-align: top;
}
table.alloc-table tr.uncovered td { background: rgba(239, 68, 68, 0.04); }
table.alloc-table tr.covered td { background: rgba(16, 185, 129, 0.04); }
.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,0,0,0.06);
}
.alloc-table .lmu { color: var(--c-club-dark); }
.alloc-table .vs { color: var(--c-muted); margin: 0 4px; }
.volunteer-form { display: flex; gap: 6px; align-items: center; }
.volunteer-form input[type="text"] { flex: 1; min-width: 140px; }
.audit { color: var(--c-muted); margin-top: 2px; font-size: 11px; }

.reserved-pill {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(0,0,0,0.06);
  color: var(--c-muted);
  border-radius: 999px;
  font-size: 12px;
}
.reserve-btn {
  cursor: pointer;
  display: inline-block;
  padding: 6px 14px;
  background: var(--c-club);
  color: white;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
}
.reserve-btn::-webkit-details-marker { display: none; }
.reserve-btn:hover { background: var(--c-club-dark); }
.reserve-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  background: white;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  max-width: 320px;
}
.reserve-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--c-muted);
}
.reserve-form button {
  align-self: flex-start;
  background: var(--c-club);
  color: white;
  border-color: var(--c-club);
  padding: 6px 14px;
}
.reserve-form .small { font-size: 11px; margin: 0; }
.success { color: #065f46; background: #d1fae5; padding: 8px 12px; border-radius: 4px; }
.topbar-actions form button,
.topbar-actions a {
  color: white;
  background: rgba(0,0,0,0.15);
  border-color: rgba(255,255,255,0.3);
}
.topbar-actions form button:hover { background: rgba(0,0,0,0.3); }
.badge {
  background: white;
  color: var(--c-club);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}

/* Page sections */
.page { max-width: 100%; padding: 16px 24px; }
.weekend-header .nav {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.weekend-header h1 { margin: 0; font-size: 22px; }
.weekend-nav { padding: 6px 12px; border: 1px solid var(--c-border); border-radius: 4px; background: var(--c-card); }
.weekend-nav.small { padding: 3px 10px; font-size: 12px; }
.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-stack.right { align-items: flex-end; }
.load-more-bar {
  margin-top: 16px;
  padding: 12px 0;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.load-more {
  padding: 10px 20px;
  background: var(--c-club);
  color: white;
  border-radius: 4px;
  font-weight: 600;
}
.load-more:hover {
  background: var(--c-club-dark);
  text-decoration: none;
}
.load-more.secondary {
  background: var(--c-card);
  color: var(--c-fg);
  border: 1px solid var(--c-border);
}
.venue-heading {
  margin: 24px 0 8px;
  padding-left: 4px;
  border-left: 4px solid var(--c-club);
  font-size: 18px;
}

/* Timeline grid */
.timeline-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--c-border);
  background: var(--c-card);
  border-radius: 4px;
  cursor: grab;
  user-select: none;
  /* Establish a positioning context so sticky children resolve against the
     wrap's scrollport, not the outer page. */
  position: relative;
}
.timeline-wrap.dragging {
  cursor: grabbing;
}
.timeline-wrap .cell.game,
.timeline-wrap button,
.timeline-wrap select,
.timeline-wrap a,
.timeline-wrap input,
.timeline-wrap details,
.timeline-wrap summary {
  cursor: auto;
}
.timeline-wrap .cell.game { cursor: pointer; }
.timeline-wrap .cell.empty[data-add-time] { cursor: cell; }
.timeline-wrap .cell.empty[data-add-time]:hover {
  background: rgba(12, 138, 77, 0.06);
  outline: 1px dashed var(--c-club);
  outline-offset: -1px;
}
.timeline {
  display: grid;
  grid-auto-rows: var(--row-h);
  /* Without this, large grids (e.g. whole-season view) get squashed by the
     scroll container's intrinsic-width calc and every track shrinks to a
     fraction of a pixel. max-content forces the grid to its declared size. */
  width: max-content;
}
.cell {
  border-right: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  position: relative;
  overflow: hidden;
}
.cell.header {
  position: sticky;
  top: 0;
  background: #eef0f3;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  z-index: 5;
  border-bottom: 2px solid var(--c-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 6px;
  white-space: nowrap;
}
.cell.header.corner {
  z-index: 10;
  background: #e6e9ed;
  justify-content: center;
  align-items: center;
  will-change: transform;
}
.cell.header .hour { font-size: 12px; }
.cell.header .half { color: var(--c-muted); }
.cell.header .daytag {
  position: absolute;
  top: 2px;
  left: 6px;
  background: var(--c-club);
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}
.cell.header.sat { background: #f5f7fa; }
.cell.header.sun { background: #f7f5fa; }
.cell.header.fri { background: #fafaf6; }

/* Visual marker on slots that follow a hidden overnight band. */
.cell.after-gap {
  border-left: 4px double var(--c-club);
}
.cell.header.after-gap::before {
  content: "···";
  position: absolute;
  top: 18px;
  left: -10px;
  font-size: 10px;
  color: var(--c-muted);
  background: white;
  padding: 0 2px;
}

.cell.label {
  /* Pinning is done in JS (translateX on scroll). z-index keeps it on top of
     scrolling cells. */
  z-index: 4;
  background: #f9fafb;
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-right: 2px solid var(--c-border);
  will-change: transform;
}
.cell.empty {
  background: var(--c-card);
}
.cell.blocked {
  background-image: repeating-linear-gradient(
    45deg,
    #e5e7eb,
    #e5e7eb 4px,
    #f3f4f6 4px,
    #f3f4f6 8px
  );
}

/* Game block */
.cell.game {
  background: var(--c-card);
  border: 1px solid var(--tier-unknown);
  border-radius: 4px;
  margin: 2px;
  padding: 4px 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr auto;
  font-size: 11px;
  line-height: 1.25;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
  cursor: default;
}
.cell.game.tier-senior  { border-color: var(--tier-senior);  background: color-mix(in srgb, var(--tier-senior) 6%, white); }
.cell.game.tier-u16_18  { border-color: var(--tier-u16_18);  background: color-mix(in srgb, var(--tier-u16_18) 6%, white); }
.cell.game.tier-u15     { border-color: var(--tier-u15);     background: color-mix(in srgb, var(--tier-u15) 6%, white); }
.cell.game.tier-u14     { border-color: var(--tier-u14);     background: color-mix(in srgb, var(--tier-u14) 6%, white); }
.cell.game.tier-u12_13  { border-color: var(--tier-u12_13);  background: color-mix(in srgb, var(--tier-u12_13) 6%, white); }
.cell.game.tier-u10_11  { border-color: var(--tier-u10_11);  background: color-mix(in srgb, var(--tier-u10_11) 6%, white); }
.cell.game.tier-7v7     { border-color: var(--tier-7v7);     background: color-mix(in srgb, var(--tier-7v7) 6%, white); }
.cell.game.tier-4v4     { border-color: var(--tier-4v4);     background: color-mix(in srgb, var(--tier-4v4) 6%, white); }
.cell.game.manual       { border-style: dashed; }

.game-time {
  grid-column: 2;
  grid-row: 1;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
}
.game-round {
  grid-column: 3;
  grid-row: 1;
  font-size: 10px;
  color: var(--c-muted);
  font-weight: 600;
  background: rgba(0,0,0,0.05);
  padding: 1px 5px;
  border-radius: 2px;
  align-self: start;
}
.logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 2px;
}
.logo.home { grid-column: 1; grid-row: 1 / 3; align-self: center; }
.logo.away { grid-column: 3; grid-row: 2 / 4; align-self: center; justify-self: end; }
.game-label {
  grid-column: 2;
  grid-row: 2;
  text-align: center;
  font-size: 10px;
  overflow: hidden;
}
.game-comp {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-teams {
  font-size: 9px;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-teams .vs { margin: 0 4px; }
/* Game-details modal */
.game-modal {
  border: none;
  border-radius: 6px;
  padding: 0;
  max-width: 480px;
  width: 90vw;
  background: var(--c-card);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.game-modal::backdrop { background: rgba(0,0,0,0.45); }
.modal-card {
  position: relative;
  padding: 24px;
}
.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  background: none;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--c-muted);
  padding: 4px 8px;
}
.modal-close:hover { color: var(--c-fg); }
.modal-title { margin: 0 24px 12px 0; font-size: 18px; }
.modal-body dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px 12px;
  margin: 0;
}
.modal-body dt { color: var(--c-muted); font-size: 12px; }
.modal-body dd { margin: 0; font-size: 13px; }
.modal-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-form {
  display: flex;
  gap: 8px;
  align-items: end;
}
.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  font-size: 12px;
  color: var(--c-muted);
}
.modal-form-stacked {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 16px 0;
  padding: 12px;
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: 4px;
}
.modal-form-stacked label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--c-muted);
}
.modal-form-stacked label.full { grid-column: 1 / -1; }
.modal-form-stacked .row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.modal-form-stacked .radio-row {
  display: flex;
  gap: 14px;
  font-size: 14px;
  color: var(--c-fg);
}
.modal-form-stacked .inline {
  flex-direction: row !important;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--c-fg);
}
.modal-form-stacked button[type="submit"] {
  align-self: flex-start;
  background: var(--c-club);
  color: white;
  border-color: var(--c-club);
  padding: 8px 16px;
}
.modal-form-stacked button[type="submit"]:hover { background: var(--c-club-dark); }

/* Unallocated table */
table.unalloc {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
}
table.unalloc th, table.unalloc td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--c-border);
}

/* Manual form */
.manual-form-wrap summary { cursor: pointer; padding: 8px 0; }
.manual-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  padding: 16px;
  border-radius: 4px;
  margin-top: 8px;
}
.manual-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--c-muted);
}
.manual-form button {
  align-self: end;
  background: var(--c-club);
  color: white;
  border-color: var(--c-club);
}
.manual-form button:hover { background: var(--c-club-dark); }
.manual-form label.full { grid-column: 1 / -1; }
.manual-form .radio-row {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--c-fg);
}
.manual-form .inline { flex-direction: row; align-items: center; gap: 4px; }

/* Login */
.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: var(--c-card);
  padding: 32px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
}
.login-box h1 { margin-top: 0; }
.login-box label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.login-links {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 16px 0 8px;
  font-size: 13px;
}

/* Changes view */
.changes-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 12px 16px;
  border-radius: 4px;
}
.changes-banner ul { margin: 8px 0; padding-left: 20px; }
.changes-banner li.added    { color: #065f46; }
.changes-banner li.removed  { color: #991b1b; }
.changes-banner li.modified { color: #92400e; }
table.changes {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
  margin-top: 12px;
}
table.changes th, table.changes td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--c-border);
  font-size: 12px;
}
table.changes tr.added    td { background: rgba(16, 185, 129, 0.05); }
table.changes tr.removed  td { background: rgba(239, 68, 68, 0.05); }
table.changes tr.modified td { background: rgba(245, 158, 11, 0.05); }
