/* ============================================
   BASKET MANAGER — Pantalla de Selección
   ============================================ */

/* ---- Layout principal ---- */
.select-page {
  position: relative;
  min-height: 100vh;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.select-header {
  text-align: center;
  padding: 48px 20px 24px;
  position: relative;
}

.select-header .logo-subtitle {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.select-header h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 0 40px rgba(232,160,32,0.3);
}

.select-header h1 span {
  color: var(--color-primary);
}

.select-header .subtitle {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--color-text3);
  letter-spacing: 0.1em;
}

/* ---- Formulario de manager ---- */
.manager-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 20px 32px;
  flex-wrap: wrap;
}

.manager-form label {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text3);
  white-space: nowrap;
}

.manager-form input {
  background: var(--color-surface);
  border: 1px solid var(--color-border2);
  border-radius: var(--radius);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 10px 18px;
  outline: none;
  width: 260px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.manager-form input::placeholder { color: var(--color-text3); }
.manager-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(232,160,32,0.15);
}

/* ---- Separador ---- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 40px 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}
.section-divider span {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text3);
  white-space: nowrap;
}

/* ---- Grid de equipos ---- */
.teams-grid-wrapper {
  flex: 1;
  padding: 0 24px 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

/* ---- Tarjeta de equipo ---- */
.team-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  user-select: none;
}

.team-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--team-color, var(--color-accent)), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.team-card:hover {
  border-color: var(--color-border2);
  background: var(--color-surface2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.team-card:hover::before {
  opacity: 1;
}

.team-card.selected {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(232,160,32,0.08), var(--color-surface));
  box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-glow);
  transform: translateY(-2px);
}

.team-card.selected::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

/* ---- Escudo ---- */
.team-shield-wrap {
  width: 72px;
  height: 72px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-shield-bg {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.04), transparent);
  transition: all 0.3s;
}

.team-card.selected .team-shield-bg {
  background: radial-gradient(circle, rgba(232,160,32,0.12), transparent);
  box-shadow: 0 0 20px rgba(232,160,32,0.2);
}

.team-shield {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  transition: transform 0.2s;
  position: relative;
  z-index: 1;
}

.team-card:hover .team-shield,
.team-card.selected .team-shield {
  transform: scale(1.08);
}

/* Placeholder cuando no hay imagen */
.team-shield-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--color-surface2);
  border: 2px solid var(--color-border2);
  color: var(--color-text2);
  position: relative;
  z-index: 1;
  transition: transform 0.2s;
}

.team-card:hover .team-shield-placeholder,
.team-card.selected .team-shield-placeholder {
  transform: scale(1.08);
}

/* ---- Nombre del equipo ---- */
.team-name {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.team-card.selected .team-name {
  color: var(--color-primary);
}

/* ---- Identidad ---- */
.team-identity {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--color-text3);
  line-height: 1.3;
  font-style: italic;
}

/* ---- Prestige stars ---- */
.team-prestige {
  display: flex;
  gap: 3px;
  align-items: center;
}

.prestige-star {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border2);
}

.prestige-star.filled {
  background: var(--color-primary);
  box-shadow: 0 0 4px rgba(232,160,32,0.5);
}

/* ---- Dificultad badge ---- */
.difficulty-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.4);
  border: 1px solid currentColor;
}

/* ---- Check seleccionado ---- */
.selected-check {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s;
}

.selected-check svg {
  width: 12px;
  height: 12px;
  color: #0a0c10;
}

.team-card.selected .selected-check {
  opacity: 1;
  transform: scale(1);
}

/* ---- Panel lateral de info del equipo seleccionado ---- */
.team-info-panel {
  margin: 0 24px 20px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 48px);
  background: var(--color-surface);
  border: 1px solid var(--color-border2);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  transition: all 0.3s ease;
  min-height: 100px;
}

.team-info-panel.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.info-shield {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
  flex-shrink: 0;
}

.info-shield-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--color-surface2);
  border: 2px solid var(--color-border2);
  color: var(--color-text2);
  flex-shrink: 0;
}

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

.info-name {
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.info-description {
  font-size: 0.9rem;
  color: var(--color-text2);
  margin-bottom: 10px;
  line-height: 1.5;
}

.info-strengths {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.strength-tag {
  padding: 3px 10px;
  background: rgba(232,160,32,0.1);
  border: 1px solid rgba(232,160,32,0.25);
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--color-primary);
  letter-spacing: 0.05em;
}

.info-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  min-width: 160px;
}

.info-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.info-stat-label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--color-text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.info-stat-value {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ---- Footer / botón confirmar ---- */
.select-footer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(0deg, var(--color-bg) 70%, transparent);
  padding: 20px 24px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 10;
}

.select-footer .team-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--color-text2);
  opacity: 0;
  transition: opacity 0.3s;
}

.select-footer .team-preview.visible {
  opacity: 1;
}

.select-footer .team-preview img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.select-footer .team-preview strong {
  color: var(--color-primary);
  font-weight: 700;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .teams-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .team-info-panel {
    flex-wrap: wrap;
  }

  .info-stats {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .teams-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .select-header h1 {
    font-size: 1.6rem;
  }

  .team-card {
    padding: 14px 10px;
  }

  .team-shield, .team-shield-placeholder {
    width: 48px;
    height: 48px;
  }

  .team-shield-wrap {
    width: 56px;
    height: 56px;
  }
}

/* ---- Animaciones de entrada ---- */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.team-card {
  animation: cardIn 0.3s ease both;
}

.team-card:nth-child(1)  { animation-delay: 0.02s; }
.team-card:nth-child(2)  { animation-delay: 0.04s; }
.team-card:nth-child(3)  { animation-delay: 0.06s; }
.team-card:nth-child(4)  { animation-delay: 0.08s; }
.team-card:nth-child(5)  { animation-delay: 0.10s; }
.team-card:nth-child(6)  { animation-delay: 0.12s; }
.team-card:nth-child(7)  { animation-delay: 0.14s; }
.team-card:nth-child(8)  { animation-delay: 0.16s; }
.team-card:nth-child(9)  { animation-delay: 0.18s; }
.team-card:nth-child(10) { animation-delay: 0.20s; }
.team-card:nth-child(11) { animation-delay: 0.22s; }
.team-card:nth-child(12) { animation-delay: 0.24s; }
.team-card:nth-child(13) { animation-delay: 0.26s; }
.team-card:nth-child(14) { animation-delay: 0.28s; }
.team-card:nth-child(15) { animation-delay: 0.30s; }
.team-card:nth-child(16) { animation-delay: 0.32s; }
