/* ============================================================
   Athens Debate — Tournaments · Design system v2
   Palette kept from v1: navy / gold / light gray, teal favicon.
   ============================================================ */
:root {
  --navy:       #1b2a4a;
  --navy-2:     #24365c;   /* lighter navy for hovers/panels */
  --gold:       #c9a227;
  --gold-soft:  #f3e8c4;
  --teal:       #2a7f81;
  --teal-2:     #236b6d;   /* darker teal for hovers */
  --bg:         #f4f5f8;
  --card:       #ffffff;
  --text:       #232a35;
  --muted:      #6b7280;
  --line:       #e5e7eb;
  --green:      #2e7d4f;
  --green-bg:   #e2f3e9;
  --amber:      #9a6b00;
  --amber-bg:   #fdf1d2;
  --red:        #b3372f;
  --red-bg:     #fbe4e2;
  --blue:       #2b6cb0;
  --blue-bg:    #e3edf7;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 1px 3px rgba(27,42,74,.08), 0 4px 16px rgba(27,42,74,.06);
  --shadow-lg:  0 4px 12px rgba(27,42,74,.12), 0 12px 32px rgba(27,42,74,.10);
  --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
}

/* ---------- Top navigation ---------- */
.topnav {
  background: var(--teal); color: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.topnav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1.5rem; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; font-size: 1.12rem; color: #fff; text-decoration: none; }
.navlinks { display: flex; gap: .25rem; margin-left: auto; }
.navlinks a {
  color: #d7e8e8; text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: .45rem .85rem; border-radius: 999px; transition: background .15s, color .15s;
}
.navlinks a:hover { color: #fff; background: var(--teal-2); }
.navlinks a.on { color: var(--navy); background: var(--gold); }

/* ---------- Layout ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-hero { text-align: center; margin: 1.5rem 0 2.25rem; }
.page-hero h1 { font-size: 2rem; color: var(--navy); margin: 0 0 .35rem; letter-spacing: -.01em; }
.page-hero p { color: var(--muted); margin: 0; font-size: 1.05rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }
.card h2 { margin: 0 0 1rem; font-size: 1.25rem; color: var(--navy); }
.card h3 { margin: 1.25rem 0 .6rem; font-size: 1.05rem; color: var(--navy); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.tcard {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.35rem; cursor: pointer; border: 2px solid transparent;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  display: flex; flex-direction: column; gap: .4rem;
}
.tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.tcard .t-name { font-weight: 700; font-size: 1.15rem; color: var(--navy); }
.tcard .t-meta { color: var(--muted); font-size: .95rem; }

/* ---------- Badges / pills ---------- */
.pill { display: inline-block; padding: .18rem .7rem; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.pill.open    { background: var(--green-bg); color: var(--green); }
.pill.upcoming{ background: var(--blue-bg);  color: var(--blue); }
.pill.closed  { background: var(--line);     color: var(--muted); }
.pill.completed { background: var(--gold-soft); color: var(--amber); }
.pill.draft   { background: var(--red-bg);   color: var(--red); }
.pill.elem    { background: var(--blue-bg);  color: var(--blue); }
.pill.middle  { background: var(--green-bg); color: var(--green); }
.pill.high    { background: var(--amber-bg); color: var(--amber); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: none; cursor: pointer; font-family: inherit; font-weight: 700;
  font-size: .97rem; padding: .6rem 1.3rem; border-radius: 999px;
  transition: background .15s, transform .1s; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: .35rem .9rem; font-size: .88rem; }

/* ---------- Forms ---------- */
label.f-label { display: block; font-weight: 600; font-size: .92rem; color: var(--navy); margin: .9rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: .6rem .8rem; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 1rem;
  background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.18);
}
textarea { resize: vertical; min-height: 96px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.f-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.f-hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

/* checkbox chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: .4rem .95rem; border-radius: 999px;
  border: 1.5px solid var(--line); font-size: .93rem; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all .12s; background: #fff;
}
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: .96rem; }
.tbl th {
  text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: .55rem .75rem; border-bottom: 2px solid var(--line);
}
.tbl td { padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: #fafbfd; }

/* ---------- Messages ---------- */
.msg { display: none; padding: .7rem 1rem; border-radius: var(--radius-sm); font-weight: 600; margin: .9rem 0; }
.msg.on { display: block; }
.msg.ok  { background: var(--green-bg); color: var(--green); }
.msg.err { background: var(--red-bg); color: var(--red); }
.msg.info{ background: var(--blue-bg); color: var(--blue); }

/* ---------- Admin layout (sidebar) ---------- */
.admin-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
#admin-main { min-width: 0; }
#admin-main .card { overflow-x: auto; }   /* wide tables scroll inside their card */
.admin-side {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .9rem; position: sticky; top: 76px;
}
.aside-sec { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: .8rem .7rem .3rem; }
.aside-link {
  display: block; padding: .5rem .7rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; cursor: pointer;
}
.aside-link:hover { background: var(--bg); }
.aside-link.on { background: var(--navy); color: #fff; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.spinner { text-align: center; color: var(--muted); padding: 2rem; }
.hidden { display: none !important; }
a.tx-link { color: var(--teal); font-weight: 600; }

footer.site-foot { text-align: center; color: var(--muted); font-size: .88rem; padding: 2rem 1rem 3rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .35rem; border-bottom: 2px solid var(--line); margin: 1.25rem 0 1.5rem; overflow-x: auto; }
.tab {
  padding: .55rem 1.1rem; font-weight: 700; font-size: .95rem; color: var(--muted);
  cursor: pointer; border: none; background: none; font-family: inherit;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tab:hover { color: var(--navy); }
.tab.on { color: var(--navy); border-bottom-color: var(--gold); }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(27,42,74,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 1.6rem;
}
.modal h2 { margin-top: 0; color: var(--navy); }

/* ---------- Logistics table ---------- */
.logi { width: 100%; border-collapse: collapse; }
.logi th {
  text-align: left; width: 34%; padding: .7rem .85rem; color: var(--navy);
  font-size: .95rem; vertical-align: top; background: var(--bg);
  border-bottom: 1px solid var(--line); border-radius: 0;
}
.logi td { padding: .7rem .85rem; border-bottom: 1px solid var(--line); }

/* ---------- Grade section headers (entry list) ---------- */
.grade-head {
  font-size: 1.15rem; font-weight: 700; color: #fff; padding: .55rem 1rem;
  border-radius: var(--radius-sm); margin: 1.4rem 0 .65rem;
}
.grade-head.elem   { background: #5ba3d0; }
.grade-head.middle { background: #5aaa5a; }
.grade-head.high   { background: #d08c3a; }

/* ---------- Registration steps ---------- */
.steps { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.4rem; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: .9rem;
  background: var(--line); color: var(--muted);
}
.step-dot.on { background: var(--gold); color: var(--navy); }
.step-lbl { font-weight: 600; font-size: .92rem; color: var(--muted); }
.step-lbl.on { color: var(--navy); }

/* ---------- Prep page builder (12-unit flex layout; fractional widths allowed) ---------- */
.pb-grid { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.pb-box { flex: 0 0 100%; max-width: 100%; min-width: 0; }
.pb-minor .card { background: #fbfcfe; }
.pb-minor h2 { font-size: 1.35rem; }
.pb-minor .pb-blurb { display: block; padding: .45rem 0; border-bottom: 1px solid var(--line);
  color: var(--teal); font-weight: 600; font-size: .93rem; text-decoration: none; }
.pb-minor .pb-blurb:hover { color: var(--navy); }
.pb-rich a { color: var(--teal); font-weight: 600; }
.pb-rich p { margin: .4rem 0; }

/* builder (admin) */
.pb-edit-box {
  position: relative; border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 2.4rem .35rem 2.2rem;   /* reserved strips: toolbar above, size field below */
  background: #fff;
}
.pb-edit-box:hover { border-color: var(--gold); }
.pb-edit-box.dragging { opacity: .45; }
.pb-drag {
  position: absolute; top: .45rem; left: .6rem; cursor: grab; z-index: 5;
  font-size: 1rem; color: var(--muted); background: var(--bg);
  border-radius: 6px; padding: .1rem .45rem; user-select: none;
}
.pb-resize {
  position: absolute; top: 0; right: -7px; width: 16px; height: 100%;
  cursor: col-resize; z-index: 6; touch-action: none;
}
.pb-resize::after { content: ''; position: absolute; top: 40%; bottom: 40%; left: 3px;
  width: 4px; border-radius: 2px; background: var(--line); }
.pb-edit-box:hover .pb-resize::after { background: var(--gold); }
.pb-tools { position: absolute; top: .35rem; right: .7rem; z-index: 5; display: flex; gap: .3rem; }
.pb-span-label { position: absolute; bottom: .4rem; right: .8rem; z-index: 5;
  font-size: .72rem; color: var(--muted); background: var(--bg); border-radius: 6px;
  padding: .15rem .4rem; display: flex; align-items: center; gap: .25rem; }
.pb-span-label input { width: 52px; padding: .1rem .3rem; font-size: .78rem; }

/* rich text editing surface */
.rich-edit {
  min-height: 140px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: .6rem .8rem; background: #fff; font-size: 1rem;
}
.rich-edit:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.18); }
.rich-edit a { color: var(--teal); font-weight: 600; }

@media (max-width: 760px) {
  .pb-box { flex-basis: 100% !important; max-width: 100% !important; }
}

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  cursor: pointer; padding: .7rem 0; font-weight: 600; color: var(--navy);
  list-style-position: outside;
}
.faq-item summary:hover { color: var(--teal); }
.faq-item[open] summary { color: var(--teal); }
.faq-a { padding: 0 0 .9rem 1.1rem; white-space: pre-wrap; color: var(--text); }

@media (max-width: 760px) {
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .f-row, .f-row3 { grid-template-columns: 1fr; }
  .topnav-inner { flex-wrap: wrap; padding: .5rem 1rem; }
  .navlinks { margin-left: 0; width: 100%; overflow-x: auto; }
}
