/* Campeonato Pro — panel de gestión */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0ea5e9;
  --accent-dim: rgba(14, 165, 233, 0.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.1);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --sidebar-w: 268px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-brand span {
  opacity: 0.85;
  font-weight: 500;
  font-size: 0.75rem;
  display: block;
  margin-top: 0.15rem;
  color: #94a3b8;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0369a1);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.nav-section {
  padding: 0.75rem 0.65rem;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  padding: 0.5rem 0.75rem 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-dim);
  color: #7dd3fc;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  opacity: 0.9;
  flex-shrink: 0;
}

.nav-link i.fa-solid {
  width: 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.9;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  color: #94a3b8;
}

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: #f1f5f9;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
}

.page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #f8fafc;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-meta {
  line-height: 1.2;
}

.user-meta strong {
  display: block;
  font-size: 0.88rem;
}

.user-meta small {
  color: var(--muted);
  font-size: 0.72rem;
}

.content {
  padding: 1.5rem;
  flex: 1;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid #e2e8f0;
}

.stat-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data-table th,
table.data-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

table.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.data-table tr:hover td {
  background: #fafbfc;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-ok {
  background: #d1fae5;
  color: #065f46;
}
.badge-warn {
  background: #fef3c7;
  color: #92400e;
}
.badge-muted {
  background: #f1f5f9;
  color: #475569;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.btn-ghost {
  background: #f1f5f9;
  color: var(--text);
}

.btn-ghost:hover {
  background: #e2e8f0;
  text-decoration: none;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.form-grid {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

@media (min-width: 720px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

label.field {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(14, 165, 233, 0.35);
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0 1.25rem 1.25rem;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 50%, #0ea5e9 120%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.login-card p.sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
}

body.nav-open .sidebar-backdrop {
  display: block;
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
  }
  body.nav-open .sidebar {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-flex;
  }
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.empty-state p {
  margin: 0.35rem 0 0;
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #f1f5f9;
  font-weight: 800;
  font-size: 0.85rem;
}

.rank-pill.top {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
}

/* -------------------------------------------------------------------------- */
/* Tabla de posiciones (vista estilo broadcast)                                 */
/* -------------------------------------------------------------------------- */
.posiciones-standings {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-top: 1rem;
  box-shadow: 0 16px 48px rgba(43, 0, 75, 0.35);
}

.posiciones-standings__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 70% 20%, rgba(255, 255, 255, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(167, 139, 250, 0.12), transparent 45%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 12px,
      rgba(255, 255, 255, 0.02) 12px,
      rgba(255, 255, 255, 0.02) 13px
    ),
    linear-gradient(168deg, #150828 0%, #2b004b 38%, #1a0d2e 72%, #0f0518 100%);
  pointer-events: none;
}

.posiciones-standings__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 20px 20px;
  opacity: 0.5;
  mix-blend-mode: overlay;
}

.posiciones-standings__inner {
  position: relative;
  z-index: 1;
  padding: 1.75rem 1.25rem 1.25rem;
}

.posiciones-standings__kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.posiciones-standings__title {
  margin: 0 0 0.15rem;
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

.posiciones-standings__subtitle {
  margin: 0 0 1.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.posiciones-table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

table.posiciones-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

table.posiciones-table thead th {
  padding: 0.5rem 0.45rem 0.75rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
  white-space: nowrap;
}

table.posiciones-table thead th.posiciones-th-team {
  text-align: left;
  padding-left: 0.5rem;
}

table.posiciones-table tbody td {
  padding: 0.65rem 0.45rem;
  border: none;
  vertical-align: middle;
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

table.posiciones-table tbody td.posiciones-td-num {
  text-align: center;
  font-size: 0.88rem;
}

table.posiciones-table tbody td.posiciones-td-pts {
  font-size: 1rem;
  font-weight: 800;
  color: #fef08a;
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.25);
}

table.posiciones-table tbody tr {
  transition: background 0.15s ease;
}

table.posiciones-table tbody tr:nth-child(odd) {
  background: rgba(139, 92, 246, 0.2);
}

table.posiciones-table tbody tr:nth-child(even) {
  background: rgba(10, 5, 22, 0.55);
}

table.posiciones-table tbody tr.posiciones-row--top3 {
  box-shadow: inset 3px 0 0 rgba(250, 204, 21, 0.85);
}

.posiciones-team-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  padding-left: 0.15rem;
}

.posiciones-escudo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.posiciones-escudo--ph {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.posiciones-rank-num {
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  min-width: 1.35rem;
  text-align: center;
  flex-shrink: 0;
}

.posiciones-namebox {
  display: inline-block;
  max-width: min(240px, 52vw);
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.posiciones-footnote {
  margin: 1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

@media (max-width: 640px) {
  .posiciones-team-cell {
    gap: 0.45rem;
  }
  .posiciones-escudo,
  .posiciones-escudo--ph {
    width: 36px;
    height: 36px;
  }
  table.posiciones-table thead th,
  table.posiciones-table tbody td {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
}
