/* =========================================================
   CBAT APP — EQUIPOS
   CSS saneado y alineado con el render actual de equipos.js
   ========================================================= */

/* ===== CONTENEDOR ===== */

#equipos-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.team-controls--equipos {
  align-items: end;
}

#equipos-container > .matches-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#equipos-container > .matches-list.matches-list--single {
  grid-template-columns: minmax(0, 1fr);
}

#equipos-container > .matches-list > .team-card {
  width: 100%;
  height: 100%;
}

/* ===== TARJETA DE EQUIPO ===== */

#equipos-container .team-card {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  background:
    radial-gradient(circle at top right, rgba(253, 224, 127, 0.20), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.995) 0%, rgba(248, 250, 252, 0.985) 100%);
}

#equipos-container .team-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.42);
}

#equipos-container .team-card--focused {
  border-color: rgba(68, 105, 157, 0.26);
  box-shadow:
    0 16px 36px rgba(68, 105, 157, 0.12),
    0 6px 18px rgba(15, 23, 42, 0.05);
}

#equipos-container .team-card .match-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#equipos-container .team-card .match-card__meta {
  flex: 1;
  min-width: 0;
}

#equipos-container .team-card .match-card__main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#equipos-container .team-card .match-card__badges {
  gap: 8px;
}

#equipos-container .team-card .match-card__descanso-team {
  margin: 0;
  font-family: "Bison", system-ui, -apple-system, sans-serif;
  font-size: 1.18rem;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0.012em;
  color: #173C7B;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

#equipos-container .team-card--focused .match-card__descanso-team {
  font-size: 1.42rem;
}

#equipos-container .team-card .match-card__subtitle {
  margin-top: 2px;
}

#equipos-container .team-card .match-card__header,
#equipos-container .team-card .match-card__meta,
#equipos-container .team-card .match-card__main,
#equipos-container .team-card__actions,
#equipos-container .team-card__tabs,
#equipos-container .team-card__tab,
#equipos-container .team-card__tab-panel {
  position: relative;
  z-index: 1;
}

.team-card__actions,
#equipos-container .team-card .match-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#equipos-container .team-card .match-card__icon-btn--team,
#equipos-container .team-card .match-card__icon-btn--calendar {
  background: rgba(68, 105, 157, 0.08);
  color: #173C7B;
  border-color: rgba(68, 105, 157, 0.14);
  box-shadow: none;
}

#equipos-container .team-card .match-card__icon-btn--calendar {
  background: rgba(253, 224, 127, 0.24);
  border-color: rgba(240, 198, 75, 0.34);
}

/* ===== SPONSOR ===== */

.team-card__sponsor {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.team-card__sponsor-label {
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7A8EA7;
  white-space: nowrap;
}

.team-card__sponsor-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 3px 5px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 10px;
  box-shadow:
    0 4px 10px rgba(68, 105, 157, 0.08),
    0 1px 3px rgba(15, 23, 42, 0.05);
}

.team-card__sponsor--default .team-card__sponsor-logo {
  max-width: 106px;
  max-height: 32px;
}

.team-card__sponsor--wide .team-card__sponsor-logo {
  max-width: 132px;
  max-height: 36px;
}

.team-card__sponsor--icon .team-card__sponsor-logo {
  max-width: 50px;
  max-height: 50px;
  border-radius: 10px;
}

.team-card__sponsor--hero {
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.team-card__sponsor--hero .team-card__sponsor-label {
  font-size: 10px;
  color: #6F879E;
  letter-spacing: 0.07em;
}

.team-card__sponsor--hero.team-card__sponsor--default .team-card__sponsor-logo {
  max-width: 156px;
  max-height: 44px;
  padding: 4px 6px;
}

.team-card__sponsor--hero.team-card__sponsor--wide .team-card__sponsor-logo {
  max-width: 184px;
  max-height: 48px;
  padding: 4px 6px;
}

.team-card__sponsor--hero.team-card__sponsor--icon .team-card__sponsor-logo {
  max-width: 82px;
  max-height: 82px;
  padding: 5px;
}

/* ===== TABS INTERNAS ===== */

.team-card__tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 14px;
  background: rgba(68, 105, 157, 0.05);
  border: 1px solid rgba(68, 105, 157, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.team-card__tab {
  appearance: none;
  border: 0;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: transparent;
  color: #6A7B90;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.team-card__tab:hover {
  background: rgba(68, 105, 157, 0.08);
  color: #173C7B;
}

.team-card__tab.is-active {
  color: #173C7B;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 252, 1) 100%);
  border: 1px solid rgba(68, 105, 157, 0.14);
  box-shadow:
    0 4px 10px rgba(68, 105, 157, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.team-card__tab:focus-visible {
  outline: 2px solid rgba(68, 105, 157, 0.28);
  outline-offset: 2px;
}

.team-card__tab-panel {
  display: block;
}

.team-card__tab-panel[hidden] {
  display: none !important;
}

/* ===== FICHA / BLOQUES ===== */

.team-profile-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 251, 255, 0.98) 100%);
  border: 1px solid rgba(68, 105, 157, 0.10);
  box-shadow:
    0 6px 18px rgba(68, 105, 157, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.team-profile-block--meta {
  background:
    radial-gradient(circle at top right, rgba(253, 224, 127, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.team-profile-block--empty {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.team-profile-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-profile-block__header h3 {
  margin: 0;
  font-family: "Bison", system-ui, -apple-system, sans-serif;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #44699D;
}

.team-profile-block__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(68, 105, 157, 0.08);
  border: 1px solid rgba(68, 105, 157, 0.14);
  color: #44699D;
  font-size: 12px;
  font-weight: 800;
}

.team-profile-notes {
  display: grid;
  gap: 10px;
}

.team-profile-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(253, 224, 127, 0.22) 0%, rgba(255, 255, 255, 0.96) 100%);
  border: 1px solid rgba(240, 198, 75, 0.34);
}

.team-profile-note p {
  margin: 0;
  color: #5B4B15;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
}

/* ===== RESUMEN ===== */

#equipos-container [data-team-tab-panel="resumen"] .stats-card {
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(68, 105, 157, 0.05) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

#equipos-container [data-team-tab-panel="resumen"] .stats-grid {
  margin-bottom: 0;
  gap: 8px;
}

#equipos-container [data-team-tab-panel="resumen"] .stat-box {
  padding: 10px 8px;
}

#equipos-container [data-team-tab-panel="resumen"] .stat-box__number {
  font-family: "Bison", system-ui, -apple-system, sans-serif;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.01em;
}

.team-card__fixture {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(68, 105, 157, 0.05);
  border: 1px solid rgba(68, 105, 157, 0.10);
}

.team-card__fixture--empty {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.team-card__fixture-label {
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6C7D92;
}

.team-card__fixture-value {
  color: #173C7B;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 800;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.team-card__fixture-meta {
  color: #6A7B90;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

/* ===== PLANTILLA ===== */

.player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.player-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 251, 255, 0.98) 100%);
  border: 1px solid rgba(68, 105, 157, 0.10);
  box-shadow: 0 4px 12px rgba(68, 105, 157, 0.05);
}

.player-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.player-card__name-wrap {
  min-width: 0;
  flex: 1;
}

.player-card__name {
  display: block;
  margin: 0;
  color: #173C7B;
  font-size: 16px;
  line-height: 1.22;
  font-weight: 800;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.player-card__meta {
  display: block;
  margin-top: 4px;
  color: #6A7B90;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.player-card__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.player-card__flag-image {
  display: block;
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(68, 105, 157, 0.12);
}

.player-card__flag-emoji {
  font-size: 20px;
  line-height: 1;
}

.player-card__bottom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.player-card__chip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(68, 105, 157, 0.05);
  border: 1px solid rgba(68, 105, 157, 0.08);
}

.player-card__chip-label {
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6C7D92;
}

.player-card__chip-value {
  color: #173C7B;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 800;
  overflow-wrap: anywhere;
}

/* ===== ACCIÓN TARJETA ===== */

.player-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 2px;
}

.player-card__action-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(240, 198, 75, 0.36);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(253, 224, 127, 0.24) 0%, rgba(255, 255, 255, 0.98) 100%);
  color: #173C7B;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
  box-shadow:
    0 4px 10px rgba(240, 198, 75, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.player-card__action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 198, 75, 0.54);
  background:
    linear-gradient(180deg, rgba(253, 224, 127, 0.34) 0%, rgba(255, 255, 255, 1) 100%);
  box-shadow:
    0 8px 18px rgba(68, 105, 157, 0.10),
    0 4px 10px rgba(240, 198, 75, 0.16);
}

.player-card__action-btn:active {
  transform: translateY(0);
}

.player-card__action-btn:focus-visible {
  outline: 2px solid rgba(68, 105, 157, 0.28);
  outline-offset: 2px;
}

.player-card__action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.player-card__action-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.player-card__action-text {
  line-height: 1;
  white-space: nowrap;
}

/* ===== STAFF ===== */

.staff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.staff-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 13px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(68, 105, 157, 0.10);
  box-shadow: 0 3px 10px rgba(68, 105, 157, 0.05);
}

.staff-card__name {
  color: #173C7B;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.staff-card__role {
  color: #6C7D92;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== TEMPORADA ===== */

[data-team-tab-panel="temporada"] .team-profile-block {
  background:
    radial-gradient(circle at top right, rgba(253, 224, 127, 0.16), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.team-season-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.team-season-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 12px 12px 12px 16px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%);
  border: 1px solid rgba(68, 105, 157, 0.09);
  box-shadow:
    0 4px 12px rgba(68, 105, 157, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.team-season-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, #44699D 0%, #F0C64B 100%);
}

.team-season-stat:nth-child(1)::before,
.team-season-stat:nth-child(2)::before {
  background: linear-gradient(180deg, #198754 0%, #F0C64B 100%);
}

.team-season-stat__label {
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5E7691;
}

.team-season-stat__value {
  font-family: "Bison", system-ui, -apple-system, sans-serif;
  font-size: 26px;
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #173C7B;
  overflow-wrap: anywhere;
}

.team-season-stat:nth-child(1) .team-season-stat__value,
.team-season-stat:nth-child(2) .team-season-stat__value {
  color: #125A3A;
}

.team-season-stat__detail {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  color: #173C7B;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.team-season-stat__subdetail {
  font-size: 12px;
  line-height: 1.35;
  color: #6A7B90;
  overflow-wrap: anywhere;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
  #equipos-container > .matches-list {
    grid-template-columns: 1fr;
  }

  .player-grid,
  .staff-grid,
  .team-season-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .team-controls--equipos {
    align-items: stretch;
  }

  .team-card__tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .team-card__tabs::-webkit-scrollbar {
    display: none;
  }

  .team-card__tab {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  #equipos-container {
    gap: 14px;
  }

  #equipos-container .team-card {
    gap: 10px;
  }

  #equipos-container .team-card .match-card__header {
    gap: 10px;
  }

  #equipos-container .team-card .match-card__descanso-team {
    font-size: 1.04rem;
  }

  #equipos-container .team-card--focused .match-card__descanso-team {
    font-size: 1.24rem;
  }

  .team-profile-block {
    padding: 12px;
    border-radius: 16px;
  }

  .team-profile-block__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .team-profile-block__header h3 {
    font-size: 18px;
  }

  .team-card__fixture {
    padding: 11px 12px;
  }

  .team-card__fixture-value {
    font-size: 14px;
  }

  #equipos-container [data-team-tab-panel="resumen"] .stats-card {
    padding: 10px;
  }

  #equipos-container [data-team-tab-panel="resumen"] .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #equipos-container [data-team-tab-panel="resumen"] .stat-box__number {
    font-size: 20px;
  }

  .player-card,
  .staff-card,
  .team-season-stat {
    border-radius: 14px;
  }

  .player-card__bottom {
    grid-template-columns: 1fr;
  }

  .player-card__actions {
    justify-content: stretch;
  }

  .player-card__action-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  #equipos-container .team-card .match-card__actions {
    gap: 6px;
  }

  .team-card__tab {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  .team-season-stat__value {
    font-size: 23px;
  }

  .player-card__action-btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }
}