/* ============================================================
   Quiniela Mundial 2026 — Global Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --blue-dark:   #0a1a2f;
  --blue-mid:    #003d80;
  --blue-main:   #004d99;
  --blue-light:  #1a6dc4;
  --gold:        #c5a059;
  --gold-light:  #e8c87a;
  --green:       #16a34a;
  --red:         #dc2626;
  --bg:          #f0f4f8;
  --card:        #ffffff;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
  --radius:      12px;
  --shadow:      0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.14);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-main) 100%);
  color: #fff;
  padding: 0 1.5rem;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}
.header-brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.header-brand .icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}
.header-brand h1 { font-size: 1.1rem; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.header-brand span { font-size: .7rem; color: var(--gold-light); font-weight: 500; display: block; }
.header-nav { display: flex; gap: .5rem; align-items: center; }
.nav-link {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: .45rem .9rem;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.15); color: #fff; }
.header-user { display: flex; align-items: center; gap: .75rem; }
.user-chip {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  padding: .3rem .8rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gold-light);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  padding: .55rem 1.2rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--blue-main); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,77,153,.35); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b8902e; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--blue-main); border: 1.5px solid var(--blue-main); }
.btn-ghost:hover { background: var(--blue-main); color: #fff; }
.btn-sm { font-size: .78rem; padding: .35rem .75rem; }
.btn-lg { font-size: 1rem; padding: .75rem 1.75rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-body { padding: 1.25rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--blue-dark); }

/* ── Group match card ── */
.group-card { overflow: hidden; }
.group-card-header {
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-main));
  color: #fff;
  padding: .6rem 1rem;
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
  transition: background .15s;
}
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: #f8faff; }
.match-team { flex: 1; font-size: .82rem; font-weight: 600; }
.match-team.right { text-align: right; }
.match-score-inputs {
  display: flex; align-items: center; gap: .3rem;
  flex-shrink: 0;
}
.score-input {
  width: 44px; height: 34px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: .9rem; font-weight: 700;
  font-family: inherit;
  color: var(--text);
  transition: border-color .2s;
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-input:focus { outline: none; border-color: var(--blue-main); background: #f0f7ff; }
.score-input.saved { border-color: var(--green); }
.score-sep { color: var(--text-muted); font-weight: 700; }

/* Points badge on match row */
.match-points {
  font-size: .7rem; font-weight: 800;
  padding: .15rem .4rem; border-radius: 4px;
  flex-shrink: 0;
}
.match-points.p0 { background:#fee2e2; color:var(--red); }
.match-points.p1 { background:#fef9c3; color:#854d0e; }
.match-points.p2 { background:#dcfce7; color:var(--green); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge-paid    { background:#dcfce7; color:var(--green); }
.badge-pending { background:#fef9c3; color:#b45309; }
.badge-admin   { background:#ede9fe; color:#7c3aed; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.form-input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}
.form-input:focus { outline: none; border-color: var(--blue-main); box-shadow: 0 0 0 3px rgba(0,77,153,.1); }
.form-input.error { border-color: var(--red); }
.form-select { width: 100%; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; background-size: 1.2em; padding-right: 2.5rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--blue-dark);
  color: rgba(255,255,255,.85);
  font-size: .78rem;
  font-weight: 700;
  padding: .75rem 1rem;
  text-align: left;
  letter-spacing: .5px;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child { border-bottom: none; }
td { padding: .75rem 1rem; font-size: .875rem; }
td.num { text-align: center; font-weight: 700; }

/* ── Tabs ── */
.tabs { display: flex; gap: .25rem; padding: .5rem; background: rgba(0,0,0,.05); border-radius: 10px; }
.tab-btn {
  flex: 1; padding: .5rem; border: none; background: transparent;
  font-family: inherit; font-size: .875rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-radius: 8px;
  transition: all .2s;
}
.tab-btn.active { background: #fff; color: var(--blue-main); box-shadow: 0 2px 8px rgba(0,0,0,.1); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem; width: 100%; max-width: 480px;
  transform: scale(.95); transition: transform .25s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal h3 { font-size: 1.2rem; font-weight: 800; color: var(--blue-dark); margin-bottom: 1.25rem; }

/* ── Alert banners ── */
.alert {
  padding: .85rem 1.25rem;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}
.alert-warning { background:#fef9c3; border: 1px solid #fde047; color:#854d0e; }
.alert-info    { background:#e0f2fe; border: 1px solid #7dd3fc; color:#075985; }
.alert-success { background:#dcfce7; border: 1px solid #86efac; color:#15803d; }
.alert-error   { background:#fee2e2; border: 1px solid #fca5a5; color:#dc2626; }

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-mid) 60%, #1a6dc4 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: #fff; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  padding: 2.5rem;
  width: 100%; max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .trophy {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--blue-main), var(--blue-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(0,77,153,.4);
}
.auth-logo h2 { font-size: 1.5rem; font-weight: 900; color: var(--blue-dark); }
.auth-logo p  { color: var(--text-muted); font-size: .875rem; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue-main) 100%);
  color: #fff;
  padding: 5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner { position: relative; max-width: 700px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 900; letter-spacing: -1px; margin-bottom: .75rem; }
.hero p  { font-size: 1.1rem; opacity: .8; margin-bottom: 2rem; }
.hero-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--blue-dark);
  font-size: .75rem; font-weight: 800;
  padding: .3rem .9rem; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 1rem;
}

/* ── Stats chips ── */
.stats-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-chip {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  padding: .5rem 1rem; border-radius: 10px;
  text-align: center;
}
.stat-chip .num { font-size: 1.5rem; font-weight: 900; display: block; }
.stat-chip .lbl { font-size: .7rem; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }

/* ── Ranking table specifics ── */
.rank-pos {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: .9rem;
}
.rank-pos.p1 { background: var(--gold); color: var(--blue-dark); }
.rank-pos.p2 { background: #c0c0c0; color: #333; }
.rank-pos.p3 { background: #cd7f32; color: #fff; }
.rank-pos.pn { background: var(--border); color: var(--text-muted); }

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10,26,47,.85);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; gap: 1rem; color: #fff;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.loading-overlay.show { opacity: 1; pointer-events: all; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 9998;
}
.toast {
  padding: .75rem 1.25rem;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: .875rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem;
  min-width: 220px;
  animation: slideIn .3s ease;
  color: #fff;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red);   }
.toast.info    { background: var(--blue-main); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Quiniela selector ── */
.quiniela-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; justify-content: space-between;
}
.quiniela-card:hover { border-color: var(--blue-main); box-shadow: 0 4px 12px rgba(0,77,153,.15); }
.quiniela-card.selected { border-color: var(--blue-main); background: #f0f7ff; }
.quiniela-name { font-weight: 700; font-size: 1rem; }
.quiniela-meta { font-size: .78rem; color: var(--text-muted); }
.quiniela-points { font-size: 1.5rem; font-weight: 900; color: var(--blue-main); }

/* ── Responsive ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
/* ── Menú hamburguesa (móvil) ── */
.hamburger-btn {
  display: none;
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.25);
  color: #fff;
  width: 38px; height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
.hamburger-btn:hover { background: rgba(255,255,255,.22); }

.mobile-menu {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: var(--blue-dark);
  border-bottom: 2px solid rgba(255,255,255,.1);
  z-index: 98;
  padding: .75rem 1rem;
  flex-direction: column;
  gap: .25rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.mobile-menu.open { display: flex; }
.mobile-menu .nav-link {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  display: block;
}
.mobile-menu .nav-link:hover,
.mobile-menu .nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.mobile-menu .mobile-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: .35rem 0;
}

@media (max-width: 768px) {
  /* Layout */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tabs { flex-direction: column; }

  /* Header móvil */
  .header-inner {
    height: 56px;
    gap: .4rem;
    justify-content: flex-start;
  }
  .site-header { padding: 0 .85rem; }

  /* Logo compacto: toma el espacio disponible (flex:1) */
  .header-brand {
    flex: 1;
    gap: .5rem;
    overflow: hidden;
  }
  .header-brand .icon {
    width: 30px; height: 30px;
    font-size: .9rem;
    flex-shrink: 0;
  }
  .header-brand h1 {
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-brand span { display: none; }

  /* Nav escritorio: oculto */
  .header-nav { display: none; }

  /* Header-user: compacto, solo iconos/acciones esenciales */
  .header-user {
    gap: .3rem;
    flex-shrink: 0;
  }
  .header-user .user-chip { display: none; }
  .header-user .save-status { display: none; }
  /* Ocultar botones de texto largo en móvil (admin, ver sitio, etc) */
  .header-user .btn:not(.btn-danger):not([data-mobile-show]) { 
    display: none;
  }

  /* Hamburger: visible, tamaño adecuado */
  .hamburger-btn {
    display: flex;
    flex-shrink: 0;
  }

  /* Menú móvil: abre exactamente debajo del header */
  .mobile-menu { top: 56px; }
}

/* ── Utility ── */
.hidden   { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.fw-bold { font-weight: 700; }
.fw-black { font-weight: 900; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
