/* Base Styles */
body {
  background: linear-gradient(135deg, #e0e7ef 0%, #b3c6e7 100%);
  font-family: 'Segoe UI', 'Arial', sans-serif;
  margin: 0;
  padding: 0;
  color: #23242a;
}

.hidden {
  display: none !important;
}

#main-container {
  max-width: 900px;
  margin: 32px auto;
  padding: 32px 40px;
  background: #fff;
  border: 4px solid #e23d3d;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  position: relative;
}

#main-info {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 24px;
}

#info-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 24px;
}

#abilities-container,
#type-effectiveness-container {
  flex: 1 1 0;
}

/* Components */

/* Back Button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 1em;
  font-weight: bold;
  color: #fff;
  background: #e23d3d;
  border: 2px solid #b71c1c;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.back-button:hover {
  background: #b71c1c;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}
.back-button:active {
  background: #8c1515;
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}
.back-button:focus {
  outline: 2px solid #007BFF;
  outline-offset: 2px;
}

/* Sprite Selector */
#sprite-selector {
  margin: 16px 0;
  font-size: 1em;
}
#sprite-viewer {
  padding: 6px 10px;
  border: 2px solid #e23d3d;
  border-radius: 8px;
  background: #fff;
  font-size: 1em;
  cursor: pointer;
}
#sprite-viewer:focus {
  outline: 2px solid #007BFF;
  outline-offset: 2px;
}

/* Pokémon Title */
#pokemon-name {
  font-size: 2em;
  font-weight: bold;
  margin: 0 0 12px 0;
  color: #e23d3d;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}

/* Evolution Chain */
#evolution-chain {
  margin: 32px 0 16px 0;
  padding: 16px;
  background: #f8f8fa;
  border-radius: 16px;
  border: 2px solid #e23d3d;
}
.evolution-entry {
  display: inline-block;
  text-align: center;
  margin: 0 12px;
  cursor: pointer;
  transition: transform 0.15s;
}
.evolution-entry:hover {
  transform: scale(1.08);
  background: #ffeaea;
  border-radius: 12px;
}
.evolution-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
}
.evo-root {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}
.evo-stage {
  text-align: center;
  margin: 8px 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 10px;
  background: #fffbe8;
  border: 2px solid transparent;
  transition: background 0.2s;
}
.evo-stage.current-pokemon,
.evo-stage.current_pokemon {
  background: #ffe08b;
  color: #23242a;
  font-weight: bold;
  border: 2px solid #e23d3d;
}
.evo-branches-wrapper {
  display: block;
  overflow-x: auto;
  padding-bottom: 8px;
}
.evo-branches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
}
.evo-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.evo-method {
  margin: 8px 0;
  padding: 2px 8px;
  min-width: 80px;
  font-size: 0.95em;
  text-align: center;
  color: #e23d3d;
  background: #fff3e0;
  border-radius: 8px;
}
.evo-item-icon {
  width: 32px;
  height: 32px;
  margin: 2px 0;
  vertical-align: middle;
}

/* Forms */
#forms-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}
.form-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px;
  padding: 18px;
  min-width: 180px;
  max-width: 220px;
  text-align: center;
  background: #f3f6fa;
  border: 3px solid #e23d3d;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.form-card h3 {
  margin: 8px 0;
  font-size: 1.1em;
}
.form-card .type-icon {
  width: 28px;
  height: 28px;
  margin: 0 2px;
}
.form-card p {
  margin: 8px 0 0;
  font-size: 0.98em;
}

/* Tabs */
#move-tabs {
  margin-top: 24px;
}
.tab-buttons {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.tab-button {
  background: #e23d3d;
  color: #fff;
  border: none;
  border-radius: 8px 8px 0 0;
  padding: 10px 24px;
  margin-right: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}
.tab-button.active,
.tab-button:hover {
  background: #b71c1c;
}
.tab-button:focus {
  outline: 2px solid #007BFF;
  outline-offset: 2px;
}
.tab-content {
  background: #f7f7f7;
  border: 2px solid #e23d3d;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 18px;
  min-height: 60px;
}

/* Stats */
#stats-container {
  margin-top: 24px;
  padding: 16px;
  background: #fff3e0;
  border: 3px solid #e23d3d;
  border-radius: 16px;
}
.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
  max-width: 200px;
}
.stat-name {
  font-weight: 500;
}
.stat-bar-bg {
  display: inline-block;
  width: 100px;
  height: 12px;
  margin: 0 8px;
  border-radius: 6px;
  background: #e0e0e0;
  position: relative;
  vertical-align: middle;
  overflow: hidden;
}
.stat-bar-fill {
  display: inline-block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s;
}
.stat-bar-value {
  min-width: 18px;
  margin-left: 4px;
  font-size: 1em;
  font-weight: bold;
  display: inline-block;
  text-align: right;
}

/* Pokémon Info */
.pokemon-image {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  background: #f7f7f7;
  border: 2px solid #e23d3d;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#type-container {
  display: flex;
  gap: 8px;
}
.type-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #f0f0f0;
}

/* Abilities */
#abilities-container {
  margin-top: 16px;
  margin-bottom: 8px;
  background: #fffbe8;
  border: 2px solid #e23d3d;
  border-radius: 14px;
  padding: 16px 22px;
  box-shadow: 0 2px 8px rgba(226,61,61,0.07);
  max-width: 420px;
  font-size: 1em;
  display: inline-block;
}
.abilities-title {
  font-weight: bold;
  color: #e23d3d;
  margin-bottom: 8px;
  font-size: 1.12em;
  letter-spacing: 0.5px;
}
.abilities-list {
  list-style: none;
  margin: 0 0 8px 0;
  padding: 0;
}
.ability {
  margin-bottom: 8px;
  padding: 8px 0;
}
.ability:last-child {
  border-bottom: none;
}
.ability-name {
  font-weight: bold;
  color: #e23d3d;
  font-size: 1.05em;
  margin-right: 6px;
}
.ability-desc {
  font-style: italic;
  color: #23242a;
  margin-left: 2px;
  font-size: 0.98em;
}

/* Type Effectiveness */
.type-effectiveness-card {
  background: #fffbe8;
  border: 2px solid #e23d3d;
  border-radius: 14px;
  padding: 14px 18px;
  margin-top: 18px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(226,61,61,0.07);
  font-size: 1em;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.type-effectiveness-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}
.type-effectiveness-icons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}
.type-effectiveness-label {
  font-weight: bold;
  font-size: 1.08em;
  font-family: 'Segoe UI', 'Arial', sans-serif;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 8px;
  margin-right: 8px;
  box-shadow: 0 1px 4px rgba(226,61,61,0.07);
  display: inline-block;
  vertical-align: middle;
}
.type-effectiveness-label.weak {
  background: #e23d3d;
  color: #fffbe8;
}
.type-effectiveness-label.resist {
  background: #78C850;
  color: #23242a;
}
.type-effectiveness-label.immune {
  background: #A8A878;
  color: #23242a;
}
.type-effectiveness-label.barelyeffective {
  background: #f0ad4e;
  color: #23242a;
}
.type-effectiveness-label.hypereffective {
  background: #e30f0f;
  color: #fffbe8;
}
.type-effectiveness-card .type-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #f0f0f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  transition: transform 0.15s;
}
.type-effectiveness-card .type-icon:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(226,61,61,0.13);
}

/* Pokédex Entry */
.pokedex-entry {
  margin-top: 20px;
  padding: 12px 16px;
  background: #f7f7f7;
  border-radius: 12px;
  border: 2px solid #e23d3d;
  font-style: italic;
  font-size: 0.95em;
  color: #555;
}
.pokedex-entry p {
  margin: 0;
}

/* Full Info */
#full-info {
  margin-top: 32px;
  padding: 24px;
  background: #f7f7f7;
  border: 2px solid #e23d3d;
  border-radius: 16px;
}
#full-info h3 {
  margin-bottom: 12px;
  color: #e23d3d;
  font-size: 1.4em;
}
#full-info p,
#full-info li {
  font-size: 1em;
  line-height: 1.5;
}
#full-info ul {
  list-style: none;
  padding-left: 0;
  margin: 0 0 12px 0;
}
#full-info ul ul {
  margin: 0;
  padding-left: 18px;
}
#full-info li {
  margin-bottom: 4px;
}
#full-info h3 {
  margin: 18px 0 8px;
}
#full-info .type-icon {
  width: 28px;
  height: 28px;
  margin-right: 2px;
  border-radius: 6px;
  border: 1px solid #bbb;
  background: #f0f0f0;
  vertical-align: middle;
}
#full-info span[title] {
  border-bottom: 1px dotted #e23d3d;
  cursor: help;
}

/* Moves Table */
.moves-table-scroll {
  overflow-x: auto;
  margin-top: 8px;
}
.moves-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}
.moves-table th,
.moves-table td {
  padding: 6px 10px;
  text-align: left;
  font-size: 1em;
  border-bottom: 1px solid #e23d3d;
}
.moves-table th {
  background: #ffe08b;
  color: #23242a;
  position: sticky;
  top: 0;
  z-index: 1;
}
.moves-table tr:nth-child(even) {
  background: #f8f8fa;
}
.moves-table tr:hover {
  background: #ffeaea;
}
.category-icon {
  width: 28px;
  height: 28px;
  vertical-align: middle;
}

/* Utility */
.stat-list {
  margin: 6px 0 0;
  padding-left: 0;
}
.stat-bar-bg {
  display: inline-block;
  width: 100px;
  height: 12px;
  margin: 0 8px;
  border-radius: 6px;
  background: #e0e0e0;
  position: relative;
  vertical-align: middle;
  overflow: hidden;
}
.stat-bar-fill {
  display: inline-block;
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s;
}
.stat-bar-value {
  min-width: 18px;
  margin-left: 4px;
  font-size: 1em;
  font-weight: bold;
  display: inline-block;
  text-align: right;
}

/* Responsive */
@media (max-width: 700px) {
  #full-info {
    padding: 16px;
  }
  .stat-bar-bg {
    margin: 0 6px;
  }
  #info-row {
    flex-direction: column;
    gap: 16px;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #23272e 0%, #1a1d23 100%);
    color: #f3f3f3;
  }
  #main-container,
  .pokemon-image,
  #evolution-chain,
  .tab-content,
  .form-card,
  .evo-stage,
  #sprite-viewer,
  #full-info .type-icon,
  .stat-bar-bg {
    background: #23242a;
  }
  #main-container,
  .pokemon-image,
  #evolution-chain,
  .form-card,
  .evo-stage.current_pokemon,
  #sprite-viewer {
    border-color: #e23d3d;
  }
  #full-info {
    background: #23242a;
    border-color: #e23d3d;
    color: #ffe08b;
  }
  .stat-bar-bg {
    background: #444;
  }
  .stat-bar-fill {
    background: linear-gradient(90deg, #e23d3d, #ffb74d);
  }
  .pokedex-entry {
    background: #2d2323;
    border-color: #e23d3d;
    color: #ffe08b;
  }
  #full-info .type-icon {
    background: #23242a;
    border-color: #444;
  }
  .form-card,
  .pokemon-image {
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }
  .type-icon,
  #type-container .type-icon,
  #full-info .type-icon {
    background: #23242a;
    border-color: #444;
  }
  #abilities,
  .evolution-entry,
  .evo-stage,
  .evo-method,
  #full-info span[title],
  .form-card {
    color: #ffe08b;
  }
  .evolution-entry:hover {
    background: #2d2323;
  }
  .evo-stage.current_pokemon {
    background: #ffe08b;
    color: #23242a;
  }
  .evo-method {
    background: #2d2323;
  }
  #full-info span[title] {
    border-bottom: 1px dotted #ffe08b;
  }
  .tab-button {
    background: #e23d3d;
    color: #fff;
  }
  .tab-button.active,
  .tab-button:hover {
    background: #b71c1c;
  }
  .moves-table th {
    background: #23242a;
    color: #ffe08b;
  }
  .moves-table tr:nth-child(even) {
    background: #23242a;
  }
  .moves-table tr:hover {
    background: #2d2323;
  }
  .back-button {
    background: #b71c1c;
    border: 2px solid #e23d3d;
    color: #ffe08b;
  }
  .back-button:hover {
    background: #e23d3d;
    color: #fff;
  }
  .back-button:active {
    background: #8c1515;
  }
  #sprite-viewer {
    background: #23242a;
    border-color: #e23d3d;
    color: #ffe08b;
  }
  #pokemon-name {
    color: #ffe08b;
    text-shadow: none;
  }
  .evolution-sprite {
    background: #23242a;
    border-color: #e23d3d;
  }
  .evolution-sprite:hover {
    background: #2d2323;
  }
  .form-stats {
    color: #ffe08b;
  }
  #stats-container {
    background: #2d2323;
    border-color: #e23d3d;
  }
  .stat-bar-bg {
    background: #444;
  }
  .stat-bar-value {
    color: #ffe08b;
  }
  #abilities-container {
    background: #2d2323;
    border-color: #e23d3d;
  }
  #abilities-container .ability {
    color: #ffe08b;
  }
  #abilities-container .ability-name {
    color: #ffe08b;
  }
  #abilities-container .ability-desc {
    color: #ffe08b;
  }
  .pokedex-entry {
    background: #23242a;
    border-color: #e23d3d;
    color: #ffe08b;
  }
  .type-effectiveness-card {
    background: #2d2323;
    border-color: #e23d3d;
    color: #ffe08b;
  }
  .type-effectiveness-label.weak {
    background: #e23d3d;
    color: #ffe08b;
  }
  .type-effectiveness-label.resist {
    background: #78C850;
    color: #23242a;
  }
  .type-effectiveness-label.immune {
    background: #A8A878;
    color: #23242a;
  }
  .type-effectiveness-label.barelyeffective {
    background: #f0ad4e;
    color: #23242a;
  }
  .type-effectiveness-label.hypereffective {
    background: #e80d0d;
    color: #fffbe8;
  }
  .type-effectiveness-card .type-icon {
    background: #23242a;
    border-color: #444;
  }
}
