body {
    min-height: 100vh;
    margin: 0;
    background-color: #f5fcff;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}

#container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem 3rem;
}

.volver-lista {
    display: inline-block;
    font-family: 'Times New Roman', Times, serif;
    color: #0b5f8a;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.volver-lista:hover {
    text-decoration: underline;
}

h1 {
    font-size: 2rem;
    color: #003f66;
    margin-bottom: 0.7rem;
    margin-top: 0.4rem;
}

#container > p {
    color: #555;
    margin-bottom: 1.5rem;
}


/* BUSCADOR */

.search-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 680px;
    margin-bottom: 2rem;
}

.search-field {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-field__icon {
    position: absolute;
    top: 50%;
    left: 0.9rem;
    width: 1.15rem;
    height: 1.15rem;
    transform: translateY(-50%);
    stroke: #52788d;
    stroke-width: 1.8;
    stroke-linecap: round;
    pointer-events: none;
}

#search-input {
    width: 100%;
    height: 2.75rem;
    box-sizing: border-box;
    padding: 0 1rem 0 2.75rem;

    border: 1px solid #b8ccd7;
    border-radius: 9px;
    background-color: #fff;
    color: #243943;

    font: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#search-input::placeholder {
    color: #718793;
}

.search-field:focus-within .search-field__icon {
    stroke: #0b5f8a;
}

#search-input:focus {
    border-color: #16739a;
    box-shadow: 0 0 0 3px rgba(22, 115, 154, 0.16);
}

/* Oculta el control nativo para mantener una sola acción de limpieza. */
#search-input::-webkit-search-cancel-button {
    appearance: none;
}

#btn-limpiar {
    height: 2.75rem;
    padding: 0 1.1rem;

    border: 1px solid #8fb2c4;
    border-radius: 9px;

    background-color: #eef7fb;
    color: #0b5f8a;

    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#btn-limpiar:hover {
    border-color: #5f94ad;
    background-color: #deeff7;
}

#btn-limpiar:focus-visible {
    outline: 3px solid rgba(22, 115, 154, 0.22);
    outline-offset: 2px;
}


/* GRID */

.contenedor-especies {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.sin-coincidencias {
    grid-column: 1 / -1;
    margin: 0;
    padding: 2rem 1.25rem;
    border: 1px solid #d6e4eb;
    border-radius: 10px;
    background-color: #fff;
    color: #4c6673;
    text-align: center;
}


/* CARDS */

.card-especie {
    background-color: #fff;
    border-radius: 12px;
    padding: 24px;

    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);

    display: flex;
    flex-direction: column;

    min-height: 340px;
}

.card-especie-img {
    width: 100%;
    height: 190px;

    object-fit: contain;
    object-position: center;

    border-radius: 8px;
    margin-bottom: 20px;
}

.card-especie-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-especie h3 {
    margin: 0 0 12px;
    font-size: 1.25rem;
    color: #003f66;
}

.nombre-cientifico {
    margin: 0 0 16px;
    font-style: italic;
    color: #16739a;
}

.card-especie a {
    margin-top: auto;

    width: fit-content;
    padding: 10px 24px;

    background-color: #06496d;
    color: white;

    text-decoration: none;
    border-radius: 7px;

    transition: background-color 0.2s ease;
}

.card-especie a:hover {
    background-color: #033d5d;
}


/* TABLET GRANDE */

@media (max-width: 1100px) {

    .contenedor-especies {
        grid-template-columns: repeat(3, 1fr);
    }

}


/* TABLET */

@media (max-width: 800px) {

    .contenedor-especies {
        grid-template-columns: repeat(2, 1fr);
    }

}


/* MÓVIL */

@media (max-width: 600px) {

    #container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .search-controls {
        gap: 0.5rem;
    }

    #btn-limpiar {
        flex-shrink: 0;
        padding: 0 0.85rem;
    }

    .contenedor-especies {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card-especie {
        min-height: auto;
        padding: 1rem;
    }

    .card-especie-img {
        height: 190px;
        margin-bottom: 16px;
    }

}
