/* ============================================================
   Tournament / League Selector
   ============================================================ */

/* Overlay que aparece cuando no hay torneo seleccionado */
.league-selector-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.4s ease;
}

.league-selector-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.league-selector-box {
  width: 100%;
  max-width: 700px;
  text-align: center;
}

.league-selector-title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.4rem;
  letter-spacing: -0.5px;
}

.league-selector-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 1rem;
  margin-bottom: 2.5rem;
}

.league-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.league-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 1.2rem;
  padding: 2rem 1.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.league-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--league-primary, #667eea), var(--league-secondary, #764ba2));
  opacity: 0;
  transition: opacity 0.25s ease;
  border-radius: inherit;
}

.league-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

.league-card:hover::before {
  opacity: 0.18;
}

.league-card:active {
  transform: translateY(-2px) scale(1.01);
}

.league-card-icon {
  font-size: 3.2rem;
  margin-bottom: 0.8rem;
  position: relative;
  z-index: 1;
  display: block;
}

.league-card-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
  position: relative;
  z-index: 1;
}

.league-card-desc {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.league-card-badge {
  display: inline-block;
  margin-top: 0.9rem;
  padding: 0.3rem 0.9rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--league-primary, #667eea), var(--league-secondary, #764ba2));
  color: #fff;
  position: relative;
  z-index: 1;
}

/* ============================================================
   League Switcher (header pill)
   ============================================================ */

.league-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  padding: 0.3rem 0.8rem 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.league-switcher:hover {
  background: rgba(255,255,255,0.2);
}

.league-switcher-icon {
  font-size: 1rem;
}

.league-switcher-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.league-switcher-chevron {
  font-size: 0.65rem;
  opacity: 0.7;
}

/* ============================================================
   Hero dinámico por torneo
   ============================================================ */

.hero-league-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.8rem;
  backdrop-filter: blur(6px);
}

/* ============================================================
   Admin — Torneos Tab
   ============================================================ */

.leagues-admin-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.league-admin-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 0.875rem;
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.league-admin-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 3rem;
  text-align: center;
}

.league-admin-info {
  flex: 1;
  min-width: 0;
}

.league-admin-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.league-admin-slug {
  font-size: 0.78rem;
  color: #888;
  font-family: monospace;
}

.league-admin-desc {
  font-size: 0.82rem;
  color: #666;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.league-admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

.league-status-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.league-status-badge.active {
  background: #d1fae5;
  color: #065f46;
}

.league-status-badge.inactive {
  background: #fee2e2;
  color: #991b1b;
}

/* Modal de crear/editar torneo */
.league-form-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.league-form-modal.hidden {
  display: none;
}

.league-form-box {
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.league-form-box h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.league-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.league-color-preview {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5rem;
}

@media (max-width: 480px) {
  .league-form-row {
    grid-template-columns: 1fr;
  }
  .league-cards-grid {
    grid-template-columns: 1fr;
  }
  .league-admin-card {
    flex-wrap: wrap;
  }
}
