/* ==========================================================================
   TFIC — shared styles (public site + organiser console)
   Brand colours come from Site settings via --tf-primary / --tf-accent.
   ========================================================================== */
:root {
  --tf-primary: #2b2f8f;
  --tf-accent: #f59e0b;
  --tf-ink: #1c2040;
  --tf-muted: #6b7280;
  --tf-bg: #f4f5fb;
  --tf-line: #e6e8f2;
  --tf-radius: 14px;
  --tf-shadow: 0 1px 2px rgba(28, 32, 64, .05), 0 6px 20px rgba(28, 32, 64, .06);
  --tf-primary-soft: color-mix(in srgb, var(--tf-primary) 9%, white);
  --tf-primary-dark: color-mix(in srgb, var(--tf-primary) 78%, black);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--tf-ink);
  --bs-border-radius: 10px;
}
body { background: var(--tf-bg); color: var(--tf-ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, .font-display { font-family: "Poppins", "Inter", sans-serif; letter-spacing: -.01em; }
a { text-decoration: none; }
.min-w-0 { min-width: 0; }

/* ---- Bootstrap primary re-skin ------------------------------------------ */
.btn-primary {
  --bs-btn-bg: var(--tf-primary); --bs-btn-border-color: var(--tf-primary);
  --bs-btn-hover-bg: var(--tf-primary-dark); --bs-btn-hover-border-color: var(--tf-primary-dark);
  --bs-btn-active-bg: var(--tf-primary-dark); --bs-btn-active-border-color: var(--tf-primary-dark);
  --bs-btn-disabled-bg: var(--tf-primary); --bs-btn-disabled-border-color: var(--tf-primary);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--tf-primary); --bs-btn-border-color: var(--tf-primary);
  --bs-btn-hover-bg: var(--tf-primary); --bs-btn-hover-border-color: var(--tf-primary);
  --bs-btn-active-bg: var(--tf-primary); --bs-btn-active-border-color: var(--tf-primary);
}
.btn-accent { --bs-btn-bg: var(--tf-accent); --bs-btn-border-color: var(--tf-accent); --bs-btn-color: #1c2040;
  --bs-btn-hover-bg: color-mix(in srgb, var(--tf-accent) 88%, black); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: #1c2040; font-weight: 600; }
.text-primary { color: var(--tf-primary) !important; }
.bg-primary-soft { background: var(--tf-primary-soft); }
.form-check-input:checked { background-color: var(--tf-primary); border-color: var(--tf-primary); }
.form-control:focus, .form-select:focus { border-color: var(--tf-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .15); }
.page-link { color: var(--tf-primary); }
.page-item.active .page-link { background: var(--tf-primary); border-color: var(--tf-primary); color: #fff; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--tf-primary); --bs-nav-link-color: var(--tf-ink); --bs-nav-link-hover-color: var(--tf-primary); }
.progress { --bs-progress-bar-bg: var(--tf-primary); --bs-progress-height: .5rem; background: var(--tf-primary-soft); }
.form-control-color { width: 3.2rem; padding: .25rem; height: 2.6rem; }
.col-12:has(> .invalid-feedback) .form-control { border-color: var(--bs-danger); }

.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--tf-accent), color-mix(in srgb, var(--tf-accent) 60%, #ff5a36)); color: #fff; font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.18); }

/* ---- Cards & tiles ------------------------------------------------------- */
.card { border: 1px solid var(--tf-line); border-radius: var(--tf-radius); box-shadow: var(--tf-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--tf-line); font-weight: 600; }
.stat-tile { padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: center; height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex: none;
  background: var(--tf-primary-soft); color: var(--tf-primary); }
.stat-icon.accent { background: color-mix(in srgb, var(--tf-accent) 16%, white); color: color-mix(in srgb, var(--tf-accent) 70%, black); }
.stat-num { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 1.65rem; line-height: 1.1; }
.stat-label { color: var(--tf-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.badge-soft { background: var(--tf-primary-soft); color: var(--tf-primary); font-weight: 600; }
.badge-soft-success { background: #e6f6ee; color: #11743f; font-weight: 600; }
.badge-soft-warning { background: #fff4dd; color: #96600a; font-weight: 600; }
.badge-soft-danger { background: #fde8e8; color: #b42323; font-weight: 600; }
.badge-soft-secondary { background: #eef0f6; color: #55607a; font-weight: 600; }

.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .7rem .9rem; vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--tf-muted); font-weight: 600;
  background: #fafbff; border-bottom: 1px solid var(--tf-line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--tf-primary-soft); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--tf-muted); }
.empty-state i { font-size: 2.4rem; color: color-mix(in srgb, var(--tf-primary) 35%, white); }

/* ---- Console shell ------------------------------------------------------- */
.console-shell { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex: none; background: linear-gradient(180deg, var(--tf-primary-dark), color-mix(in srgb, var(--tf-primary) 62%, black));
  display: flex; flex-direction: column; color: #fff; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { padding: 1.15rem 1.2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { padding: .8rem .7rem; overflow-y: auto; flex: 1; }
.s-heading { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.45); padding: 1rem .8rem .35rem; }
.s-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 10px; color: rgba(255,255,255,.78);
  font-size: .9rem; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
.s-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.s-link:hover { background: rgba(255,255,255,.09); color: #fff; }
.s-link.active { background: #fff; color: var(--tf-primary); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.sidebar-user { padding: .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  border-top: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.12); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--tf-accent); color: #1c2040; font-weight: 700; flex: none; }
.console-main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1rem; background: #fff; border-bottom: 1px solid var(--tf-line); position: sticky; top: 0; z-index: 20; }
.page { padding: 1.6rem 1.8rem 3rem; max-width: 1500px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.4rem; }
.page-title { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-sub { color: var(--tf-muted); margin: .25rem 0 0; font-size: .92rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; height: 100%; }
  .page { padding: 1.1rem 1rem 3rem; }
}

.readiness-row { display: flex; gap: .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px dashed var(--tf-line); color: inherit; }
.readiness-row:last-child { border-bottom: 0; }
.readiness-row:hover .readiness-label { color: var(--tf-primary); }

/* ---- Modal --------------------------------------------------------------- */
.modal-content { border: 0; border-radius: 18px; box-shadow: 0 24px 60px rgba(20, 24, 60, .25); }
.modal-header, .modal-footer { border-color: var(--tf-line); }

/* ---- Login --------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art { background: radial-gradient(circle at 20% 15%, rgba(255,255,255,.14), transparent 40%),
  linear-gradient(145deg, var(--tf-primary-dark), var(--tf-primary)); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-panel { display: grid; place-items: center; padding: 2rem; background: #fff; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---- Public site --------------------------------------------------------- */
.public-nav { background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--tf-line); }
.public-nav .nav-link { font-weight: 500; color: var(--tf-ink); }
.public-nav .nav-link:hover { color: var(--tf-primary); }
.hero { position: relative; overflow: hidden; color: #fff; padding: 5rem 0 6rem;
  background: radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--tf-accent) 45%, transparent), transparent 35%),
              radial-gradient(circle at 5% 90%, rgba(255,255,255,.12), transparent 40%),
              linear-gradient(135deg, var(--tf-primary-dark), var(--tf-primary)); }
.hero::after { content: ""; position: absolute; inset: 0; opacity: .08;
  background-image: radial-gradient(#fff 1.2px, transparent 1.2px); background-size: 26px 26px; pointer-events: none; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-weight: 800; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; }
.hero .lead { color: rgba(255,255,255,.85); max-width: 40rem; }
.hero-chip { display: inline-flex; gap: .45rem; align-items: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  padding: .35rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 500; }
.hero-stats { margin-top: -3.2rem; position: relative; z-index: 2; }
.section { padding: 4.5rem 0; }
.section-title { font-weight: 700; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700; color: var(--tf-accent); filter: brightness(.85); }
.pillar { padding: 1.5rem; height: 100%; }
.pillar .stat-icon { width: 54px; height: 54px; font-size: 1.5rem; margin-bottom: 1rem; }
.idea-card { display: flex; flex-direction: column; height: 100%; transition: transform .15s, box-shadow .15s; color: inherit; }
.idea-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(28, 32, 64, .12); color: inherit; }
.idea-card .card-body { display: flex; flex-direction: column; gap: .6rem; }
.theme-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 600; padding: .22rem .6rem;
  border-radius: 999px; background: var(--tf-primary-soft); color: var(--tf-primary); }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: .45rem; top: .4rem; bottom: .4rem; width: 2px; background: var(--tf-line); }
.timeline-item { position: relative; padding-bottom: 1.2rem; }
.timeline-item::before { content: ""; position: absolute; left: -1.5rem; top: .35rem; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--tf-primary); }
.public-footer { background: #151833; color: #fff; }
.footer-links li { margin-bottom: .45rem; }
.footer-links a { color: rgba(255,255,255,.75); }
.footer-links a:hover { color: #fff; }
.detail-block h6 { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--tf-muted); font-weight: 700; }
.detail-block p { white-space: pre-line; }
.member { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; }

/* ---- Rooms board --------------------------------------------------------- */
.room-card .progress { --bs-progress-height: .45rem; }
.team-chip { display: flex; align-items: center; gap: .5rem; padding: .35rem .6rem; border: 1px solid var(--tf-line); border-radius: 10px;
  background: #fff; font-size: .82rem; }
.team-chip .num { background: var(--tf-primary-soft); color: var(--tf-primary); font-weight: 700; border-radius: 6px; padding: 0 .4rem; font-size: .75rem; }
.pick-list { max-height: 62vh; overflow: auto; }
.pick-item { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border-bottom: 1px solid var(--tf-line); cursor: pointer; }
.pick-item:hover { background: var(--tf-primary-soft); }

/* ---- Assignment matrix --------------------------------------------------- */
.matrix { border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { text-align: center; }
.matrix .sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; min-width: 260px; }
.matrix-cell { width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--tf-line); background: #fff; color: transparent; transition: all .12s; }
.matrix-cell:hover { border-color: var(--tf-primary); }
.matrix-cell.on { background: var(--tf-primary); border-color: var(--tf-primary); color: #fff; }

/* ---- Judge scoring ------------------------------------------------------- */
.score-row { padding: 1rem 0; border-bottom: 1px dashed var(--tf-line); }
.score-row:last-of-type { border-bottom: 0; }
.score-input { width: 5.2rem; text-align: center; font-weight: 700; font-size: 1.1rem; }
.total-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--tf-line); padding: .9rem 1.25rem; border-radius: 0 0 var(--tf-radius) var(--tf-radius); }
.rank-badge { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; background: #eef0f6; color: #55607a; }
.rank-1 { background: #ffe7a3; color: #7a5200; } .rank-2 { background: #e3e7ee; color: #46506a; } .rank-3 { background: #f6d5bd; color: #7a3d0f; }

.copy-box { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: #f5f6fb; border: 1px dashed #c8cce3; border-radius: 10px; padding: .6rem .9rem; font-size: 1.05rem; }

/* ---- HTMX niceties -------------------------------------------------------- */
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.table-loading.htmx-request { opacity: .55; }

@media print { .no-print { display: none !important; } }
