
/* =========================================================
   Modern baseline styles for a legacy PHP site (no framework)
   - Neutral dark theme (easy to tweak)
   - Clean typography & spacing
   - Better tables, forms, buttons, cards
   - Utility classes for layout
   ========================================================= */

/* ---------- Color system (fallback-friendly) ---------- */
:root {
  --bg: #0b0f1a;
  --panel: #111827;
  --panel-2: #0f172a;
  --border: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --link: #93c5fd;
  --brand: #3b82f6;
  --brand-contrast: #ffffff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;
}

/* Base */
body {
  font-family: Inter, Arial, sans-serif;
  background: #0b0f1a;
  color: #e5e7eb;
  margin: 0;
  padding: 20px;
  line-height: 1.6;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Headings */
h1, h2, h3 {
  font-weight: 600;
  margin-bottom: 12px;
}

/* Card */
.card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  background: #111827;
  border-radius: 8px;
  overflow: hidden;
}
.table th, .table td {
  padding: 10px 14px;
  border-bottom: 1px solid #1f2937;
}
.table th {
  background: #1f2937;
  font-weight: 600;
}
.table tr:hover {
  background: rgba(59,130,246,0.08);
}

/* Zebra striping */
.table tr:nth-child(odd) {
  background: #0f172a;
}

/* Payment status */
.status {
  font-weight: bold;
  color: #f87171; /* red for NOT PAID */
}

/* Textarea */
textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #0f172a;
  color: #e5e7eb;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover {
   background: #2563eb;
}

/* ---------- CSS Reset (safe) ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Base ---------- */
html { background: var(--bg); }
body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

/* Links */
a { color: var(--link); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

/* Headings */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .75rem 0;
  line-height: 1.25;
  font-weight: 700;
}
h1 { font-size: 1.875rem; } /* 30px */
h2 { font-size: 1.5rem; }   /* 24px */
h3 { font-size: 1.25rem; }  /* 20px */
p { margin: 0 0 1rem 0; color: var(--text); }

/* Code blocks & inline code */
code, pre {
  font-family: SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
}

/* ---------- Layout utilities ---------- */

.section { padding: 16px 0; }
.section + .section { border-top: 1px solid var(--border); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stack > * + * { margin-top: 12px; } /* vertical spacing helper */

/* Panels / cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--brand);
  color: var(--brand-contrast);
  font-weight: 600;
  text-align: center;
}
.btn:hover { filter: brightness(1.05); }
.btn:focus { outline: 2px solid #2563eb; outline-offset: 2px; }

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-danger   { background: var(--danger); }
.btn-success  { background: var(--success); }
.btn-warning  { background: var(--warning); color: #1f2937; }

/* Button group */
.btn-group { display: inline-flex; gap: 8px; }

/* ---------- Forms ---------- */
.form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #6b7280; }
textarea { min-height: 120px; }

/* Checkbox & radio alignment */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-help  { color: var(--muted); font-size: 12px; }

/* ---------- Legacy bare table styling ---------- */
/* Styles all <table border=1> elements site-wide without touching PHP */
table {
  border-collapse: collapse;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
  margin-bottom: 16px;
}
table th {
  background: #0f1a2e;
  color: var(--text);
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  border: none;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table td {
  padding: 8px 12px;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}
table tr:hover td { background: rgba(59, 130, 246, 0.08); }
table tbody tr:nth-child(odd) td { background: #0e1423; }
table tbody tr:nth-child(odd):hover td { background: rgba(59, 130, 246, 0.08); }
/* Remove legacy HTML border attribute appearance */
table[border] { border: 1px solid var(--border) !important; }
table[border] td, table[border] th { border: none; border-top: 1px solid var(--border); }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden; /* round corners on tbody */
}
.table caption {
  caption-side: top;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
}
.table thead th {
  background: #0f1a2e;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.table tbody tr:hover { background: rgba(59, 130, 246, 0.08); }

/* Zebra (optional) */
.table.zebra tbody tr:nth-child(odd) { background: #0e1423; }

/* Compact (optional) */
.table.compact thead th,
.table.compact tbody td { padding: 6px 8px; }

/* Status badges for table cells */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.badge.success { background: rgba(34,197,94,0.15); color: #34d399; border-color: rgba(34,197,94,0.3); }
.badge.warning { background: rgba(245,158,11,0.15); color: #fbbf24; border-color: rgba(245,158,11,0.3); }
.badge.danger  { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Pagination */
.table-pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.alert + .alert { margin-top: 8px; }
.alert-success { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.12); color: #34d399; }
.alert-warning { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.12); color: #fbbf24; }
.alert-danger  { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.12); color: #f87171; }

/* ---------- Header spacing helpers ---------- */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 16px 0;
}
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-actions { display: inline-flex; gap: 8px; }

/* ---------- Footer ---------- */
footer.site {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 16px;
  background: var(--panel);
}

/* ---------- Misc utilities ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.right  { text-align: right; }
.pad    { padding: 16px; }
.pad-sm { padding: 8px; }
.pad-lg { padding: 24px; }
.round  { border-radius: 12px; }
.border { border: 1px solid var(--border); }
.hidden { display: none !important; }


.sr-only { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

.mobile-select-nav {
  display: none !important;
}

/* ---------- Home page ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 700px) { .home-grid { grid-template-columns: 1fr; } }

.team-list { list-style: none; margin: 0; padding: 0; }
.team-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.team-list li:last-child { border-bottom: none; }
.team-list .team-name { font-weight: 600; }
.team-list .team-rank { font-size: 13px; color: var(--muted); }
.rank-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--brand); color: #fff; }

.payment-paid   { color: #34d399; font-weight: 700; }
.payment-unpaid { color: #f87171; font-weight: 700; }
.payment-credit { color: #fbbf24; font-weight: 700; }

/* ---------- Comments ---------- */
.comment-list { display: flex; flex-direction: column; gap: 12px; max-height: 320px; overflow-y: auto; margin-bottom: 16px; padding-right: 4px; }
.comment-item { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.comment-meta strong { color: var(--text); }
.comment-body { font-size: 14px; line-height: 1.5; }
.comment-form textarea { width: 100%; margin-bottom: 10px; }
.comment-form button { cursor: pointer; border: none; }


/* ---------- Responsive helpers ---------- */
@media (max-width: 640px) {
  .hide-sm   { display: none !important; }
  .page-header { flex-direction: column; gap: 8px; }
}

/* ===== Light theme override ===== */
.light {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --link: #2563eb;
  --brand: #2563eb;
  --brand-contrast: #ffffff;

  --row-win-bg:     rgba(34,197,94,0.10);
  --row-lose-bg:    rgba(239,68,68,0.10);
  --row-pending-bg: rgba(245,158,11,0.10);
  --row-info-bg:    rgba(59,130,246,0.10);
}

/* Light-specific fine-tuning for tables */
.light .table thead th { background: #f1f5f9; color: var(--text); border-bottom: 1px solid var(--border); }
.light .table tbody td { border-top: 1px solid var(--border); }

/* Light zebra + hover */
.light .table.zebra tbody tr:nth-child(odd):not(.over-cap):not(.row-win):not(.row-lose):not(.row-pending):not(.row-info) {
  background: #f8fafc;
}
.light .table tbody tr:hover { background: rgba(59,130,246,0.06); }

/* Light over-cap emphasis (slightly stronger) */
.light .table tbody tr.over-cap { background: #fee2e2; }
.light .table tbody tr.over-cap:hover { background: #fecaca; }


