/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #0057A6;
  --green-dark: #003d7a;
  --green-light: #4a9de0;
  --gold: #e53935;
  --gold-light: #ff6b6b;
  --bg: #0d1e33;
  --bg-card: #132d52;
  --bg-card2: #0a1f3a;
  --text: #e8f0ff;
  --text-muted: #c8daf0;
  --border: #1e3a60;
  --red: #e53935;
  --blue: #0057A6;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 12px;
}
html { font-size: 16px; }
body {
  font-family: 'Lato', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
.hidden { display: none !important; }
input, select { font-family: inherit; font-size: 1rem; }
button { cursor: pointer; font-family: inherit; }

/* ===== AUTH ===== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 20px;
}
.auth-bg {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center top, #0057A6 0%, #060e1a 60%);
  z-index: 0;
}
.auth-card {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow), 0 0 80px rgba(26,122,46,0.15);
}
.auth-logo {
  font-size: 3.5rem;
  text-align: center;
  margin-bottom: 8px;
  animation: spin 8s linear infinite;
  display: inline-block;
  width: 100%;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-14px); }
}
.auth-corner-logo-wrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 2;
  pointer-events: none;
  animation: float 5s ease-in-out infinite;
}
.auth-corner-logo-wrap::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 32px;
  background: radial-gradient(ellipse at center, rgba(74,157,224,0.7) 0%, transparent 70%);
  filter: blur(10px);
  border-radius: 50%;
}
.auth-corner-logo {
  width: 180px;
  height: auto;
  display: block;
  mix-blend-mode: multiply;
}
.auth-title { font-size: 1.7rem; font-weight: 800; text-align: center; color: var(--gold-light); }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 0.85rem; letter-spacing: 2px; margin-bottom: 28px; }
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.auth-tab.active { background: var(--green); color: white; }
.auth-msg {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.auth-msg.error { background: rgba(229,57,53,0.15); border: 1px solid rgba(229,57,53,0.3); color: #ff8a80; }
.auth-msg.success { background: rgba(45,168,75,0.15); border: 1px solid rgba(45,168,75,0.3); color: #69f0ae; }

.register-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(0,87,166,0.18);
  border: 1px solid rgba(0,87,166,0.35);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #90caf9;
  margin-bottom: 18px;
  line-height: 1.4;
}

.register-success-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 12px;
}
.register-success-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}
.register-success-body {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.register-success-body strong { color: var(--text); }
.register-success-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-bottom: 20px;
}

/* ===== FIELDS ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field select {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--green-light); }
.field select option { background: #1a2d1e; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(45,168,75,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a1a1a;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.88rem;
  transition: all 0.2s;
}
.btn-gold:hover { transform: translateY(-1px); }
.btn-small {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: 6px;
}
.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 100px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold-light);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand span { display: none;
font-weight: 1000; 
color: #df3b20;
}
.nav-logo-img {
  height: 28px;
  width: auto;
  display: block;
  
}
@media (min-width: 600px) { .nav-brand span { display: inline; } }
.nav-tabs { display: flex; gap: 4px; flex: 1; }
.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s;
}
.nav-tab:hover { background: var(--bg-card2); color: var(--text); }
.nav-tab.active { background: var(--green); color: white; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  white-space: nowrap;
}
#nav-username { color: var(--text-muted); font-weight: 600; display: none; }
@media (min-width: 500px) { #nav-username { display: inline; } }

/* ===== MAIN ===== */
.main-content { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.6rem; font-weight: 800; color: var(--gold-light); }
.page-desc { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

/* ===== GROUP FILTER ===== */
.group-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.filter-btn {
  background: #132d52;
  border: 1px solid #e53935;
  color: #fff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover, .filter-btn.active { background: #e53935; border-color: #fff; color: #fff; }

/* ===== MATCH CARDS ===== */
.group-section { margin-bottom: 32px; }
.group-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.match-card:hover { border-color: var(--green); }
.match-card.finished { opacity: 0.8; border-color: var(--border); }
.match-card.finished:hover { border-color: var(--border); }

.match-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.match-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.match-meta .venue { display: none; }
@media (min-width: 600px) { .match-meta .venue { display: inline; } }
.match-status {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.status-upcoming { background: rgba(26,122,46,0.2); color: var(--green-light); border: 1px solid rgba(26,122,46,0.3); }
.status-live { background: rgba(229,57,53,0.2); color: #ff8a80; border: 1px solid rgba(229,57,53,0.4); animation: pulse 1.5s infinite; }
.status-finished { background: rgba(100,100,100,0.2); color: #888; border: 1px solid rgba(100,100,100,0.3); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

.match-body {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: stretch;
  gap: 14px;
}
.match-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.match-body-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.team-crest-rail {
  display: flex;
  align-items: center;
  justify-content: center;
}
.team-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}
.team.home { justify-content: flex-end; text-align: right; }
.team.away { justify-content: flex-start; }
.team-name {
  display: block;
  line-height: 1.2;
}
.team-crest {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 56px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
}
.team-crest-placeholder {
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gold-light);
}
.team-prediction-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.predictions-row {
  margin-top: 2px;
}
.team-column.home .team-prediction-field {
  align-items: flex-end;
}
.team-column.away .team-prediction-field {
  align-items: flex-start;
}
.team-prediction-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.match-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.real-score {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: 2px;
  min-width: 60px;
  text-align: center;
}
.vs-badge {
  font-size: 0.8rem;
  color: #e53935;
  font-weight: 700;
}

.prediction-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.prediction-row-inline {
  justify-content: center;
}
.pred-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}
.score-input {
  width: 44px;
  text-align: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 4px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}
.score-input::-webkit-inner-spin-button, .score-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.score-input:focus { outline: none; border-color: var(--green-light); }
.match-footer {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .match-body {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 10px;
  }

  .match-body-row {
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
  }

  .team-column,
  .team-column.home,
  .team-column.away {
    align-items: center;
  }

  .team,
  .team.home,
  .team.away {
    justify-content: center;
    text-align: center;
  }

  .team.home {
    justify-content: flex-end;
  }

  .team-crest {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .team-name {
    font-size: 0.88rem;
  }

  .team-prediction-field,
  .team-column.home .team-prediction-field,
  .team-column.away .team-prediction-field {
    align-items: center;
  }

  .predictions-row .prediction-center-spacer {
    min-width: 34px;
  }
}

/* Points badge */
.points-badge {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
}
.pts-3 { background: rgba(201,162,39,0.2); color: var(--gold-light); border: 1px solid rgba(201,162,39,0.4); }
.pts-1 { background: rgba(26,122,46,0.2); color: var(--green-light); border: 1px solid rgba(26,122,46,0.3); }
.pts-0 { background: rgba(229,57,53,0.1); color: #ff8a80; border: 1px solid rgba(229,57,53,0.2); }
.pts-pending { background: rgba(100,100,100,0.15); color: #888; border: 1px solid rgba(100,100,100,0.2); font-style: italic; }

.pred-display {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
}
.pred-display span { color: var(--text); }

/* ===== LEADERBOARD ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 600px) { .stats-bar { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-value { font-size: 1.8rem; font-weight: 900; color: var(--gold-light); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.leaderboard-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lb-header, .lb-row {
  display: grid;
  grid-template-columns: 48px 1fr 70px 70px 70px 70px;
  padding: 12px 16px;
  align-items: center;
  gap: 8px;
}
@media (max-width: 500px) {
  .lb-header, .lb-row { grid-template-columns: 40px 1fr 60px 60px; }
  .lb-col-hide { display: none; }
}
.lb-header {
  background: var(--bg-card2);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.lb-row {
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  transition: background 0.15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg-card2); }
.lb-row.my-row { background: rgba(26,122,46,0.1); }
.lb-rank { font-weight: 900; font-size: 1rem; color: var(--text-muted); text-align: center; }
.lb-rank.top1 { color: #ffd700; }
.lb-rank.top2 { color: #c0c0c0; }
.lb-rank.top3 { color: #cd7f32; }
.lb-username { font-weight: 700; }
.lb-pts { font-weight: 900; font-size: 1.1rem; color: var(--gold-light); text-align: center; }
.lb-num { text-align: center; color: var(--text-muted); }
.lb-exact { color: var(--gold); }

/* ===== ADMIN ===== */
.admin-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  width: fit-content;
}
.admin-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s;
}
.admin-tab.active { background: var(--green); color: white; }

.admin-match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-match-info { flex: 1; min-width: 200px; }
.admin-match-teams { font-weight: 700; font-size: 0.95rem; }
.admin-match-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.admin-result-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-result-form .score-input { width: 50px; font-size: 1.1rem; }
.result-saved { color: var(--green-light); font-size: 0.8rem; font-weight: 600; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; color: var(--gold-light); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 500px) { .grid-2 { grid-template-columns: 1fr; } }

.users-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.users-header {
  display: grid;
  grid-template-columns: 1.4fr 1.8fr 0.8fr 0.8fr 1.6fr;
  padding: 10px 16px;
  background: var(--bg-card2);
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.user-row {
  display: grid;
  grid-template-columns: 1.4fr 1.8fr 0.8fr 0.8fr 1.6fr;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  gap: 12px;
}
.user-row:last-of-type { border-bottom: none; }
.user-id-badge { color: var(--text-muted); font-size: 0.72rem; margin-left: 6px; opacity: 0.6; }
.user-admin-badge { background: rgba(201,162,39,0.2); color: var(--gold); border: 1px solid rgba(201,162,39,0.3); padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; }
.user-normal-badge { background: rgba(45,168,75,0.1); color: var(--green-light); border: 1px solid rgba(45,168,75,0.25); padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; }
.user-self-label { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; padding: 0 4px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.user-edit-form {
  border-bottom: 1px solid var(--border);
  background: rgba(26,122,46,0.07);
}
.user-edit-form.hidden { display: none; }
.user-edit-inner {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px 16px;
  align-items: end;
}
.user-edit-actions { display: flex; gap: 8px; align-items: center; }
.user-edit-msg { font-size: 0.8rem; margin-left: 4px; }
.user-edit-msg.error { color: var(--red); }
.btn-primary-sm { background: var(--blue); color: white; border: none; border-radius: 8px; padding: 5px 10px; font-size: 0.78rem; font-weight: 600; }
.btn-primary-sm:hover { opacity: 0.85; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: 8px; border: none; font-weight: 600; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { opacity: 0.8; }
@media (max-width: 700px) {
  .users-header { display: none; }
  .user-row { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
  .user-edit-inner { grid-template-columns: 1fr; }
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.spinner {
  font-size: 2rem;
  animation: spin 1s linear infinite;
  display: block;
  margin-bottom: 12px;
}
.empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 9999;
  animation: slideUp 0.3s ease;
  white-space: nowrap;
}
.toast.error { background: var(--red); }
@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
