*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-normal: #A8A878;
    --bg-fire: #F08030;
    --bg-water: #6890F0;
    --bg-grass: #78C850;
    --bg-electric: #F8D030;
    --bg-ice: #98D8D8;
    --bg-fighting: #C03028;
    --bg-poison: #A040A0;
    --bg-ground: #E0C068;
    --bg-flying: #A890F0;
    --bg-psychic: #F85888;
    --bg-bug: #A8B820;
    --bg-rock: #B8A038;
    --bg-ghost: #705898;
    --bg-dragon: #7038F8;
    --bg-steel: #B8B8D0;
    --bg-fairy: #EE99AC;
    
    --bg-card-base: #1e1e1e;
    --border-card: #333333;
}

.type-normal {
    --color-type: var(--bg-normal);
}

.type-fire {
    --color-type: var(--bg-fire);
}

.type-water {
    --color-type: var(--bg-water);
}

.type-grass {
    --color-type: var(--bg-grass);
}

.type-electric {
    --color-type: var(--bg-electric);
}

.type-ice {
    --color-type: var(--bg-ice);
}

.type-fighting {
    --color-type: var(--bg-fighting);
}

.type-poison {
    --color-type: var(--bg-poison);
}

.type-ground {
    --color-type: var(--bg-ground);
}

.type-flying {
    --color-type: var(--bg-flying);
}

.type-psychic {
    --color-type: var(--bg-psychic);
}

.type-bug {
    --color-type: var(--bg-bug);
}

.type-rock {
    --color-type: var(--bg-rock);
}

.type-ghost {
    --color-type: var(--bg-ghost);
}

.type-dragon {
    --color-type: var(--bg-dragon);
}

.type-steel {
    --color-type: var(--bg-steel);
}

.type-fairy {
    --color-type: var(--bg-fairy);
}

body {
    background-color: #121212;
    color: #ffffff;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

header {
    background-color: #1e1e1e;
    border-bottom: 2px solid #333;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

#main-logo {
    height: 50px;
}

#filter-burger-btn {
    display: none;
}

#filter-apply-btn {
    display: none;
}

#filter-overlay {
    display: contents;
}

#type-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding: 10px;
    background-color: #1e1e1e;
    border-radius: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-icon {
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: filter 0.3s;
}

.inactive-filter {
    filter: grayscale(100%) opacity(0.5);
}

#pokemon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.pokemon-card {
    border-radius: 12px;
    padding: 20px 20px 10px 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
    background-color: var(--bg-card-base);
    border: 2px solid var(--color-type, var(--border-card));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.pokemon-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px rgba(0,0,0,0.5);
    background-color: var(--color-type, #333);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    margin: 0;
}

.card-id {
    background: rgba(0,0,0,0.3);
    padding: 5px 10px;
    border-radius: 10px;
}

.card-image {
    width: 120px;
    height: 120px;
    margin-top: 15px;
    transition: filter 0.3s;
    align-self: center;
}

.pokemon-card:hover .card-image {
    filter: brightness(1.1);
}

.card-types-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.type-badge {
    background-color: var(--color-type, #555);
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    text-transform: capitalize;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.card-type-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.3));
}

.load-more-container {
    text-align: center;
    margin: 40px 0;
}

#load-more-btn {
    padding: 10px 30px;
    font-size: 16px;
    background-color: #3b4cca;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: opacity 0.3s;
}

#load-more-btn:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
    opacity: 0.5;
}

#loading-spinner {
    width: 50px;
    height: 50px;
    margin: 15px auto 0 auto;
    display: block;
}

.search-area {
    display: flex;
    gap: 10px;
}

#search-input {
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid #555;
    background-color: #2a2a2a;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#search-input:focus {
    border-color: #3b4cca;
}

#search-btn {
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    background-color: #3b4cca;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#search-btn:hover {
    background-color: #2c3a9c;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 20px;
    color: #aaa;
}

#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #fff;
    border: 2px solid #3b4cca;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
}

#scroll-to-top:hover {
    transform: scale(1.1);
}

#scroll-to-top img {
    width: 25px;
    height: 25px;
}

@media (max-width: 1024px) {
    #pokemon-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .logo-area h1 {
        display: none;
    }

    #search-btn {
        display: none;
    }

    .search-area {
        flex-grow: 1;
        margin-left: 15px;
    }

    #search-input {
        width: 100%;
    }

    #filter-burger-btn {
        display: block;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        margin-bottom: 20px;
    }

    #filter-burger-btn img {
        width: 40px;
        height: 40px;
        filter: invert(1);
    }

    #filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(18, 18, 18, 0.98);
        z-index: 2000;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 20px;
    }

    #filter-overlay.active {
        display: flex;
    }

    #type-filters {
        background: transparent;
        margin-bottom: 40px;
        padding: 0;
        gap: 15px;
    }

    #filter-apply-btn {
        display: block;
        padding: 10px 30px;
        font-size: 16px;
        font-weight: normal;
        background-color: #3b4cca;
        color: white;
        border: none;
        border-radius: 20px;
        cursor: pointer;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        transition: background-color 0.3s;
    }
}

@media (max-width: 600px) {
    #pokemon-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .pokemon-card {
        padding: 12px;
        border-radius: 8px;
    }

    .card-title {
        font-size: 16px;
    }

    .card-id {
        font-size: 14px;
        padding: 3px 6px;
    }

    .card-image {
        width: 80px;
        height: 80px;
        margin-top: 10px;
    }

    .card-types-container {
        gap: 5px;
        flex-wrap: wrap;
    }

    .type-badge {
        padding: 4px 8px;
        font-size: 12px;
    }

    .card-type-icon {
        width: 14px;
        height: 14px;
        margin-right: 3px;
    }

    #scroll-to-top {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
    }

    #scroll-to-top img {
        width: 20px;
        height: 20px;
    }
}
