/* ==========================================================================
   Temas: cambiar el atributo data-theme="..." en <html> (index.html y
   champion.html)
   ========================================================================== */

:root,
:root[data-theme='blue'] {
  --bg: #0e1420;
  --bg-rgb: 14, 20, 32;
  --bg-elevated: #161d2e;
  --bg-card: #1b2436;
  --border: #2a3550;
  --text: #e8ecf5;
  --text-dim: #8b96b3;
  --accent: #7c5cff;
  --accent-2: #22d3c5;
  --win: #2ecc9b;
  --loss: #ff5c7a;
}

:root[data-theme='crimson'] {
  --bg: #1a0e10;
  --bg-rgb: 26, 14, 16;
  --bg-elevated: #241417;
  --bg-card: #2b171b;
  --border: #4a2229;
  --text: #f5e8ea;
  --text-dim: #b38b91;
  --accent: #ff4d6d;
  --accent-2: #ffb703;
  --win: #2ecc9b;
  --loss: #ff5c7a;
}

:root[data-theme='emerald'] {
  --bg: #0b1712;
  --bg-rgb: 11, 23, 18;
  --bg-elevated: #12211a;
  --bg-card: #162a20;
  --border: #234636;
  --text: #e6f2ec;
  --text-dim: #8fb3a2;
  --accent: #2ecc9b;
  --accent-2: #a3e635;
  --win: #2ecc9b;
  --loss: #ff5c7a;
}

:root[data-theme='amber'] {
  --bg: #1a1409;
  --bg-rgb: 26, 20, 9;
  --bg-elevated: #241c0e;
  --bg-card: #2b2211;
  --border: #4a3a1c;
  --text: #f5eee2;
  --text-dim: #bda87f;
  --accent: #ff9f1c;
  --accent-2: #ffd166;
  --win: #2ecc9b;
  --loss: #ff5c7a;
}

:root {
  --accent-gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-base: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --font-display: 'Rajdhani', var(--font-base);

  /* Colores de los pills/badges redondeados. */
  --pill-rarity-color: var(--accent);
  --pill-win-color: var(--win);
  --pill-loss-color: var(--loss);
  --pill-tag-color: var(--accent);
  --pill-shard-label-color: var(--accent-2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  line-height: 1.5;
}

/* Fondo ambiental (solo pagina de campeon). */
body.champ-ambient {
  background-image:
    linear-gradient(to bottom, rgba(var(--bg-rgb), 0.15) 0%, var(--bg) 78%),
    var(--ambient-image, none);
  background-size: 100% 100%, cover;
  background-position: top, center top;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  background-blend-mode: overlay;
}

/* Con las tarjetas practicamente pegadas no queda hueco de fondo visible
   para el ambiental. */
body.champ-ambient main {
  padding-top: 72px;
}

.build-card,
.build-detail-card {
  font-family: var(--font-display);
  font-weight: 600;
}

.build-card h1, .build-card h2, .build-card h3, .build-card h4,
.build-detail-card h1, .build-detail-card h2, .build-detail-card h3, .build-detail-card h4,
.hint, .item-name, .rune-cell-name, .champ-name, .champ-role {
  font-family: var(--font-base);
  font-weight: normal;
}

/* Lineas cortas tipo "N partidas analizadas...", "X/Y partidas con la
   pareja core (Z%)"*/
.stat-hint {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-dim);
  font-size: 1.08rem;
  letter-spacing: 0.2px;
}

.rune-confidence {
  margin-top: 10px;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 800;
  font-size: 2.1rem;
  letter-spacing: 0.5px;
}

.logo span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lang-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-toggle:hover {
  border-color: var(--accent);
}

.lang-toggle .active {
  color: var(--accent);
}

.lang-toggle .sep {
  color: var(--border);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.hero {
  text-align: center;
  padding: 48px 16px 40px;
}

.hero h1 {
  font-size: 2.2rem;
  margin: 0 0 12px;
}

.hero p {
  color: var(--text-dim);
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.05rem;
}

.search-wrap {
  max-width: 480px;
  margin: 32px auto 0;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.search-wrap input:focus {
  border-color: var(--accent);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
}

.search-results:empty {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

.search-result-item:hover {
  background: var(--bg-elevated);
}

.search-result-item img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

section.section {
  margin-top: 48px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title h2 {
  font-size: 1.3rem;
  margin: 0;
}

.section-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s, transform 0.4s;
}

.icon-btn:hover {
  color: var(--accent);
}

.icon-btn.spinning svg {
  animation: icon-btn-spin 0.6s linear;
}

@keyframes icon-btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.section-title .hint {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.build-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.build-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.15s, border-color 0.15s;
  cursor: pointer;
  display: block;
}

.build-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.build-card .champ-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.build-card .champ-row img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.build-card .champ-name {
  font-weight: 700;
}

.build-card .champ-role {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.item-row {
  display: flex;
  gap: 4px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.item-row img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.item-row img.boots {
  border-color: var(--accent-2);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.pill {
  display: inline-block;
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.2px;
}

.pill.winrate-good {
  background: color-mix(in srgb, var(--pill-win-color) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-win-color) 55%, transparent);
  color: var(--pill-win-color);
}

.pill.winrate-bad {
  background: color-mix(in srgb, var(--pill-loss-color) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-loss-color) 55%, transparent);
  color: var(--pill-loss-color);
}

.pill.rarity {
  background: color-mix(in srgb, var(--pill-rarity-color) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-rarity-color) 55%, transparent);
  color: var(--pill-rarity-color);
}

/* --- pagina de campeon --- */

.champ-header {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--border);
}

.champ-header img.splash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: brightness(0.55);
}

.champ-header .champ-header-info {
  position: relative;
  padding: 24px;
  z-index: 1;
}

.champ-header h1 {
  margin: 0 0 4px;
  font-size: 2.4rem;
}

.champ-header .champ-title {
  color: var(--text-dim);
  font-style: italic;
}

.champ-header .tags {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.champ-header .tags span {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.build-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.build-detail-card .build-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 6px;
}

.build-detail-card .build-title h3 {
  margin: 0;
  font-size: 1.15rem;
}

/* Iconos de items grandes: es la informacion mas relevante de la tarjeta */
.item-row.large img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
}

.item-row.large .item-name {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 60px;
  margin-top: 4px;
}

.item-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Hueco de item que falta (build incompleta) No me convence, se cambiará en un futuro TODO*/
.item-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent) 70%);
  color: var(--bg);
  font-weight: 800;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.item-row img,
.item-row .item-placeholder {
  width: 32px;
  height: 32px;
}

.item-row.large img,
.item-row.large .item-placeholder {
  width: 60px;
  height: 60px;
  font-size: 1.6rem;
}

.item-row.large img {
  border-radius: 8px;
}

.item-row .item-placeholder {
  font-size: 1rem;
}

.arrow {
  color: var(--text-dim);
  align-self: center;
  padding: 0 2px;
  font-size: 1.1rem;
}

.position-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: 8px;
}

.position-badge {
  background: var(--accent-gradient);
  color: var(--bg);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 999px;
}

/* Runas: bloque grande y visual. */
.runes-block {
  margin-top: 18px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
}

.runes-block h4,
.pairs-block h4 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rune-icons-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.rune-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 64px;
}

.rune-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #000;
}

.rune-icon-big {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #000;
  border: 2px solid var(--accent);
}

.rune-cell-name {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
}

.rune-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  margin: 4px 4px;
}

/* Shards: etiqueta "Shards" en chip con solo borde (sin relleno) + iconos
   oficiales (Community Dragon). */
.rune-shards {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shard-label {
  border: 1px solid var(--pill-shard-label-color);
  color: var(--pill-shard-label-color);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-base);
  flex-shrink: 0;
}

.shard-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.shard-cell {
  display: flex;
  align-items: center;
  gap: 5px;
}

.shard-cell img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000;
}

.shard-sep {
  color: var(--accent);
  font-size: 0.6rem;
  opacity: 0.7;
}

/* Pares de items core: a todo el ancho, iconos mas grandes */
.pairs-block {
  margin-top: 18px;
}

.pair-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pair-row img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.pair-row .pair-names {
  margin-right: auto;
  font-size: 1.05rem;
  font-weight: 700;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.tag-badge {
  border: 1px solid var(--pill-tag-color);
  color: var(--pill-tag-color);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-base);
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 0;
}

.loading {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
}

.site-footer {
  max-width: 1180px;
  margin: 40px auto 0;
  padding: 20px 24px 40px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
  text-align: center;
}

.site-footer p {
  max-width: 760px;
  margin: 0 auto 8px;
}

.site-footer a {
  color: var(--accent-2);
  text-decoration: underline;
}
