/* ============================================================
   NaCopa26 — design system
   Mobile-first, alto contraste, performático, acessível (WCAG AA+).
   ============================================================ */

/* ========== Acessibilidade ========== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 9999;
  background: #022c22;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.skip-link:focus {
  left: 8px;
}

/* Foco visível dourado em todos elementos interativos */
:focus-visible {
  outline: 3px solid var(--gold, #ca8a04);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold, #ca8a04);
  outline-offset: 3px;
}

/* Indicador de página ativa na nav */
.nav-link[aria-current="page"],
.nav-cta[aria-current="page"] {
  background: rgba(255,255,255,.18);
  text-decoration: underline;
  text-decoration-color: var(--gold-soft, #fcd34d);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========== Mobile hamburger menu ========== */
.nav-hamburger {
  display: none;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
}
.nav-hamburger:hover { background: rgba(255,255,255,.1); }
.nav-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.nav-overlay.is-open { opacity: 1; pointer-events: auto; }
.nav-drawer {
  position: fixed; top: 0; right: -100%;
  width: 86%; max-width: 320px; height: 100vh;
  background: #022c22; color: #fff;
  padding: 24px 20px; z-index: 100;
  transition: right .25s ease-out;
  box-shadow: -8px 0 24px rgba(0,0,0,.3);
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.nav-drawer.is-open { right: 0; }
.nav-drawer a {
  color: #fff; padding: 14px 14px;
  font-weight: 700; font-size: 1.05rem;
  border-radius: 10px; text-decoration: none;
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
}
.nav-drawer a:hover, .nav-drawer a[aria-current="page"] {
  background: rgba(255,255,255,.12);
  color: var(--gold-soft);
}
.nav-drawer .drawer-header {
  font-size: .75rem; text-transform: uppercase;
  letter-spacing: 2px; opacity: .6; padding: 16px 14px 6px;
}

@media (max-width: 720px) {
  .nav-hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .nav-link.hide-mobile { display: none; }
}

/* ========== Custom confirm dialog ========== */
.confirm-dialog {
  border: 0; padding: 0; border-radius: 14px;
  max-width: 420px; width: 92%;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.confirm-dialog::backdrop { background: rgba(0,0,0,.5); }
.confirm-box { padding: 26px 22px 20px; text-align: center; }
.confirm-icon {
  font-size: 3rem; color: var(--gold);
  width: 70px; height: 70px; line-height: 70px;
  background: var(--gold-bg); border-radius: 50%;
  margin: 0 auto 14px;
}
.confirm-title { color: var(--green-900); font-size: 1.2rem; margin-bottom: 8px; }
.confirm-msg { color: var(--muted); font-size: .95rem; margin-bottom: 18px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 8px; }
.confirm-actions .btn { flex: 1; }

/* ========== Loading state ========== */
.btn.is-loading { opacity: .85; cursor: progress; }
.btn-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px; margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Password show/hide ========== */
.pwd-wrap { position: relative; display: block; }
.pwd-wrap .input { padding-right: 44px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%;
  transform: translateY(-50%);
  background: transparent; border: 0;
  font-size: 1.2rem; cursor: pointer;
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #64748b;
}
.pwd-toggle:hover { background: #f1f5f9; color: #022c22; }
.pwd-toggle svg { display: block; }


:root {
  --green-900: #022c22;
  --green-800: #064e3b;
  --green-700: #115e3a;
  --green-600: #166534;
  --green-500: #16a34a;
  --gold:      #ca8a04;
  --gold-soft: #fcd34d;
  --gold-bg:   #fffbeb;
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --text:      #0f172a;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --danger:    #dc2626;
  --info:      #1e40af;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow:    0 2px 8px rgba(15,23,42,.06);
  --shadow-lg: 0 8px 24px rgba(15,23,42,.10);
  --radius:    12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; transition: opacity .15s, color .15s; }
a:hover { opacity: .8; }
img { max-width: 100%; display: block; }

main { flex: 1; width: 100%; padding-bottom: 4rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* ============ Navbar ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--green-900); color: #fff;
  box-shadow: var(--shadow);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; max-width: 1180px; margin: 0 auto;
}
.nav-logo { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.nav-logo img { height: 36px; width: auto; filter: brightness(0) invert(1); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 8px 12px; border-radius: 8px; font-weight: 700; font-size: .9rem;
  color: rgba(255,255,255,.85);
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; opacity: 1; }
.nav-cta {
  padding: 8px 14px; border-radius: 8px; background: var(--gold); color: #fff;
  font-weight: 800; font-size: .85rem;
}
.nav-cta:hover { opacity: .92; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.3); }

@media (max-width: 540px) {
  .nav-link.hide-mobile { display: none; }
}

/* ============ Hero ============ */
.hero {
  background: radial-gradient(circle at 50% 20%, var(--green-800) 0%, var(--green-900) 75%);
  color: #fff; padding: 28px 0 56px; text-align: center;
  border-radius: 0 0 28px 28px;
  position: relative; z-index: 1;
  box-shadow: var(--shadow-lg);
}
.hero h1 { font-size: clamp(1.3rem, 4vw, 1.8rem); font-weight: 800; }
.hero p  { opacity: .85; font-weight: 600; }
.hero-logo { width: clamp(120px, 30vw, 180px); margin: 0 auto 12px; filter: brightness(0) invert(1); }

/* Card próximo jogo dentro do hero */
.next-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 14px 16px;
  max-width: 420px;
  margin: 16px auto 0;
}
.next-label { font-size: .7rem; letter-spacing: 2px; opacity: .8; text-transform: uppercase; font-weight: 700; }
.next-teams { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 6px; font-weight: 800; font-size: 1rem; }
.next-flag  { font-size: 1.6rem; border-radius: 4px; }
.countdown  { display: flex; justify-content: center; gap: 18px; margin-top: 10px; font-weight: 900; }
.countdown .v { font-size: 1.4rem; color: var(--gold-soft); line-height: 1; display: block; }
.countdown .l { font-size: .6rem; opacity: .8; letter-spacing: 1px; }

/* ============ Grid ============ */
.grid { display: grid; gap: 16px; }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.full { grid-column: 1 / -1; }
.stack-up { margin-top: -36px; position: relative; z-index: 2; }

/* ============ Surface / Card ============ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  border: 1px solid var(--border);
}
.card-flat { background: var(--surface); border-radius: var(--radius); padding: 16px; border: 1px solid var(--border); }

/* ============ Botões ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; font-weight: 800; font-size: .9rem;
  border-radius: 10px; border: 0; cursor: pointer;
  text-decoration: none; transition: transform .1s, opacity .15s, box-shadow .15s;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-700); opacity: 1; }
.btn-gold    { background: var(--gold); color: #fff; }
.btn-dark    { background: var(--green-900); color: #fff; }
.btn-ghost   { background: #f1f5f9; color: var(--text); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--green-900); color: var(--green-900); }
.btn-sm      { padding: 6px 12px; font-size: .8rem; min-height: 32px; border-radius: 8px; }

/* ============ Forms ============ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font: inherit; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(22,101,52,.15);
}
.textarea { min-height: 96px; resize: vertical; }

/* ============ Alertas / Flash ============ */
.alert { padding: 12px 14px; border-radius: 10px; font-weight: 700; margin-bottom: 14px; font-size: .9rem; }
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ============ Tabela ============ */
.table { width: 100%; background: var(--surface); border-radius: var(--radius); border-collapse: collapse; overflow: hidden; box-shadow: var(--shadow); }
.table th { background: var(--green-900); color: #fff; text-align: left; padding: 12px; font-size: .85rem; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.table tr:last-child td { border-bottom: 0; }

/* ============ Badge / Status ============ */
.badge { font-size: .65rem; padding: 3px 8px; border-radius: 999px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.badge-open   { background: #dbeafe; color: var(--info); }
.badge-closed { background: #fee2e2; color: #991b1b; }
.badge-done   { background: #dcfce7; color: #166534; }
.badge-gold   { background: var(--gold-bg); color: #92400e; border: 1px solid var(--gold-soft); }

/* ============ Componentes de jogo ============ */
.match-card { padding: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.match-card:first-child { border-top: 0; }
.match-meta { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); font-weight: 700; }
.match-core { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-name { font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-right { justify-content: flex-end; }
.score { background: #f1f5f9; padding: 6px 12px; border-radius: 8px; font-weight: 800; font-family: ui-monospace, monospace; min-width: 64px; text-align: center; font-size: 1.05rem; }
.score-input { width: 48px; padding: 6px; text-align: center; border: 1.5px solid var(--border); border-radius: 8px; font-weight: 800; font-size: 1rem; }
.score-input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(202,138,4,.2); }

/* ============ Stage / Grupo (accordion) ============ */
details.stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s; }
details.stage[open] { box-shadow: var(--shadow); }
details.stage summary { padding: 14px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 1rem; border-left: 5px solid #cbd5e1; list-style: none; user-select: none; }
details.stage summary::-webkit-details-marker { display: none; }
details.stage summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
details.stage[open] summary::after { transform: rotate(180deg); }
details.stage.highlight { border: 2px solid var(--gold); }
details.stage.highlight summary { background: linear-gradient(to right, #fff, var(--gold-bg)); border-left-color: var(--green-500); color: var(--green-900); }
details.stage.highlight summary .stage-title::after { content: ' ⭐'; }
.stage-flags { display: flex; gap: 2px; align-items: center; }
.stage-flags .fi { border-radius: 2px; }

/* ============ Timer sticky (palpites) ============ */
.timer {
  position: sticky; top: 56px; z-index: 40;
  background: var(--green-900); color: #fff;
  padding: 10px 16px; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: var(--shadow);
  font-weight: 800;
}
.timer .num { color: var(--gold-soft); font-variant-numeric: tabular-nums; font-size: 1.05rem; }

/* ============ FAB ============ */
.fab {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  padding: 14px 24px; border-radius: 999px; background: var(--gold); color: #fff;
  font-weight: 800; box-shadow: 0 10px 24px rgba(202,138,4,.45); z-index: 60;
  border: 0; cursor: pointer; min-height: 48px;
}
.fab:hover { filter: brightness(1.05); }

/* ============ Footer ============ */
.foot {
  background: var(--green-900); color: rgba(255,255,255,.85); padding: 28px 0 22px; margin-top: 32px;
}
.foot-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .foot-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.foot h4 { color: #fff; font-size: .9rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.foot a { display: block; padding: 4px 0; font-size: .88rem; color: rgba(255,255,255,.75); }
.foot a:hover { color: #fff; opacity: 1; }
.foot-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.foot-logo img { height: 38px; filter: brightness(0) invert(1); }
.foot-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 20px; padding-top: 16px; text-align: center; font-size: .8rem; opacity: .6; }

/* ============ Utilities ============ */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.font-bold { font-weight: 800; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.hidden { display: none; }
@media (min-width: 720px) { .hidden-md\+ { display: none !important; } }

/* ============ Avatar ============ */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.avatar-lg { width: 80px; height: 80px; }
.avatar-xl { width: 120px; height: 120px; }

/* ============ Hero perfil ============ */
.profile-hero { background: linear-gradient(135deg, var(--green-800), var(--green-900)); color: #fff; padding: 28px 16px; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 16px; }
.profile-hero .avatar { border-color: var(--gold); }

/* ============ Ranking ============ */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; }
.rank-pos { font-weight: 900; color: var(--gold); width: 36px; text-align: center; font-size: 1.1rem; }
.rank-row.gold   { border-color: var(--gold); background: linear-gradient(to right, #fff, var(--gold-bg)); }
.rank-row.silver { border-color: #94a3b8; }
.rank-row.bronze { border-color: #b45309; }
.rank-pts { margin-left: auto; font-weight: 900; color: var(--green-700); font-size: 1.1rem; }
