/* Vermelho (Topo): #EE1515
Branco (Base): #F0F0F0
Preto (Faixa Central): #222224
Azul (Fundo): #2196F3
Brilho (Estrelas): #FFFFFF
Normal	#A8A77A
Grass	#7AC74C
Ground	#E2BF65
Fighting	#C22E28
Rock	#B6A136
Steel	#B7B7CE
Fire	#EE8130
Electric	#F7D02C
Flying	#A98FF3
Psychic	#F95587
Bug	#A6B91A
Dragon	#6F35FC
Water	#6390F0
Ice	#96D9D6
Poison	#A33EA1
Dark	#705746
Ghost	#735797
Fairy	#D685AD */

:root{
    --bg-top: #eaf4ff;
    --bg-bottom: #cfe6ff;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --border-soft: rgba(8, 81, 141, 0.12);
    --shadow-soft: 0 10px 30px rgba(8, 81, 141, 0.10);
    --shadow-card: 0 12px 28px rgba(34, 34, 36, 0.14);

    --brand-blue: #08518d;
    --brand-red: #EE1515;
    --text-main: #1f2937;
    --text-soft: #5b6472;
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --space-section: clamp(1.5rem, 3vw, 2.75rem);
}

/* Header */
header{
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(8px);
}

header img{
    width: clamp(72px, 10vw, 96px);
    height: auto;
    flex-shrink: 0;
}

header h1{
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1;
    color: var(--brand-blue);
    text-shadow: 2px 2px 0 rgba(238, 21, 21, 0.18);
}

/* Busca */
form{
    width: 100%;
    display: flex;
    justify-content: center;
}

.search{
    width: min(680px, 100%);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
    gap: 0;
    margin: 0;
    background: var(--surface-strong);
    border: 1px solid rgba(8, 81, 141, 0.18);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.search label{
    display: none;
}

.search input{
    width: 100%;
    min-width: 0;
    height: 58px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-main);
    padding: 0 1.25rem;
}

.search input::placeholder{
    color: var(--text-soft);
    font-size: 0.98rem;
}

.btn-search{
    border: none;
    background: var(--brand-blue);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0 1.35rem;
    min-width: 120px;
    cursor: pointer;
    transition: background-color .2s ease, transform .2s ease;
}

.btn-search:hover{
    background: #063d6b;
}

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

.search:focus-within{
    border-color: rgba(8, 81, 141, 0.35);
    box-shadow: 0 0 0 4px rgba(8, 81, 141, 0.08), var(--shadow-soft);
}

/* Grid */
.card-container{
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

/* Card da grade */
.card{
    width: 100%;
    min-width: 0;
    padding: 1.15rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
}

.card:hover{
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 32px rgba(34, 34, 36, 0.18);
}

.card-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.name,
.number{
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.name{
    font-size: 1.1rem;
    color: var(--text-main);
}

.number{
    font-size: 0.9rem;
    color: var(--text-soft);
    opacity: 0.7;
}

.card-img{
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin: 10px auto;
    display: block;
}

.type{
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Modal */
.modal{
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: grid;
    place-items: center;
    padding: 1rem;
    z-index: 9999;
    overflow: hidden;
}

.hidden{
    display: none;
}

.modal-content{
    position: relative;
    width: min(420px, 100%);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: white;
    border-radius: 20px;
    padding: 2.5rem 1.25rem 1.25rem;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.modal-close{
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
}

#modal-card{
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Card do modal */
.modal-pokemon-card{
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-card-front,
.modal-card-back{
    width: 100%;
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.modal-card-front{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.modal-card-front.hidden{
    display: none;
}

.modal-card-back{
    display: none;
    background: white;
    color: var(--text-main);
}

.modal-card-back.active{
    display: block;
}

.modal-card-header{
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.modal-card-img{
    width: min(220px, 100%);
    height: 220px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.modal-card-types{
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-card-back h3,
.modal-card-back h4{
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.modal-card-back p{
    margin: 0.4rem 0;
}

.modal-card-back ul{
    padding-left: 1.25rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.details-link{
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--brand-blue);
    font-weight: 700;
    text-decoration: none;
}

/* Botões do modal */
.modal-btn{
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 10px;
    background: var(--brand-blue);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.modal-btn:hover{
    opacity: 0.92;
}

.modal-btn:active{
    transform: scale(0.98);
}

/* Botões de ação */
.load-more-container{
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

#load-more-btn,
.reset-list-btn,
.back-to-top{
    min-width: 180px;
    padding: 0.85rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#load-more-btn{
    background: var(--brand-blue);
    color: white;
}

.reset-list-btn{
    background: white;
    color: var(--brand-blue);
    border: 1px solid rgba(8, 81, 141, 0.2);
}

.back-to-top{
    background: var(--brand-red);
    color: white;
}

#load-more-btn:hover,
.reset-list-btn:hover,
.back-to-top:hover{
    opacity: 0.92;
}

#load-more-btn:active,
.reset-list-btn:active,
.back-to-top:active{
    transform: scale(0.98);
}

/* Página de detalhes */
.pokemon-details{
    width: 100%;
    display: flex;
    justify-content: center;
}

.details-card{
    width: min(500px, 100%);
    background: rgba(255, 255, 255, 0.82);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.details-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.details-header h2{
    margin: 0;
    font-size: 1.6rem;
}

.details-header p{
    margin: 0;
    font-weight: 700;
    color: var(--text-soft);
}

.details-img{
    width: 200px;
    height: 200px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.details-types{
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.details-types span{
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(8, 81, 141, 0.1);
    color: var(--brand-blue);
    font-weight: 700;
    text-transform: capitalize;
}

.details-info p{
    margin: 0.4rem 0;
}

.details-abilities h3,
.details-stats h3,
.details-evolutions h3{
    margin-bottom: 0.5rem;
}

.details-abilities ul{
    margin: 0;
    padding-left: 1.25rem;
}

.details-stats{
    margin-top: 1rem;
}

.stat-item{
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.stat-top{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.stat-name{
    font-weight: 700;
    color: var(--text-main);
}

.stat-value{
    font-weight: 700;
    color: var(--brand-blue);
}

.stat-bar{
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(8, 81, 141, 0.12);
    overflow: hidden;
}

.stat-fill{
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-blue), var(--brand-red));
}

.details-evolutions{
    margin-top: 1rem;
}

#evolution-chain{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.evolution-card{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.8rem;
    border-radius: 16px;
    background: rgba(8, 81, 141, 0.06);
    text-decoration: none;
    color: var(--text-main);
    transition: transform .2s ease, box-shadow .2s ease;
}

.evolution-card:hover{
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.evolution-number{
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-soft);
}

.evolution-img{
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.evolution-name{
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}

/* Tablet */
@media (max-width: 768px){
    .card-container{
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }
}

/* Celular */
@media (max-width: 480px){
    main{
        width: calc(100% - 0.75rem);
    }

    .card-container{
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .card{
        min-height: 300px;
        padding: 0.85rem;
        border-radius: 18px;
    }

    .card-img{
        width: 100%;
        max-width: 120px;
        height: 120px;
    }

    .name{
        font-size: 0.9rem;
    }

    .number{
        font-size: 0.78rem;
    }

    .search{
        grid-template-columns: 1fr;
    }

    .btn-search{
        width: 100%;
    }

    header h1{
        font-size: 1.6rem;
    }

    .load-more-container{
        flex-direction: column;
        align-items: stretch;
    }

    #load-more-btn,
    .reset-list-btn,
    .back-to-top{
        width: 100%;
        min-width: 0;
    }

    .modal-content{
        width: 100%;
        padding: 2.25rem 1rem 1rem;
    }

    .modal-card-img{
        width: min(180px, 100%);
        height: 180px;
    }

    .details-img{
        width: 160px;
        height: 160px;
    }

    #evolution-chain{
        grid-template-columns: 1fr;
    }
}