:root {
    --pokedex-red: #e71d23;
    --pokedex-dark: #2a2a2a;
    --pokedex-darkish: #3a3a3a;
    --pokedex-light: #f8f8f8;
    --pokedex-screen: #88c070;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', Arial, sans-serif;
    background-color: var(--pokedex-dark);
    color: var(--pokedex-light);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

.pokedex-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--pokedex-red);
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.pokedex-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--pokedex-dark);
    border-radius: 15px;
    border: 5px solid var(--pokedex-light);
}

.pokedex-header h1 {
    color: var(--pokedex-red);
    text-shadow: 3px 3px 0 var(--pokedex-dark);
    margin: 0;
    font-size: 2em;
}

.search-container {
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--pokedex-dark);
    border-radius: 15px;
    border: 5px solid var(--pokedex-light);
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 3px solid var(--pokedex-dark);
    border-radius: 10px;
    background-color: var(--pokedex-light);
    color: var(--pokedex-dark);
    font-family: 'Press Start 2P', Arial, sans-serif;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--pokedex-red);
}

.pokemon-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Footer styles */
footer {
    background-color: var(--pokedex-dark);
    color: var(--pokedex-light);
    padding: 1rem;
    text-align: center;
    margin-top: 4rem;
    width: 100%;
    position: relative;
    bottom: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-wrap: pretty;
}

.footer-content p {
    margin: 0.3rem 0;
    font-size: 0.8rem;
    text-align: center;
    width: 100%;
}

.footer-content a {
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
}

.footer-content a:hover {
    text-decoration: underline;
}

.pokemon-card {
    background-color: var(--pokedex-dark);
    border: 5px solid var(--pokedex-light);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.pokemon-card:hover {
    background-color: var(--pokedex-darkish);
}

.shiny-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2rem;
    z-index: 1;
}

.pokedex-number {
    color: var(--pokedex-light);
    font-size: 1em;
}

.pokemon-sprite {
    width: 288px;
    height: 288px;
    image-rendering: pixelated;
}

.pokemon-name {
    color: var(--pokedex-light);
    font-size: 1.2em;
    text-align: center;
}

.tier-stars {
    color: var(--pokedex-light);
    font-size: 1.5em;
    margin-top: 0.5em;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 5px;
}

.tier-stars svg {
    width: 1em;
    height: 1em;
}

.tier-stars .star {
    display: inline-block;
    transition: transform 0.2s ease;
}

.tier-stars[data-tier="3"] .star:nth-child(1) {transform: translateY(0.1em); }
.tier-stars[data-tier="3"] .star:nth-child(2) {transform: translateY(0); }
.tier-stars[data-tier="3"] .star:nth-child(3) {transform: translateY(0.1em); }

.tier-stars[data-tier="5"] .star:nth-child(1) { transform: translateY(0.2em); }
.tier-stars[data-tier="5"] .star:nth-child(2) { transform: translateY(0.1em); }
.tier-stars[data-tier="5"] .star:nth-child(3) { transform: translateY(0); }
.tier-stars[data-tier="5"] .star:nth-child(4) { transform: translateY(0.1em); }
.tier-stars[data-tier="5"] .star:nth-child(5) { transform: translateY(0.2em); }

.base-stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    font-size: 0.9em;
    color: var(--pokedex-light);
}

.stat-value {
    position: relative;
    cursor: help;
}

.stat-value:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--pokedex-dark);
    color: var(--pokedex-light);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 1;
    border: 2px solid var(--pokedex-light);
}

.pokemon-stats {
    width: 100%;
    background-color: var(--pokedex-dark);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat {
    margin: 8px 0;
    font-size: 0.8em;
    line-height: 1.5;
    text-align: center;
    width: 100%;
}

.days-ago {
    font-size: 0.85em;
    color: var(--pokedex-screen);
    margin-top: 2px;
    display: block;
}

.stat:first-child {
    color: var(--pokedex-red);
    font-weight: bold;
}

.cp-levels {
    color: var(--pokedex-light);
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--pokedex-dark);
    margin: 5% auto;
    padding: 20px;
    border: 1px solid var(--pokedex-light);
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
    position: relative;
}

.modal-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    position: relative;
}

.modal-header h2 {
    width: 100%;
    text-align: center;
    margin: 0;
}

.close {
    color: var(--pokedex-light);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 0;
}

.close:hover {
    color: var(--pokedex-screen);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

.modal-sprite-container {
    display: flex;
    justify-content: center;
}

#modalPokemonStats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 768px) {
    .pokemon-list {
        grid-template-columns: 1fr;
    }

    .pokedex-header h1 {
        font-size: 1.5em;
    }

    .pokedex-container {
        padding: 10px;
    }

    .search-container {
        padding: 10px;
    }

    .search-input {
        padding: 10px;
        font-size: 14px;
    }
}

@media screen and (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 90%;
        padding: 15px;
    }

    .modal-header h2 {
        font-size: 1.2em;
    }

    .close {
        font-size: 24px;
    }

    .modal-body {
        flex-direction: column;
    }

    .sprite-container {
        margin: 0 auto 20px;
    }

    .pokemon-stats {
        width: 100%;
    }

    .stat {
        font-size: 0.9em;
    }

    .stat.cp-levels {
        font-size: 0.85em;
    }
}