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


ul,ol,li{
    list-style: none;
}


body {
    font-family: 'Get Schwifty', sans-serif;
    background: linear-gradient(358deg,rgba(81, 219, 191, 1) 30%, rgba(25, 97, 90, 1) 70%);
    color: #ffffff;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


header {
    background-color: #19615A;
    color: white;
    text-align: center;
    padding: 1rem 2rem;
    display: flex;
    font-size: 1.2rem;
    font-weight: bold;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 999;
}


header a {
    color: inherit; 
    text-decoration: none;
    display: flex; /* Para alinhar a imagem do portal corretamente */
    align-items: center;
}

header li{
    text-align: center;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    transition: .5s;
}

header .portal img {
    height: 40px; 
    vertical-align: middle;
}


header li:hover{
    background-color: #057483;
    box-shadow: 0 4px 8px #0005;
}


h1 {
    margin: 0;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.pesquisa {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 2rem;
    width: 100%;
}

.caixa-de-pesquisa {
    display: flex;
    align-items: center;
    gap: 10px;
}

.caixa-de-pesquisa input {
    text-align: center;
    border-radius: 2px;
    width: 200px;
    height: 30px;
}

.caixa-de-pesquisa button {    
    border-radius: 4px;
    width: 100px;
    height: 30px;
    background-color: rgb(214, 245, 255);
}


.principais-personagens {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 2rem; /* Espaçamento mais consistente */
}

.principais-personagens h2 {
    margin-bottom: 1.5rem;
}

.search-results-container {
    width: 100%;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    justify-items: center;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto; /* Centraliza a grade na página */
    padding: 0 1rem; /* Garante que os cards não colem nas bordas */
}
.personagem-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    width: 250px; /* Largura fixa para os slides */
    flex-shrink: 0; /* Impede que os cards encolham */
    cursor: pointer;
}


.personagem-card:hover {
    transform: translateY(-5px);
}


.personagem-card img {
    width: 100%;
    height: auto;
    object-fit: cover;
}


.card-content {
    padding: 15px;
}


.card-content h2 {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    color: #007bb6;
}


.card-content p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #333;
}

.limpar-busca-btn {
    background-color: #00b6b0;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    margin-bottom: 20px;
    grid-column: 1 / -1; /* Faz o botão ocupar a largura total da grade */
    justify-self: center;
}

.limpar-busca-btn:hover {
    background-color: #00a6a9;
}

/* --- Estilos do Modal --- */
.modal-container {
    display: none; /* Escondido por padrão */
    position: fixed; /* Fica fixo na tela */
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Adiciona scroll se o conteúdo for grande */
    background-color: rgba(0, 0, 0, 0.7); /* Fundo escurecido */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-container.show {
    display: flex; /* Mostra o modal */
}

.modal-content {
    background-color: #2c3e50;
    color: #ecf0f1;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close-btn {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: #fff;
    text-decoration: none;
}

.modal-body-content {
    display: flex;
    gap: 20px;
}

.modal-body-content img {
    max-width: 250px;
    height: auto;
    border-radius: 8px;
}

.modal-body-content ul {
    padding-left: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.loading,
.error {
    text-align: center;
    width: 100%;
    font-size: 1.2rem;
    color: #666;
}


footer {
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    padding: 15px;
    background-color: #333;
    color: #bbb;
    margin-top: auto;
}

/* --- Responsividade --- */

/* Tablets */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 10px;
        padding: 1rem;
    }

    .principais-personagens {
        /* O espaçamento já é adequado vindo do .pesquisa */
    }

    .modal-body-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

}

/* Celulares */
@media (max-width: 480px) {
    header {
        padding: 0.75rem 1rem; /* Padding mais compacto para mobile */
        flex-direction: row; /* Volta para linha horizontal */
        justify-content: center; /* Centraliza o item restante (portal) */
    }

    header .home,
    header .nome-site {
        display: none; /* Esconde o link "Home" e o título principal */
    }

    header .portal img {
        height: 30px;
    }

    .pesquisa {
        margin-top: 1.5rem; /* Reduz o espaço no topo */
    }

    .caixa-de-pesquisa {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .modal-content {
        padding: 20px;
    }

    .principais-personagens h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem; /* Reduz o espaço abaixo do título */
    }

    .card-content h2 {
        font-size: 1.1rem;
    }

    .limpar-busca-btn {
        padding: 10px 20px;
    }
}