
/* ===== Bulletproof consistency layer ===== */
:root{ color-scheme: dark; }
html{
  background: #212a4c;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body{
  background: #212a4c;
  min-height: 100%;
}

/* Prevent Windows High Contrast/Forced Colors from overriding */
@media (forced-colors: active){
  *{ forced-color-adjust: none; }
}

/* ===== Theme tokens ===== */
:root {
  /* Menlo premium palette */
  --brand: #344C7C;         /* logo blue */
  --brand-2: #22325a;       /* deeper blue */
  --brand-3: #4f6fc2;       /* highlight */
  --bg: #0b1533;            /* page background base */
  --surface: #ffffff;       /* cards */
  --surface-2: rgba(255,255,255,0.10); /* glass */
  --text: #0f172a;          /* card text */
  --text-on-dark: #f8fafc;  /* text on dark */
  --muted: #ffffff;
  --muted-on-dark: rgba(248,250,252,0.72);
  --accent: var(--brand);
  --accent-contrast: #ffffff;
  --accent-red: #b01e24;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 45px rgba(2, 6, 23, 0.22);
  --shadow-soft: 0 10px 30px rgba(2, 6, 23, 0.12);
  --ring: 0 0 0 4px rgba(79, 111, 194, 0.18);
  --border: rgba(255,255,255,0.12);
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { height: 100%; background: #212a4c; background: #212a4c; }
html { background: #212a4c; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, sans-serif;
  /* premium Menlo backdrop */
  background: #212a4c;
color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 28px; margin: 16px 0 12px; }
h2 { font-size: 20px; margin: 24px 0 12px; }
.muted { color: var(--muted); }
.status { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity: .8; margin: 8px 0 16px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 20px; }
.center { max-width: 480px; margin: 48px auto; padding: 20px; }

/* ===== Premium header (Sport uitslae) ===== */
.header{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding: 14px 18px;
  margin: 14px auto 18px;
  max-width: 980px;

  /* Blend into the Menlo-blue background */
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.18);

  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header h1{
  margin:0;
  font-size: 28px;
  letter-spacing: .2px;
  color: rgba(248,250,252,0.96);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: transparent;
  box-shadow: 0 8px 18px rgba(2,6,23,0.22);
  outline: 1px solid rgba(255,255,255,0.18);
}

/* Improve default section headings on dark background */
h2, h3 { color: var(--text-on-dark); }
.muted { color: var(--muted-on-dark); }
.status { color: var(--muted-on-dark); }

/* Make main cards feel premium on the dark backdrop */
.card, .panel, .container{
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===== Top bar ===== */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--surface);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 36px; width: auto; display:block; }
.logo-circle { width: 36px; height: 36px; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; font-weight: 700; }
.brand-text { display:flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 16px; }
.brand-text span { font-size: 12px; color: var(--muted); }

/* ===== Forms ===== */
.form label { display:block; font-weight:600; margin: 12px 0 6px; }
.form input, .form select, .form textarea, input[type="text"], input[type="number"], input[type="datetime-local"], select {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #e5e7eb; background: var(--surface); color: var(--text);
  outline: none; transition: border .15s, box-shadow .15s, transform .05s; font-size: inherit; font-family: inherit; box-sizing: border-box;
}
.form textarea { resize: vertical; min-height: 44px; }
.form input:focus, .form select:focus, .form textarea:focus, input:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.form-actions { display:flex; align-items:center; gap:12px; margin-top: 14px; }
.grid-2 { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== Buttons ===== */
.btn { appearance: none; border: none; cursor: pointer; font-weight: 600; border-radius: 12px; padding: 10px 14px; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid #e5e7eb; }
.btn-ghost:hover { background: rgba(0,0,0,.03); }
.btn-danger { background: var(--accent-red); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-red) 40%, transparent); }
.btn-danger:hover { filter: brightness(1.05); }


/* ===== Cards & grid ===== */
.grid-cards, #scoreboard { display:grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display:flex; flex-direction: column; gap: 8px; transition: transform .08s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(2,6,23,.12); }
.card-title { font-weight: 700; letter-spacing:.2px; }
.card-algemeen { font-size: 14px; font-style: italic; color: var(--muted); }
.card-scoreline { font-size: 16px; }
.score-win, .score-loss, .score-draw { font-weight: 700; }
.result-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin-top: 4px; }
.result-win  { background: rgba(34,197,94,0.15);  color: #16a34a; }
.result-loss { background: rgba(239,68,68,0.15);  color: #dc2626; }
.result-draw { background: rgba(148,163,184,0.2); color: var(--muted); }
.card-meta { color: var(--muted); font-size: 13px; }

/* ===== Callouts ===== */
.callout { border-radius: 12px; padding: 12px 14px; }
.callout-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }

/* ===== Links ===== */
a { color: rgba(248,250,252,0.92); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Hide debug/status line on admin page */
#statusLine{display:none;}


/* ===== Upgraded Top School Header ===== */
.toolbar {
  width: 100%;
  padding: 20px 50px;
  background: #22325A;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}

.brand {
  width: 100%;
  max-width: 1200px;
  text-align: center;
}

.brand-text strong {
  font-size: 24px;
  letter-spacing: 0.6px;
  color: #ffffff;
}


/* ===== FIX: Pill headers + Sticky archive toggle ===== */

/* Solid app background */
html, body { background: #212a4c; }

/* Sport uitslae pill (and reuse for archived header) */
.header{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding: 14px 18px;
  margin: 14px auto 14px;
  max-width: 980px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 26px rgba(0,0,0,0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header h1{
  margin:0;
  font-size: 28px;
  letter-spacing: .2px;
  color: rgba(255,255,255,0.96);
  text-align:center;
  width: 100%;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

/* Archived header should look identical, just a bit more spacing above */
.archived-header{ margin-top: 22px; }

/* Button below the archived pill, centered */
.archive-actions{
  display:flex;
  justify-content:center;
  margin: 8px 0 18px;
}

.archive-sticky {
  position: sticky;
  top: 0;
  z-index: 150;
  background: #212a4c;
  padding: 8px 0;
}

/* Pill uses a 3-col grid: empty left | centred title | button right */
.archive-sticky .header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: 0 auto;
}

.archive-sticky .header-inner {
  grid-column: 2;
  justify-self: center;
}

.archive-sticky .btn-ghost {
  grid-column: 3;
  justify-self: end;
  color: #fff !important;
  border-color: rgba(255,255,255,0.4) !important;
}


/* Make sure toolbar stays above everything */
.toolbar{ position: sticky; top: 0; z-index: 200; }


/* ===== Explicit color locking for consistent rendering ===== */
.toolbar{
  background: #22325A !important;
  color: rgba(255,255,255,0.96) !important;
}
.toolbar strong, .toolbar .brand-text, .toolbar .brand-text strong{
  color: rgba(255,255,255,0.96) !important;
}

/* Main pills */
.header, .section-header{
  background: rgba(255,255,255,0.10) !important;
  border-color: rgba(255,255,255,0.14) !important;
}
.header h1, .section-header h2{
  color: rgba(255,255,255,0.96) !important;
}

/* Form labels/selects on dark background */
label{ color: rgba(255,255,255,0.92) !important; }
select, input, textarea{
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  color: rgba(255,255,255,0.95) !important;
}
select option{ color: #0f172a; }

/* Buttons */
.btn{
  background: rgba(255,255,255,0.12) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  color: rgba(255,255,255,0.96) !important;
}
.btn:hover{ background: rgba(255,255,255,0.18) !important; }
.btn:focus{ outline: none; box-shadow: 0 0 0 4px rgba(79,111,194,0.22) !important; }

/* Cards / content areas */
.card, .panel, .container, #scoreboard > *, #scoreboardArchived > *{
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  color: rgba(255,255,255,0.94) !important;
}


/* ===== Admin fixes (archive tools + danger buttons) ===== */

/* Admin archive tools bar should not be white */
#archiveTools.tools{
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  border-radius: 16px !important;
  padding: 12px 12px !important;
  box-shadow: 0 10px 26px rgba(0,0,0,0.20) !important;
}

/* Primary buttons should look "primary" again */
.btn-primary{
  background: rgba(79,111,194,0.80) !important;   /* brand highlight */
  border-color: rgba(79,111,194,0.95) !important;
  color: #ffffff !important;
}
.btn-primary:hover{
  background: rgba(79,111,194,0.92) !important;
}

/* Danger / delete buttons must stay red */
.btn-danger, .danger, .btn-delete, .delete{
  background: #b01e24 !important;
  border-color: #b01e24 !important;
  color: #ffffff !important;
}
.btn-danger:hover, .danger:hover, .btn-delete:hover, .delete:hover{
  background: #99191f !important;
  border-color: #99191f !important;
}
/* Admin info / system messages */
.admin-message,
.login-warning,
.edit-mode-text {
    color: #ffffff !important;
}

/* If messages are inside panels */
.panel .admin-message,
.panel .login-warning,
.panel .edit-mode-text {
    color: #ffffff !important;
}

/* Safety fallback: muted text override in admin */
.admin-container .muted {
    color: #ffffff !important;
}


/* ===== Extra spacing between filter and score cards (public index) ===== */
/* Works even if the filter isn't wrapped in .filters (fallback) */
.filters { margin-bottom: 28px; }

label[for="sportFilter"]{
  display:block;
  margin: 8px 0 8px;
}

#sportFilter{
  margin-bottom: 28px;
}

/* ===== Mobile: archive pill stacks vertically ===== */
@media (max-width: 680px) {
  .archive-sticky .header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
  }
  .archive-sticky .header-inner {
    justify-content: center;
  }
  .archive-sticky .header h1 {
    font-size: 20px;
  }
  .archive-sticky .btn-ghost {
    font-size: 13px;
    padding: 7px 20px;
    width: auto;
  }
}

#scoreboardActive{
  margin-top: 10px;
}

/* Utility: hide elements (used by archived toggle) */
.hidden { display: none !important; }
