/* ============================================================
   assets/css/style.css — Diseño moderno limpio
   ============================================================ */

:root {
  --green:       #1D9E75;
  --green-light: #E1F5EE;
  --green-dark:  #085041;
  --green-mid:   #0F6E56;
  --purple:      #534AB7;
  --purple-light:#EEEDFE;
  --amber:       #BA7517;
  --amber-light: #FAEEDA;
  --red:         #A32D2D;
  --red-light:   #FCEBEB;
  --gray-50:     #F1EFE8;
  --gray-100:    #D3D1C7;
  --gray-400:    #888780;
  --gray-600:    #5F5E5A;
  --gray-800:    #2C2C2A;
  --white:       #ffffff;
  --border:      rgba(0,0,0,.1);
  --radius:      8px;
  --radius-lg:   12px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 2px 8px rgba(0,0,0,.10);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
}

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

/* ── LAYOUT ─────────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
}
.site-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; color: var(--gray-800);
  white-space: nowrap;
}
.logo-ball {
  width: 28px; height: 28px; background: var(--green);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.logo-ball svg { width: 16px; height: 16px; }
.tournament-name {
  font-size: 13px; color: var(--gray-400); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Tabs de navegación pública */
.site-nav {
  display: flex; border-bottom: 1px solid var(--border);
  padding: 0 20px; background: var(--white);
}
.nav-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--gray-400); border-bottom: 2px solid transparent;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: color .15s;
}
.nav-tab:hover { color: var(--gray-800); text-decoration: none; }
.nav-tab.active { color: var(--green); border-bottom-color: var(--green); }

.page-content {
  max-width: 1200px; margin: 0 auto; padding: 24px 20px;
}

/* ── BOTONES ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--white);
  color: var(--gray-800); transition: background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--gray-50); text-decoration: none; }
.btn-primary { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-primary:hover { background: var(--green-mid); }
.btn-danger  { background: var(--red-light); color: var(--red); border-color: #F09595; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body  { padding: 16px; }

/* ── GRUPOS GRID ─────────────────────────────────────────────── */
.grupos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.grupo-card { }
.grupo-header {
  background: var(--green-light);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
}
.grupo-letra {
  font-size: 15px; font-weight: 700; color: var(--green-dark);
  width: 28px;
}
.grupo-progreso {
  flex: 1; margin: 0 10px;
}
.progreso-bar {
  height: 4px; background: #9FE1CB; border-radius: 2px; overflow: hidden;
}
.progreso-fill { height: 100%; background: var(--green); border-radius: 2px; transition: width .4s; }
.progreso-txt  { font-size: 10px; color: var(--green-dark); margin-top: 2px; }

/* ── TABLA DE CLASIFICACIÓN ──────────────────────────────────── */
.tabla-clas { width: 100%; border-collapse: collapse; font-size: 12px; }
.tabla-clas th {
  background: rgba(0,0,0,.03); color: var(--gray-400);
  padding: 5px 8px; text-align: center; font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 10px; text-transform: uppercase; letter-spacing: .3px;
}
.tabla-clas th:first-child, .tabla-clas td:first-child { text-align: left; padding-left: 12px; }
.tabla-clas td {
  padding: 7px 8px; text-align: center;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.tabla-clas tr:last-child td { border-bottom: none; }
.tabla-clas tr.clasifica td  { background: rgba(29,158,117,.05); }
.tabla-clas tr.clasifica td:first-child { border-left: 3px solid var(--green); }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 600;
}
.rank-1 { background: #FAEEDA; color: #633806; }
.rank-2 { background: var(--gray-100); color: var(--gray-600); }
.rank-3, .rank-4 { background: transparent; color: var(--gray-400); }
.pts-val { font-weight: 600; color: var(--green); }

/* ── PARTIDOS ────────────────────────────────────────────────── */
.jornada-titulo {
  font-size: 10px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 8px 12px 4px; border-top: 1px solid var(--border);
}
.partido-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-bottom: 1px solid rgba(0,0,0,.04);
  font-size: 12px;
}
.partido-row:last-child { border-bottom: none; }
.equipo-nom  { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.equipo-nom.ganador { font-weight: 600; color: var(--green-dark); }
.partido-res {
  font-size: 13px; font-weight: 600; color: var(--green);
  min-width: 36px; text-align: center;
}
.partido-vs  { font-size: 11px; color: var(--gray-100); min-width: 20px; text-align: center; }
.partido-pista { font-size: 10px; color: var(--gray-400); }
.btn-resultado {
  font-size: 11px; padding: 3px 8px;
  background: var(--green-light); color: var(--green-dark);
  border: 1px solid #9FE1CB; border-radius: 4px; cursor: pointer;
  white-space: nowrap;
}
.btn-resultado:hover { background: #9FE1CB; }

/* ── CUADRO DE PLAYOFFS ──────────────────────────────────────── */
.bracket-wrap { overflow-x: auto; padding-bottom: 12px; }
.bracket {
  display: flex; align-items: flex-start;
  gap: 0; min-width: max-content; padding: 16px;
}
.ronda-col { display: flex; flex-direction: column; min-width: 190px; }
.ronda-titulo {
  font-size: 10px; font-weight: 700; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .4px;
  text-align: center; padding-bottom: 10px;
}
.ronda-partidos { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.bracket-match {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--white); transition: box-shadow .15s;
}
.bracket-match.jugado  { border-color: #9FE1CB; }
.bracket-match.activo  { border-color: var(--green); border-width: 2px; }
.bracket-match.pendiente { opacity: .55; }
.bracket-match.clickable { cursor: pointer; }
.bracket-match.clickable:hover { box-shadow: var(--shadow); }
.bracket-slot {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; font-size: 12px;
}
.bracket-slot:first-child { border-bottom: 1px solid rgba(0,0,0,.07); }
.bracket-slot.ganador { background: var(--green-light); font-weight: 600; color: var(--green-dark); }
.bracket-slot.vacio   { color: var(--gray-100); font-style: italic; }
.bracket-slot-nom { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bracket-slot-set { font-weight: 700; font-size: 14px; color: var(--green); min-width: 14px; }
.bracket-sep {
  height: 20px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--gray-100); background: rgba(0,0,0,.02);
}
.bracket-arrow {
  display: flex; align-items: center; justify-content: center;
  width: 24px; align-self: center; color: var(--gray-100);
  font-size: 16px; flex-shrink: 0; margin: 4px 0;
}

/* ── FORMULARIOS ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--gray-600); }
.form-control {
  padding: 8px 12px; border: 1px solid var(--gray-100);
  border-radius: var(--radius); font-size: 14px;
  background: var(--white); color: var(--gray-800);
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,158,117,.1); }
.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── ALERTAS ─────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px; }
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid #9FE1CB; }
.alert-error   { background: var(--red-light);   color: var(--red);        border: 1px solid #F09595; }
.alert-warning { background: var(--amber-light);  color: #412402;           border: 1px solid #EF9F27; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-grupos   { background: var(--green-light);  color: var(--green-dark); }
.badge-playoffs { background: var(--purple-light); color: #26215C; }
.badge-borrador { background: var(--gray-50);      color: var(--gray-600); }
.badge-fin      { background: var(--amber-light);  color: #412402; }

/* ── ADMIN SIDEBAR ───────────────────────────────────────────── */
.admin-layout  { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--white); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 0;
}
.admin-logo    { font-size: 13px; font-weight: 700; color: var(--green); padding: 0 16px 16px; }
.admin-menu    { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.admin-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
  color: var(--gray-600); text-decoration: none;
}
.admin-menu-item:hover { background: var(--gray-50); color: var(--gray-800); text-decoration: none; }
.admin-menu-item.active { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.admin-user {
  margin-top: auto; padding: 14px 16px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--gray-400);
}
.admin-main { flex: 1; overflow-y: auto; padding: 28px; background: var(--gray-50); }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* ── STATS CARDS ─────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 16px; border: 1px solid var(--border); }
.stat-num   { font-size: 28px; font-weight: 700; color: var(--gray-800); }
.stat-label { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ── TABLA ADMIN ─────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); }
.admin-table th {
  background: var(--gray-50); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .3px; color: var(--gray-400);
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 10px 14px; border-bottom: 1px solid rgba(0,0,0,.05); font-size: 13px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(0,0,0,.015); }

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 24px; width: 380px; max-width: calc(100vw - 40px);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.modal-title  { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── TOAST ───────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  padding: 10px 18px; border-radius: var(--radius); font-size: 13px;
  font-weight: 500; opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.success { background: var(--green-light); color: var(--green-dark); border: 1px solid #9FE1CB; }
#toast.error   { background: var(--red-light);   color: var(--red);        border: 1px solid #F09595; }

/* ── LOGIN ───────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--gray-50);
}
.login-card { width: 360px; }
.login-logo  { text-align: center; margin-bottom: 24px; }
.login-logo span { font-size: 24px; font-weight: 700; color: var(--green); }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .grupos-grid { grid-template-columns: 1fr; }
  .stats-row   { grid-template-columns: 1fr 1fr; }
  .form-row    { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .bracket { padding: 8px; }
  .ronda-col { min-width: 155px; }
}
