* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-display: swap;
    font-family: 'IconFont';
    font-style: normal;
    font-weight: normal;
    src: url('../fonts/icon-font.woff2') format('woff2'),
         url('../fonts/icon-font.ttf') format('truetype');
}

span.icon::before{
    font-family: 'IconFont';
}
span.icon.filter::before {
    content: '\f0b0';
}
span.icon.settings::before {
    content: '\e5e9';
}
span.icon.x-mark::before {
    content: '\f00d';
}
span.icon.heart-icon::before {
    content: '\e4ff';
}
span.icon.heart::before {
    content: '\f004';
}
span.icon.circle-xmark::before {
    content: '\f057';
}
span.icon.location::before {
    content: '\f3c5';
}
span.icon.list::before {
    content: '\f03a';
}
span.icon.grid::before {
    content: '\e195';
}
span.icon.play::before {
    content: '\f6a8';
}
span.icon.back-arrow::before {
    content: '\f060';
}
span.icon.height::before {
    content: '\f545';
}
span.icon.weight::before {
    content: '\f496';
}
span.icon.idBadge::before {
    content: '\f47f';
}
span.icon.male::before {
    content: '\f222';
    color: inherit;
}
span.icon.female::before {
    content: '\f221';
    color: inherit;
}
span.icon.genderless::before {
    content: '\f22d';
}
span.icon.sparkle::before {
    content: '\f890';
}
span.icon.sparkle.reverse {
    transform: rotate(180deg);
}
span.icon.heart-check::before {
    content: '\e4fd';
}
span.icon.heart-broken::before {
    content: '\f7a9';
}
span.icon.trash::before {
    content: '\f1f8';
}
span.icon.circle-checkmark::before {
    content: '\f058';
}

/* Type Icons (SVG-based, mask approach for color flexibility) */
span.icon.normalType::before,
span.icon.fireType::before,
span.icon.waterType::before,
span.icon.electricType::before,
span.icon.grassType::before,
span.icon.iceType::before,
span.icon.fightingType::before,
span.icon.poisonType::before,
span.icon.groundType::before,
span.icon.flyingType::before,
span.icon.psychicType::before,
span.icon.bugType::before,
span.icon.rockType::before,
span.icon.ghostType::before,
span.icon.dragonType::before,
span.icon.darkType::before,
span.icon.steelType::before,
span.icon.fairyType::before {
    content: '';
    display: inline-block;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    font-family: unset;
}

span.icon.normalType::before   { -webkit-mask-image: url('../imgs/type-icons/normal.svg');   mask-image: url('../imgs/type-icons/normal.svg'); }
span.icon.fireType::before     { -webkit-mask-image: url('../imgs/type-icons/fire.svg');     mask-image: url('../imgs/type-icons/fire.svg'); }
span.icon.waterType::before    { -webkit-mask-image: url('../imgs/type-icons/water.svg');    mask-image: url('../imgs/type-icons/water.svg'); }
span.icon.electricType::before { -webkit-mask-image: url('../imgs/type-icons/electric.svg'); mask-image: url('../imgs/type-icons/electric.svg'); }
span.icon.grassType::before    { -webkit-mask-image: url('../imgs/type-icons/grass.svg');    mask-image: url('../imgs/type-icons/grass.svg'); }
span.icon.iceType::before      { -webkit-mask-image: url('../imgs/type-icons/ice.svg');      mask-image: url('../imgs/type-icons/ice.svg'); }
span.icon.fightingType::before { -webkit-mask-image: url('../imgs/type-icons/fighting.svg'); mask-image: url('../imgs/type-icons/fighting.svg'); }
span.icon.poisonType::before   { -webkit-mask-image: url('../imgs/type-icons/poison.svg');   mask-image: url('../imgs/type-icons/poison.svg'); }
span.icon.groundType::before   { -webkit-mask-image: url('../imgs/type-icons/ground.svg');   mask-image: url('../imgs/type-icons/ground.svg'); }
span.icon.flyingType::before   { -webkit-mask-image: url('../imgs/type-icons/flying.svg');   mask-image: url('../imgs/type-icons/flying.svg'); }
span.icon.psychicType::before  { -webkit-mask-image: url('../imgs/type-icons/psychic.svg');  mask-image: url('../imgs/type-icons/psychic.svg'); }
span.icon.bugType::before      { -webkit-mask-image: url('../imgs/type-icons/bug.svg');      mask-image: url('../imgs/type-icons/bug.svg'); }
span.icon.rockType::before     { -webkit-mask-image: url('../imgs/type-icons/rock.svg');     mask-image: url('../imgs/type-icons/rock.svg'); }
span.icon.ghostType::before    { -webkit-mask-image: url('../imgs/type-icons/ghost.svg');    mask-image: url('../imgs/type-icons/ghost.svg'); }
span.icon.dragonType::before   { -webkit-mask-image: url('../imgs/type-icons/dragon.svg');   mask-image: url('../imgs/type-icons/dragon.svg'); }
span.icon.darkType::before     { -webkit-mask-image: url('../imgs/type-icons/dark.svg');     mask-image: url('../imgs/type-icons/dark.svg'); }
span.icon.steelType::before    { -webkit-mask-image: url('../imgs/type-icons/steel.svg');    mask-image: url('../imgs/type-icons/steel.svg'); }
span.icon.fairyType::before    { -webkit-mask-image: url('../imgs/type-icons/fairy.svg');    mask-image: url('../imgs/type-icons/fairy.svg'); }

/* Heart icon states */
span.icon.heart-icon {
    color: rgba(0, 0, 0, 0.35);
}

span.icon.heart-icon.not-favorite::before {
    content: '\e500';
}

span.icon.heart-icon.favorite {
    color: #FFFFFF;
}

/* Progress bar for background caching */
.progress-bar {
    position: fixed;
    bottom: 1rem;
    left: 0;
    height: 2px;
    background-color: #be2d3a;
    width: 0%;
    transition: width 0.2s ease;
    z-index: 9999;
    box-shadow: 0 0 10px rgba(214, 84, 106, 0.6), 0 0 20px rgba(214, 84, 106, 0.3);
    animation: glow-pulse 1.5s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 71, 87, 0.6), 0 0 20px rgba(255, 71, 87, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 71, 87, 0.8), 0 0 30px rgba(255, 71, 87, 0.5);
    }
}



.progress-bar.complete {
    opacity: 0;
    transition: opacity 0.5s ease 0.5s;
}

/* Handle Android Chrome address bar */
html {
    height: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height (excludes address bar) */
}

body {
    font-family: 'Poppins', sans-serif;
    background: #333333;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height */
    padding: 0;
    margin: 0;
    position: fixed;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
}

.container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    padding: 0;
}

@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
    }
}

.container > .main-heading header,
.container > .main-heading .search-container,
.container > .main-heading #errorContainer {
    flex-shrink: 0;
    padding: 8px;
}

.container > .main-heading .search-container {
    padding-bottom: 0;
}

.container > #pokemonContainer {
    flex: 1;
    overflow-y: auto;
    padding: 1rem .25rem 1.25rem;
    min-width: 0;
    scrollbar-width: none;
}

.container > .main-heading header {
    text-align: center;
    color: white;
    padding-top: 1rem;
}

.main-heading {
    background-color: #111111;
    padding-bottom: 1rem;
    border-bottom: 1px solid #666666;
}

h1 {
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.search-container {
    display: grid;
    gap: 0;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 0;
    padding: 0 15px;
}

input[type="text"] {
    background: #333333;
    border-radius: 4rem;
    border: none;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.75);
    color: #F6F6F6;
    flex: 1;
    font-family: 'Poppins', sans-serif;
    font-size: .875rem;
    margin: 0;
    padding: .65rem 2.5rem .5rem 2.75rem;
    position: relative;
}

input[type="text"]::placeholder {
    color: #888888;
}   

.search-input-wrapper::before {
    position: absolute;
    content: '\f002';
    font-family: 'IconFont';
    font-size: 1rem;
    color: #888888;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    z-index: 1;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    flex-shrink: 0;
}

input[type="text"]:focus {
    outline: none;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    background: #555555;
    border: none;
    color: #BBBBBB;
    font-size: 14px;
    cursor: pointer;
    padding: 12px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: none;
}

.clear-search-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #666;
    transform: scale(1.1);
}

.clear-search-btn:active {
    transform: scale(0.95);
}

.clear-search-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    background-color: #ff6b6b;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

#viewToggleBtn {
    padding: 12px 18px;
    font-size: 18px;
}

.pokemon-grid {
    display: grid;
    gap: 20px;
    padding: 8px;
}

/* Mobile: 1 column */
@media (max-width: 767px) {
    .pokemon-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 8px;
    }
}

/* Tablet screens (2 columns) */
@media (min-width: 768px) and (max-width: 1024px) {
    .pokemon-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 16px;
    }
}

/* Medium desktop (3 columns) */
@media (min-width: 1025px) {
    .pokemon-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 16px;
    }
}

.pokemon-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.pokemon-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: clip;
    position: relative;
    transform: scale(0.9);
    opacity: 0.3;
}

.pokemon-grid {
    display: grid;
    gap: 20px;
    padding: 8px;
}

.favorite-heart {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    user-select: none;
    color: rgba(0, 0, 0, 0.35);
}

.pokemon-grid.list-view .pokemon-card {
    display: flex;
    align-items: center;
    gap: 20px;
    text-align: left;
    padding: 8px;
    border-radius: 10px;
}

.pokemon-grid.list-view .pokemon-card:hover {
    transform: translateX(5px);
}

.pokemon-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.pokemon-grid.list-view .pokemon-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.pokemon-id {
    position: absolute;
    right: 2px;
    font-size: 40px;
    color: rgba(0, 0, 0, 0.35);
    font-weight: 900;
    line-height: 1;
    /* filter: brightness(.85); */
    /* opacity: .5; */
    z-index: -1;
    bottom: 0;
}

.pokemon-grid.list-view .pokemon-id {
    margin-bottom: 0;
    min-width: 50px;
}

.pokemon-image {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin: 10px auto;
}

.pokemon-grid.list-view .pokemon-image {
    width: 80px;
    height: 80px;
    margin: 0;
    flex-shrink: 0;
}

.pokemon-grid.list-view .pokemon-name {
    margin-bottom: 0;
}

.pokemon-grid.list-view .pokemon-card > div:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pokemon-grid.list-view .pokemon-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pokemon-grid.list-view .pokemon-types {
    justify-content: flex-start;
}

.pokemon-name {
    font-size: 18px;
    font-weight: bold;
    color: #000000;
    margin-bottom: 10px;
    text-transform: capitalize;
}

.pokemon-types {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pokemon-card .pokemon-types {
    margin-bottom: 0;
}

.pokemon-card .pokemon-info {
    display: grid;
    justify-items: flex-start;
}

.type-badge {
    display: inline-flex;
    border: 1px solid rgba(0,0,0,.25);
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: center;
}

.type-normal { background-color: #999999; background-image: url('../imgs/type-icons/normal.svg'); }
.type-fire { background-color: #ED6B3A; background-image: url('../imgs/type-icons/fire.svg'); }
.type-water { background-color: #578AC9; background-image: url('../imgs/type-icons/water.svg'); }
.type-electric { background-color: #F8DC4A; background-image: url('../imgs/type-icons/electric.svg'); }
.type-grass { background-color: #6CB645; background-image: url('../imgs/type-icons/grass.svg'); }
.type-ice { background-color: #70BAE9; background-image: url('../imgs/type-icons/ice.svg'); }
.type-fighting { background-color: #DB963B; background-image: url('../imgs/type-icons/fighting.svg'); }
.type-poison { background-color: #7B57A1; background-image: url('../imgs/type-icons/poison.svg'); }
.type-ground { background-color: #A47C41; background-image: url('../imgs/type-icons/ground.svg'); }
.type-flying { background-color: #8FB8E4; background-image: url('../imgs/type-icons/flying.svg'); }
.type-psychic { background-color: #EA797B; background-image: url('../imgs/type-icons/psychic.svg'); }
.type-bug { background-color: #9EC14D; background-image: url('../imgs/type-icons/bug.svg'); }
.type-rock { background-color: #BCB990; background-image: url('../imgs/type-icons/rock.svg'); }
.type-ghost { background-color: #6A486F; background-image: url('../imgs/type-icons/ghost.svg'); }
.type-dragon { background-color: #5B70B3; background-image: url('../imgs/type-icons/dragon.svg'); }
.type-dark { background-color: #595566 ; background-image: url('../imgs/type-icons/dark.svg'); }
.type-steel { background-color: #6D94A5; background-image: url('../imgs/type-icons/steel.svg'); }
.type-fairy { background-color: #DFB8D7; background-image: url('../imgs/type-icons/fairy.svg'); }

/* Modal type badges with icon and text */
.modal-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
    background-image: none !important;
}

.modal-type-badge .type-badge {
    width: 20px;
    height: 20px;
    background-size: 16px 16px;
    flex-shrink: 0;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    animation: backdropFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    align-items: flex-end;
    justify-content: center;
}

.modal[style*="display: block"],
.modal[style*="display: flex"] {
    display: flex !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px) !important;
}

#pokemonModal {
    align-items: center;
    justify-content: center;
}

.modal[style*="display: block"] {
    display: flex !important;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpIn {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDownOut {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

@keyframes backdropFadeIn {
    from {
        background-color: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0px);
    }
    to {
        background-color: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(8px);
    }
}

@keyframes backdropFadeOut {
    from {
        background-color: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(8px);
    }
    to {
        background-color: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0px);
    }
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px 15px 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUpIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

#pokemonModal .modal-content {
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: morphIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 55vw;
    background-color: #222222;
    color: #ffffff;
    border: 2px solid var(--extracted-color);
}

#pokemonModal .modal-region {
    color: #CCCCCC;
    font-size: 12px;
    padding: 8px 16px;
    border: 1px solid white;
    width: fit-content;
    text-align: center;
    margin: 0 auto 10px;
    border-radius: 24px;
}

#pokemonModal .modal-region span {
    margin-right: 4px;
}

#pokemonModal #modalTypes .type-badge {
    border: none;
}

/* Hide scrollbar while allowing scrolling */
.modal-content::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.modal-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        max-height: 95dvh;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Morph animation - from card to full modal */
@keyframes morphIn {
    from {
        transform: translate(var(--card-x), var(--card-y)) scale(var(--card-scale));
        opacity: 0.8;
    }
    to {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

@keyframes morphOut {
    from {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    to {
        transform: translate(var(--card-x, 0), var(--card-y, 0)) scale(var(--card-scale, 1));
        opacity: 0;
    }
}

/* Backdrop fade in */
@keyframes backdropFadeIn {
    from {
        backdrop-filter: blur(0px);
        background-color: rgba(0, 0, 0, 0);
    }
    to {
        backdrop-filter: blur(8px);
        background-color: rgba(0, 0, 0, 0.7);
    }
}

@keyframes backdropFadeOut {
    from {
        backdrop-filter: blur(8px);
        background-color: rgba(0, 0, 0, 0.7);
    }
    to {
        backdrop-filter: blur(0px);
        background-color: rgba(0, 0, 0, 0);
        opacity: 0;
    }
}

/* Content fade in stagger */
@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close button fade */
@keyframes closeButtonFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

.modal.closing {
    animation: fadeOut 0.3s ease forwards;
}

.modal.closing .modal-content {
    animation: slideDown 0.3s ease forwards;
}

.close {
    color: rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[style*="display: flex"] .close {
    display: flex;
}

.modal-header {
    text-align: center;
    padding: 20px 30px 0;
    position: relative;
}

.modal-favorite-heart {
    position: absolute;
    left: -10px;
    top: -15px;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.modal-favorite-heart:hover {
    transform: scale(1.15);
}

/* Modal heart icon states */
.modal-favorite-heart span.icon.heart-icon {
    color: inherit;
}
.modal-favorite-heart span.icon.heart-icon.not-favorite {
    color: rgba(0, 0, 0, 0.35);
}

.modal-favorite-heart span.icon.heart-icon.favorite {
    color: rgba(255, 255, 255, 0.75);
}

.modal-header-gradient {
    margin: -30px -30px .5rem -30px;
    padding: 30px 30px 20px 30px;
    border-radius: 15px 15px 0 0;
    /* Gradient applied inline with extracted color */
    transition: background 0.4s ease;
}

.modal-image {
    width: 200px;
    height: 200px;
    object-fit: contain;
    margin: 0 auto 20px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

.modal-name {
    font-size: 28px;
    font-weight: bold;
    color: #ffffff;
    text-transform: capitalize;
    letter-spacing: -0.5px;
}

.modal-name-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.modal-id {
    color: #ffffff;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 1px;
}

/* Staggered content animations */
.modal.opening .modal-header-gradient {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.modal.opening #modalTypes {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.modal.opening #modalStats {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.modal.opening #modalAbilities {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.modal.opening #modalEvolutions {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
}

.modal.opening #modalOtherForms {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both;
}

.modal.opening #modalEffectiveness {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s both;
}

.modal.opening #cryButton {
    animation: contentFadeIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.modal.opening .close {
    animation: closeButtonFade 0.4s ease-out 0.3s both;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
}

.stat-name {
    font-weight: bold;
    color: #FFF;
    min-width: 100px;
    text-transform: capitalize;
}

.stat-bar {
    flex: 1;
    height: 8px;
    border: 1px solid #666;
    border-radius: 4px;
    margin: 0 10px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background-color: var(--extracted-color, #667eea);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.stat-value {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: #ffffff;
}

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    z-index: 10000;
    overflow: hidden;
}

.splash-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.splash-progress-bar {
    position: fixed;
    bottom: 1rem;
    left: 0;
    height: 3px;
    background-color: #ff4757;
    width: 0%;
    transition: width 0.2s ease;
    z-index: 10001;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.6), 0 0 20px rgba(255, 71, 87, 0.3);
    animation: glow-pulse 1.5s ease-in-out infinite;
}

.splash-screen.complete {
    animation: fade-out-splash 0.5s ease 0.5s forwards;
}

@keyframes fade-out-splash {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

.error {
    background-color: #ff6b6b;
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination button {
    padding: 10px 20px;
    background-color: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.pagination button:hover {
    background-color: #667eea;
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.type-effectiveness {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.effectiveness-section {
    margin-bottom: 15px;
}

.effectiveness-title {
    font-weight: bold;
    color: #FFF;
    margin-bottom: 8px;
    font-size: 14px;
}

.effectiveness-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.evolution-section {
    margin: 15px 0;
}

.evolution-chain {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.evolution-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.evolution-item:hover {
    transform: scale(1.05);
}

.evolution-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.evolution-name {
    font-size: 12px;
    font-weight: bold;
    color: #FFF;
    text-transform: capitalize;
}

.evolution-arrow {
    font-size: 20px;
    color: var(--extracted-color, #667eea);
}

.evolution-condition {
    font-size: 11px;
    color: #CCC;
    text-align: center;
    max-width: 100px;
}

/* Other Forms Styles */
.other-forms-section {
    margin: 15px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.other-forms-section h4 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-weight: bold;
    font-size: 14px;
}

.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background-color: white;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.form-item:hover {
    border-color: #667eea;
    background-color: #f0f3ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.form-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.form-label {
    font-size: 11px;
    font-weight: bold;
    color: #333;
    text-transform: capitalize;
    line-height: 1.2;
}

.form-type-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #667eea;
    color: white;
    font-weight: bold;
    text-transform: capitalize;
}

/* Skeleton Loader Styles */
.skeleton-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: not-allowed;
}

.skeleton-element {
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 12px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-id {
    height: 14px;
    width: 50px;
    margin: 0 auto 8px;
}

.skeleton-image {
    height: 120px;
    width: 120px;
    margin: 10px auto;
    border-radius: 8px;
}

.skeleton-name {
    height: 20px;
    width: 80%;
    margin: 0 auto 10px;
}

.skeleton-types {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.skeleton-type {
    height: 24px;
    width: 60px;
    border-radius: 20px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 32px;
    }

    input[type="text"] {
        width: 100%;
    }

    .pokemon-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .modal-content {
        padding: 20px;
    }

    .close {
        color: #222222;
    }
}

/* Filters Modal and Button */
#openFiltersBtn {
    padding: 0;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Filter Badge */
.filter-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #be2d3a;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

/* Settings Button and Modal */
#openSettingsBtn {
    padding: 0;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
}

.settings-modal-content {
    width: 100%;
}

.toggles-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

.mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.3s ease;
}

.mobile-toggle span {
    font-weight: 500;
    color: #F6F6F6;
}

.mobile-toggle input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background-color: #222222;
    border-radius: 12px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.mobile-toggle input:checked + .toggle-slider {
    background-color: #1a4e7b;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: left 0.3s ease;
}

.mobile-toggle input:checked + .toggle-slider::before {
    left: 26px;
}

/* View toggle group */
.view-toggle-group {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #666666;
    background-color: #222222;
    color: #aaa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.view-toggle-btn.active {
    background-color: #1a4e7b;
    border-color: #1a4e7b;
    color: #F6F6F6;
}

.filters-modal-content {
    width: 100%;
}

.filters-modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.filter-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.toggles-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.mobile-toggle span {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.mobile-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 50px;
    height: 28px;
    background-color: #be2d3a;
    border-radius: 14px;
    position: relative;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    background-color: white;
    border-radius: 50%;
    top: 0;
    left: 0;
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mobile-toggle input[type="checkbox"]:checked + .toggle-slider {
    background-color: #1a4e7b;
}

.mobile-toggle input[type="checkbox"]:checked + .toggle-slider::after {
    left: 24px;
}

.filter-group select {
    padding: 10px 12px;
    border: 2px solid #1a4e7b;
    border-radius: 6px;
    background-color: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-group select:hover {
    border-color: #5568d3;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.filter-group select:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.force-refresh-btn {
    width: 100%;
    padding: 12px 16px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.force-refresh-btn:hover {
    background-color: #be2d3a;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    transform: translateY(-2px);
}

.force-refresh-btn:active {
    transform: translateY(0);
}

.force-refresh-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.filter-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

#resetFiltersBtn {
    flex: 1;
    padding: 10px 16px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#resetFiltersBtn:hover {
    background-color: #ee5a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

#resetFiltersBtn:active {
    transform: translateY(0);
}

#applyFiltersBtn {
    flex: 1;
    padding: 10px 16px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#applyFiltersBtn:hover {
    background-color: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#applyFiltersBtn:active {
    transform: translateY(0);
}

.apply-btn {
    background-color: #667eea;
}

@media (max-width: 768px) {
    .search-container {
        padding: 0 10px;
    }

    input[type="text"] {
        min-width: 150px;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .form-toggles {
        gap: 15px;
    }

    .toggle-label {
        font-size: 14px;
    }

    .modal-content {
        padding: 20px;
        padding-bottom: 100px;
        bottom: -80px;
    }

    #pokemonModal .modal-content {
        padding: 20px;
        padding-bottom: 20px;
        bottom: auto;
        width: 95dvw;
        border-radius: 15px;
        max-height: 98dvh;
    }
}

/* Pokemon Detail Panel Styles */
.pokemon-detail-panel {
    background-color: #f6f6f6;
    bottom: 0;
    height: 100dvh;
    left: 0;
    overflow-x: hidden;
    overflow-y: auto;
    position: fixed;
    scrollbar-width: none;
    top: 0;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    z-index: 5001;
}

.pokemon-detail-panel.open {
    transform: translateX(0);
}

.pokemon-detail-panel.closing {
    transform: translateX(100%);
}

.pokemon-favorites-toast {
    background: linear-gradient(180deg, #FFFFFF 0%, #AAAAAA 100%);
    border-radius: 4rem;
    bottom: 2dvh;
    box-shadow: 0 0 4rem rgba(0, 0, 0, 0.75);
    display: grid;
    font-size: .875rem;
    font-weight: 700;
    justify-content: center;
    left: 50%;
    opacity: 0;
    padding: .5rem 2rem;
    position: fixed;
    text-shadow: 0 1px 1px #DDDDDD;
    transform: translateX(-50%);
    transition: opacity 0.25s ease-in-out;
    width: max-content;
    z-index: 9999;
}

.pokemon-favorites-toast.show {
    opacity: 1;
}

.pokemon-favorites-toast .paragraphGrid {
    align-items: center;
    gap: 1rem;
}

.pokemon-favorites-toast .heart-check::before,
.pokemon-favorites-toast .heart-broken::before,
.pokemon-favorites-toast .circle-checkmark::before {
    font-size: 1.45rem;
}

.pokemon-favorites-toast .heart-check::before,
.pokemon-favorites-toast .heart-broken::before {
    color: #be2d3a;
}
.pokemon-favorites-toast .circle-checkmark::before {
    color: #378d35;
}

#pokemonContainer .pokemonCard {
    align-items: center;
    background:linear-gradient(90deg, color-mix(in srgb, var(--type-1-color), #FFFFFF 80%), var(--type-1-color) 45%, var(--type-2-color) 75%);
    border: 1px solid rgba(0, 0, 0, .75);
    border-radius: .5rem;
    box-shadow: inset 0 4px 4px rgba(255, 255, 255, .5), inset 0 -2px 4px rgba(0, 0, 0, .5), 0 4px 8px rgba(0, 0, 0, .75);
    display: grid;
    grid-template-columns: 5rem auto 1fr;
    overflow: clip;
    padding: .5rem;
    position: relative;
    gap: .5rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#pokemonContainer .pokemonCard:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease-out !important;
}

#pokemonContainer .pokemonCard .pokemonImage,
#pokemonContainer .pokemonCard .pokemonInfo,
#pokemonContainer .pokemonCard .pokemonID {
    background-color: transparent;
    border: none;
    padding: 0;
}

#pokemonContainer .pokemonCard .pokemonInfo {
    grid-template-columns: 1fr;
    gap: .25rem;
    justify-items: flex-start;
}

#pokemonContainer .pokemonCard .pokemonInfo p{
    font-weight: 700;
    font-size: 1.5rem;
    color: #000000;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.45);
}

#pokemonContainer .pokemonCard .pokemonInfo .pokemonTyping {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .25rem;
}

#pokemonContainer .pokemonCard .pokemonInfo .pokemonTyping li {
    align-items: center;
    border-radius: .25rem;
    color: rgba(0, 0, 0, .75);
    display: grid;
    font-size: .75rem;
    font-weight: 700;
    gap: .25rem;
    grid-template-columns: auto auto;
    justify-content: center;
    line-height: 1;
    list-style-type: none;
    padding: .25rem;
    text-transform: uppercase;
}

#pokemonContainer .pokemonCard .pokemonInfo .pokemonTyping li span {
    font-size: .875rem;
    text-shadow: 0 1px 1px color-mix(in srgb, var(--type-1-color), #FFFFFF 50%);
}

#pokemonContainer .pokemonCard .pokemonInfo .pokemonTyping li:first-child {
    background: var(--type-1-color);
    background: linear-gradient(180deg, color-mix(in srgb, var(--type-1-color), #FFFFFF 35%), color-mix(in srgb, var(--type-1-color), #000000 25%));
    border: 1px solid color-mix(in srgb, var(--type-1-color), #000000 25%);
}

#pokemonContainer .pokemonCard .pokemonInfo .pokemonTyping li:last-child {
    background: var(--type-2-color);
    background: linear-gradient(180deg, color-mix(in srgb, var(--type-2-color), #FFFFFF 35%), color-mix(in srgb, var(--type-2-color), #000000 25%));
    border: 1px solid color-mix(in srgb, var(--type-2-color), #000000 25%);
}

#pokemonContainer .pokemonCard .additionalInfo {
    display: grid;
    position: relative;
    height: stretch;
}

#pokemonContainer .pokemonCard .additionalInfo .favorite-heart {
    top: 0;
    right: 0;
}

#pokemonContainer .pokemonCard .additionalInfo .nationalDexNumber {
    font-size: 3.75rem;
    position: absolute;
    letter-spacing: -.225rem;
    bottom: -2.25rem;
    right: -.5rem;
    opacity: .75;
    color: color-mix(in srgb, var(--type-2-color), #000000 25%);
    text-shadow: 0 -2px 1px color-mix(in srgb, var(--type-2-color), #000000 50%);
}