@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&display=swap");

:root {
  --bg: #f1f5ff;
  --surface: #ffffff;
  --primary: #0f2f57;
  --primary-soft: #e9f0fb;
  --accent: #25c985;
  --text: #0d2340;
  --muted: #5c6f88;
  --border: #d7e2f3;
  --shadow: 0 14px 36px rgba(13, 35, 64, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0%, #dfeeff 0%, transparent 36%),
    linear-gradient(180deg, #f8fbff, var(--bg));
}

.topbar {
  max-width: 1200px;
  margin: 0 auto 0.8rem;
  padding: 1.1rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(120deg, #0f2f57, #123b6c);
  border-radius: 0 0 16px 16px;
}

.brand p { margin: 0.1rem 0 0; color: #b2c8e8; font-size: 0.88rem; }
.logo { text-decoration: none; color: #fff; font-size: 1.35rem; font-weight: 800; }
.logo span { color: #79b6ff; }

.topbar-actions { display: flex; align-items: center; gap: 0.7rem; }
.nav { display: flex; gap: 0.5rem; }
.nav-btn {
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 700;
  color: #dbebff;
  background: rgba(255, 255, 255, 0.1);
}
.nav-btn.active { background: var(--accent); color: #062f24; border-color: var(--accent); }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font-weight: 700;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff; }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.4rem 1rem 1.2rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.card h2 { margin: 0 0 0.8rem; }

.kpis {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  background: var(--primary-soft);
}

.kpi-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.kpi-value { margin: 0; font-size: 1.45rem; font-weight: 800; }
.kpi-value.small { font-size: 0.94rem; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--border); }
th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f7fbff;
  position: sticky;
  top: 0;
}
tbody tr:nth-child(even) { background: #fbfdff; }
tbody tr:hover { background: #f1f7ff; }
td:first-child {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.82rem;
  max-width: 220px;
  overflow-wrap: anywhere;
}

.status-text { margin: 0 0 0.55rem; color: var(--muted); }

.code-block {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  background: #f8f9ff;
  max-height: 260px;
  overflow: auto;
}

.torneos-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.torneos-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.torneos-filters {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

#torneoSearch {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  min-width: 280px;
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#torneoSearch:focus {
  border-color: #9ec3f3;
  box-shadow: 0 0 0 3px rgba(121, 182, 255, 0.2);
}

#torneoEstadoFilter,
#torneoTipoFilter {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.58rem 2rem 0.58rem 0.7rem;
  min-width: 190px;
  font: inherit;
  color: var(--text);
  background:
    linear-gradient(45deg, transparent 50%, #5c6f88 50%) calc(100% - 16px) calc(50% - 3px) / 6px 6px no-repeat,
    linear-gradient(135deg, #5c6f88 50%, transparent 50%) calc(100% - 12px) calc(50% - 3px) / 6px 6px no-repeat,
    #fff;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#torneoEstadoFilter:focus,
#torneoTipoFilter:focus {
  border-color: #9ec3f3;
  box-shadow: 0 0 0 3px rgba(121, 182, 255, 0.2);
}

.row-action {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  color: #0d3969;
  font-weight: 700;
  font-size: 0.82rem;
  background: #edf5ff;
}

.row-action-btn {
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}

.row-action-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.visibility-badge {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-public {
  background: #e8f9f1;
  border-color: #a8e9cc;
  color: #176b47;
}

.badge-private {
  background: #fff3d8;
  border-color: #f2d29a;
  color: #885600;
}

.torneo-actions-cell {
  display: grid;
  gap: 0.35rem;
  align-items: start;
}

.codigo-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.codigo-inline {
  display: inline-block;
  border: 1px dashed #c7d7ef;
  border-radius: 8px;
  padding: 0.2rem 0.45rem;
  background: #f7fbff;
  color: #0f2f57;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.78rem;
}

.muted-text {
  color: var(--muted);
  font-size: 0.8rem;
}

.toolbar-link {
  display: inline-block;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  font-weight: 800;
  font-size: 0.84rem;
  color: #ffffff;
  background: linear-gradient(120deg, #0f5ea6, #0f2f57);
  border: 1px solid rgba(15, 47, 87, 0.25);
}

.pagination {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.pagination button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  background: #f7fbff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.pagination button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

#torneosPageInfo {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  #torneoSearch,
  #torneoEstadoFilter,
  #torneoTipoFilter { min-width: 100%; width: 100%; }
}
