@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;600;700;800&family=Baloo+2:wght@500;700&display=swap');

:root {
  --bg: #fff8ef;
  --panel: rgba(255, 255, 255, 0.82);
  --ink: #152038;
  --accent: #ff6b35;
  --accent-2: #079992;
  --danger: #d63031;
  --shadow: 0 15px 35px rgba(21, 32, 56, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'Be Vietnam Pro', sans-serif;
  background: radial-gradient(circle at 20% 20%, #ffd9c9 0, transparent 35%),
              radial-gradient(circle at 80% 10%, #d1fff7 0, transparent 30%),
              var(--bg);
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  z-index: -1;
  opacity: 0.45;
}

.orb-1 {
  width: 320px;
  height: 320px;
  left: -80px;
  top: 20vh;
  background: #ff9f6e;
}

.orb-2 {
  width: 300px;
  height: 300px;
  right: -100px;
  top: 10vh;
  background: #7de3dc;
}

.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: rgba(255, 248, 239, 0.75);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(21, 32, 56, 0.08);
}

.brand {
  text-decoration: none;
  color: var(--ink);
  font-family: 'Baloo 2', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.container {
  width: min(1100px, 92vw);
  margin: 20px auto 60px;
}

.hero-card,
.panel,
.match-card {
  background: var(--panel);
  border: 1px solid rgba(21, 32, 56, 0.07);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.hero-card h1,
.panel h2,
.match-card h3 {
  margin-top: 0;
}

.cards {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.cards.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-2 {
  margin-top: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  opacity: 0.85;
}

.score {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-2);
}

.score.pending {
  color: #717171;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  display: inline-block;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(21, 32, 56, 0.25);
  color: var(--ink);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: middle;
}

.badge-admin {
  background: #f59e0b;
  color: #fff;
}

input {
  width: 100%;
  border: 1px solid rgba(21, 32, 56, 0.2);
  border-radius: 12px;
  padding: 10px;
  margin: 6px 0 10px;
  font: inherit;
}

.inline-form,
.grid-form {
  display: grid;
  gap: 8px;
}

.alert {
  background: #edf8f7;
  border: 1px solid #8ad2cb;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}

.alert-danger {
  background: #ffeaea;
  border-color: #ffb1b1;
}

.list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.list li {
  padding: 9px 0;
  border-bottom: 1px dashed rgba(21, 32, 56, 0.18);
}

.list li:last-child {
  border-bottom: 0;
}

.hint {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #646464;
}

/* ── Tables ─────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  padding: 0 8px 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table thead tr {
  background: linear-gradient(90deg, var(--accent) 0%, #e84f20 100%);
  color: #fff;
}

.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(21, 32, 56, 0.07);
  font-size: 0.9rem;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(255, 107, 53, 0.05);
}

.data-table .row-finished td {
  opacity: 0.65;
}

.data-table .row-locked td {
  background: rgba(21, 32, 56, 0.03);
}

.col-id   { width: 48px; color: #aaa; font-size: 0.8rem; }
.col-team { min-width: 120px; font-weight: 600; }
.col-score { text-align: center; }
.col-pred  { min-width: 140px; }

/* ── Status badges ───────────────────────────────── */
.badge-finished { background: #6c757d; color: #fff; }
.badge-live     { background: #ff6b35; color: #fff; animation: pulse-bg 1.5s infinite; }
.badge-pending  { background: #cce5ff; color: #004085; }
.badge-win      { background: #079992; color: #fff; margin-left: 4px; }
.badge-miss     { background: #d63031; color: #fff; margin-left: 4px; }
.badge-debt     { background: #d63031; color: #fff; margin-left: 6px; font-size: 0.72rem; }

@keyframes pulse-bg {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ── Inline form inside table cell ─────────────── */
.inline-form.row-form {
  display: flex;
  align-items: center;
  gap: 5px;
}

.input-sm {
  width: 56px;
  padding: 4px 6px;
  font-size: 0.85rem;
  border: 1px solid rgba(21, 32, 56, 0.25);
  border-radius: 8px;
  text-align: center;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: #e84f20;
}

/* ── Colour helpers ─────────────────────────────── */
.text-green { color: #079992; }
.text-red   { color: #d63031; }
.text-muted { color: #999; font-size: 0.85rem; }
.pred-score { font-weight: 700; }

/* Keep rank column visible when dashboard table scrolls horizontally */
.dashboard-table th:first-child,
.dashboard-table td:first-child {
  position: sticky;
  left: 0;
}

.dashboard-table th:first-child {
  z-index: 3;
}

.dashboard-table td:first-child {
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
}

.dashboard-table tbody tr:hover td:first-child {
  background: rgba(255, 107, 53, 0.14);
}

/* Admin matches: do not use sticky columns, avoids overlap on desktop */
.admin-matches-table th:first-child,
.admin-matches-table td:first-child {
  position: static !important;
  left: auto !important;
  z-index: auto !important;
}

.manage-cell {
  min-width: 300px;
}

.match-manage-form {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.input-stake {
  width: 86px;
}

.match-manage-form .text-muted {
  width: 100%;
}

.compact-list {
  margin-top: 8px;
}

.expand-content td {
  background: rgba(21, 32, 56, 0.03);
}

.expand-row:hover {
  background: rgba(255, 107, 53, 0.08);
}

.reconciliation-table th,
.reconciliation-table td {
  white-space: nowrap;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand {
    font-size: 1.3rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 9px;
    font-size: 0.82rem;
  }
}

/* Striped rows */
.data-table.striped tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.6);
}
.data-table.striped tbody tr:nth-child(even) {
  background: rgba(21, 32, 56, 0.035);
}
.data-table.striped tbody tr:hover {
  background: rgba(255, 107, 53, 0.08) !important;
}

.col-match { min-width: 200px; }

.vs-sep {
  margin: 0 6px;
  color: #aaa;
  font-size: 0.78rem;
  font-weight: 400;
}

.match-desc {
  font-weight: 600;
  color: var(--accent-2);
}

.fst-italic { font-style: italic; }

/* Inline description edit */
.desc-edit {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}

.desc-edit summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.8rem;
  opacity: 0.55;
  padding: 0;
}
.desc-edit summary:hover { opacity: 1; }
.desc-edit[open] summary { opacity: 1; }

.input-desc {
  width: 220px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid rgba(21,32,56,0.25);
  border-radius: 8px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Collapsible panel transition */
.collapsible {
  animation: slideDown 0.18s ease;
}
@keyframes slideDown {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0); }
}
