/* General Styling */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    padding-bottom: 50px; /* Added padding for long cards */
}

.search-container {
    text-align: center;
    margin-bottom: 20px;
}

.search-box input {
    font-size: 1rem;
    padding: 10px;
    border-radius: 5px 0 0 5px;
    border: 1px solid #ddd;
}

.search-box button {
    font-size: 1rem;
    padding: 10px 15px;
    border: none;
    background-color: #e63946;
    color: white;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}

/* Pokeball Loader */
.loader-container {
    display: none; /* Hidden by default */
    padding: 30px;
}
.pokeball-loader {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(to bottom, #e63946 50%, white 50%);
    border: 3px solid black;
    position: relative;
    animation: spin 1s linear infinite;
}
.pokeball-loader::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid black;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Pokedex Card Styling */
.pokedex-card {
    display: none; /* Hidden by default, shown by JS */
    width: 320px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.pokemon-image-container {
    background: #f0f0f0; 
    padding: 20px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}
#pokemonSprite {
    max-width: 180px;
    max-height: 180px;
    /* This makes pixel art sharp, not blurry */
    image-rendering: pixelated; 
}

.pokemon-info {
    padding: 20px;
    text-align: center;
}

.pokemon-id {
    color: #999;
    font-size: 1rem;
    font-weight: bold;
}

.pokemon-name {
    text-transform: capitalize;
    font-size: 2rem;
    margin: 5px 0;
}

/* Type Badges */
.pokemon-types {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}
.type-badge {
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
}

.pokemon-measurements {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}
.pokemon-measurements label {
    display: block;
    color: #777;
    font-size: 0.9rem;
}

/* Stat Bars */
.pokemon-stats {
    text-align: left;
    margin: 20px 0;
}
.stat-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}
.stat-name {
    width: 30%;
    text-transform: capitalize;
    color: #555;
    font-weight: bold;
    font-size: 0.9rem;
}
.stat-bar-background {
    width: 70%;
    background-color: #eee;
    height: 10px;
    border-radius: 5px;
}
.stat-bar-foreground {
    height: 100%;
    background-color: #e63946; 
    border-radius: 5px;
}

/* Shiny Button */
.shiny-toggle {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: bold;
    background-color: #ffd166;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

/* --- Type Colors --- */
.normal { background-color: #A8A77A; }
.fire { background-color: #EE8130; }
.water { background-color: #6390F0; }
.electric { background-color: #F7D02C; }
.grass { background-color: #7AC74C; }
.ice { background-color: #96D9D6; }
.fighting { background-color: #C22E28; }
.poison { background-color: #A33EA1; }
.ground { background-color: #E2BF65; }
.flying { background-color: #A98FF3; }
.psychic { background-color: #F95587; }
.bug { background-color: #A6B91A; }
.rock { background-color: #B6A136; }
.ghost { background-color: #735797; }
.dragon { background-color: #6F35FC; }
.dark { background-color: #705746; }
.steel { background-color: #B7B7CE; }
.fairy { background-color: #D685AD; }

/* --- NEW: Evolution Chain Styles --- */
.evolution-container {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.evolution-container h3 {
    margin: 0 0 15px 0;
    color: #333;
}
.evolution-chain-stages {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap; /* Allows wrapping on small screens */
    gap: 10px;
}
.evolution-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.evolution-stage img {
    width: 80px;
    height: 80px;
    background: #f0f0f0;
    border-radius: 50%;
    image-rendering: pixelated; /* Sharp sprites */
}
.evolution-stage span {
    margin-top: 5px;
    font-weight: bold;
    text-transform: capitalize;
}