/* ============================================================================
   Bingo RSPT — estilos do subdomínio event.rspt.pt. Tema escuro/dourado a
   condizer com o site principal, mas independente (sem dependências).
   ========================================================================== */
:root {
  --bg: #0b0805;
  --panel: rgba(18, 13, 7, 0.82);
  --panel-line: rgba(200, 168, 75, 0.18);
  --gold: #c8a84b;
  --gold-soft: rgba(200, 168, 75, 0.7);
  --text: #ece3cf;
  --muted: #9c917a;
  --ok: #5aa469;
  --no: #b5544c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 50% -10%, #1a1206 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: 'Cinzel', serif; color: var(--gold); letter-spacing: 0.04em; }

/* --- Topbar ---------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--panel-line);
  background: rgba(7, 5, 3, 0.6);
}
.brand { font-family: 'Cinzel', serif; font-weight: 900; font-size: 1.3rem; color: var(--gold); }
.brand span { color: var(--text); font-weight: 400; }
.topbar nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
/* Links de navegação em Cinzel, como no site principal. */
.topbar nav a { font-family: 'Cinzel', serif; font-size: 0.78rem; letter-spacing: 0.18em; color: var(--muted); transition: color 0.2s; }
.topbar nav a:hover { color: var(--gold); text-decoration: none; }
.topbar nav a.active { color: var(--gold); }
.btn-discord {
  background: #5865f2; color: #fff; padding: 0.4rem 0.8rem; border-radius: 6px;
  font-family: 'Cinzel', serif; font-size: 0.74rem; letter-spacing: 0.12em;
}
.btn-discord:hover { text-decoration: none; opacity: 0.9; color: #fff; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-family: 'Cinzel', serif; font-size: 0.78rem; letter-spacing: 0.18em; }
.link-btn:hover { color: var(--text); }
.inline-form { display: inline-flex; gap: 0.5rem; align-items: center; margin: 0; }

.flash {
  margin: 1rem auto; max-width: 1100px; padding: 0.7rem 1rem;
  background: rgba(90, 164, 105, 0.16); border: 1px solid rgba(90, 164, 105, 0.5);
  border-radius: 6px;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.foot {
  max-width: 1100px; margin: 2rem auto; padding: 1.5rem; display: flex; gap: 1.5rem;
  border-top: 1px solid var(--panel-line); color: var(--muted); font-size: 0.9rem;
}

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin: 0.2rem 0; }
.back { display: inline-block; color: var(--muted); margin-bottom: 0.4rem; }
.empty, .notice { padding: 1rem; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 8px; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; }
.muted { color: var(--muted); }

/* --- Estados --------------------------------------------------------------- */
.event-status { color: var(--muted); }
.status-live { color: var(--ok); }
.status-open { color: var(--gold); }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.8rem; border: 1px solid var(--panel-line); }
.badge-pending { color: var(--gold); }
.badge-approved { color: var(--ok); }
.badge-rejected { color: var(--no); }

/* --- Cartões de evento ----------------------------------------------------- */
/* Chamada à ação de login no centro da home (só quando não autenticado). */
.login-cta {
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  text-align: center; margin: 0 auto 2rem; padding: 1.5rem;
  max-width: 520px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px;
}
.login-cta p { margin: 0; color: var(--text); font-size: 1.05rem; }
.login-cta .btn-discord { font-family: 'Cinzel', serif; padding: 0.6rem 1.1rem; }

.event-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.event-card { display: block; padding: 1.2rem; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; }
.event-card:hover { border-color: var(--gold-soft); text-decoration: none; }
.event-card h2 { margin: 0.4rem 0; }
.event-status.status-live, .event-status.status-open { font-size: 0.8rem; text-transform: uppercase; }

/* --- Layout do evento ------------------------------------------------------ */
.event-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 800px) { .event-layout { grid-template-columns: 1fr; } }

.scoreboard, .board-wrap { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--panel-line); }
th { font-family: 'Cinzel', serif; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; }
td small { color: var(--muted); }
tr.sel { background: rgba(200, 168, 75, 0.1); }
.total { font-weight: 700; color: var(--gold); }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: middle; }

/* --- Tabuleiro ------------------------------------------------------------- */
/* Legenda das cores do tabuleiro. */
.board-legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem;
  padding: 0; margin: 0 0 1rem; font-size: 0.85rem; color: var(--muted);
}
.board-legend li { display: flex; align-items: center; gap: 0.45rem; }
.board-legend .lg { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--panel-line); }
.board-legend .lg-done { background: rgba(76, 160, 92, 0.75); border-color: rgba(120, 200, 130, 0.85); }
.board-legend .lg-gold { background: rgba(200, 168, 75, 0.5); border-color: var(--gold-soft); }
.board-legend .lg-gray { background: rgba(165, 165, 175, 0.5); }
.board-legend .lg-empty { background: rgba(7, 5, 3, 0.5); }

.board { display: grid; gap: 0.5rem; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.25rem; aspect-ratio: 1 / 1; padding: 0.4rem; text-align: center;
  background: rgba(7, 5, 3, 0.5); border: 1px solid var(--panel-line); border-radius: 8px;
  color: var(--text); font-size: 0.8rem; overflow: hidden;
}
a.tile:hover { border-color: var(--gold-soft); text-decoration: none; }
.tile-empty { opacity: 0.35; }
/* Tile completo: fica claramente verde (em vez do dourado base). */
.tile.done { background: rgba(76, 160, 92, 0.38); border-color: rgba(120, 200, 130, 0.85); }
.tile.done .tile-points, .tile.done .tile-qty { color: #b6ecbf; }
.tile.partial { border-color: var(--gold-soft); }
/* Tile parcialmente completo: enche de baixo para cima conforme o progresso. */
.tile.partial::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--pct, 0%);
  background: linear-gradient(to top, rgba(200, 168, 75, 0.42), rgba(200, 168, 75, 0.16));
  z-index: 0; transition: height 0.3s ease; pointer-events: none;
}
/* Pendente (por validar): cinzento, empilhado por cima do progresso aprovado. */
.tile.partial::after {
  content: ''; position: absolute; left: 0; right: 0;
  bottom: var(--pct, 0%); height: var(--pending-pct, 0%);
  background: linear-gradient(to top, rgba(165, 165, 175, 0.40), rgba(165, 165, 175, 0.16));
  z-index: 0; transition: height 0.3s ease, bottom 0.3s ease; pointer-events: none;
}
/* Conteúdo do tile acima do preenchimento. */
.tile-icon, .tile-title, .tile-qty { position: relative; z-index: 1; }
.tile-points, .tile-pos { z-index: 1; }
.tile-points { position: absolute; top: 4px; right: 6px; font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.75rem; }
.tile-pos { position: absolute; top: 4px; left: 6px; color: var(--muted); font-size: 0.65rem; }
.tile-icon { width: 28px; height: 28px; object-fit: contain; }
.tile-title { line-height: 1.15; }
.tile-qty { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.72rem; }

/* --- Detalhe do tile / formulário ------------------------------------------ */
.tile-detail { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 1.2rem; max-width: 560px; }
.tile-desc { color: var(--text); }
.progress-note { color: var(--muted); }
.submit-form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
input, select { padding: 0.5rem; background: rgba(7, 5, 3, 0.6); border: 1px solid var(--panel-line); border-radius: 6px; color: var(--text); font: inherit; }
input[type=color] { padding: 0.2rem; height: 2.4rem; }
button {
  padding: 0.55rem 1rem; background: var(--gold); color: #1a1206; border: none; border-radius: 6px;
  font-family: 'Cinzel', serif; font-weight: 700; cursor: pointer;
}
button:hover { opacity: 0.92; }

/* --- Admin ----------------------------------------------------------------- */
.admin-block { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 1.2rem; margin-bottom: 1.5rem; }
.grid-form { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; }
.grid-form label { flex: 1 1 140px; }
.grid-form label.wide { flex: 1 1 100%; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .cols-2 { grid-template-columns: 1fr; } }
.btn-sm, .btn-discord.btn-sm { padding: 0.3rem 0.7rem; border: 1px solid var(--gold-soft); border-radius: 5px; }
.admin-board .tile { aspect-ratio: auto; min-height: 70px; font-size: 0.72rem; }
.admin-board .admin-tile { cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease; }
.admin-board .admin-tile:hover { border-color: var(--gold-soft); background: rgba(200, 168, 75, 0.08); }
.admin-board .admin-tile.has-tile { border-color: rgba(200, 168, 75, 0.4); }
.admin-board .admin-tile.selected { outline: 2px solid var(--gold); outline-offset: -2px; background: rgba(200, 168, 75, 0.14); }

/* Popover de edição de tile, ancorado à célula clicada. */
.tile-popover {
  position: fixed; z-index: 50; width: 290px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--gold-soft); border-radius: 10px;
  padding: 0.9rem; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}
.tile-popover[hidden] { display: none; }
.tile-popover-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.tile-popover-head span { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.85rem; }
.popover-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 0 0.25rem; cursor: pointer; }
.popover-close:hover { color: var(--text); }
.popover-form { display: flex; flex-direction: column; gap: 0.6rem; }
.popover-form label { font-size: 0.82rem; }
.popover-form input { width: 100%; }
.popover-row { display: flex; gap: 0.6rem; }
.popover-row label { flex: 1; }
.popover-form button[type=submit] { margin-top: 0.2rem; }

.member-picker {
  border: 1px solid var(--panel-line); border-radius: 8px; padding: 0.7rem;
  max-height: 260px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.4rem;
}
.member-picker legend { color: var(--muted); font-size: 0.8rem; padding: 0 0.4rem; }
.member-picker .check { flex-direction: row; align-items: center; gap: 0.45rem; font-size: 0.9rem; color: var(--text); }
.member-picker .check input { width: auto; }

.team-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1rem; }
.roster { background: rgba(7, 5, 3, 0.4); border: 1px solid var(--panel-line); border-radius: 8px; padding: 0.8rem; }
.roster h4 { margin: 0 0 0.5rem; }
.roster-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.roster-head h4 { margin: 0; }
.btn-del { background: var(--no); color: #fff; padding: 0.2rem 0.55rem; font-size: 0.72rem; }
.roster ul { margin: 0; padding-left: 1rem; }

.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.review-card { display: flex; gap: 0.8rem; background: rgba(7, 5, 3, 0.4); border: 1px solid var(--panel-line); border-radius: 8px; padding: 0.7rem; }
.review-card .shot img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--panel-line); }
.review-meta { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; flex: 1; min-width: 0; }
.review-meta .note { color: var(--muted); font-style: italic; }
.review-actions { display: flex; gap: 0.5rem; margin-top: 0.3rem; }
.review-actions .ok { background: var(--ok); color: #fff; }
.review-actions .no { background: var(--no); color: #fff; }

.error-page h1 { font-size: 3rem; margin: 0; }
.team-list { list-style: none; padding: 0; }
.team-list li { padding: 0.3rem 0; }
