body {
    background-color: #1a1a1a;
    color: #f0f0f0;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

/* --- Buscador --- */
#search-container {
    text-align: center;
    padding: 10px 0 20px 0;
}

#search-input {
    width: 90%;
    max-width: 600px;
    padding: 12px 20px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #333;
    color: #f0f0f0;
    font-size: 1em;
}

#search-input::placeholder {
    color: #b0b0b0;
}

/* --- Selector de JSON --- */
#json-selector-container {
    text-align: center;
    margin-bottom: 20px;
}

#json-selector {
    padding: 8px 15px;
    font-size: 1em;
    border-radius: 4px;
    border: none;
    background-color: #fdd835;
    color: #1a1a1a;
    font-weight: bold;
}

/* --- Paginación --- */
#pagination-controls {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
    background-color: #2a2a2a;
    border-radius: 4px;
    color: #f0f0f0;
}

#pagination-controls button {
    background-color: #fdd835;
    color: #1a1a1a;
    border: none;
    padding: 10px 20px;
    margin: 0 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
}

#pagination-controls button:disabled {
    background-color: #555;
    cursor: not-allowed;
    color: #ccc;
}

/* --- Tarjetas --- */
#hotwheels-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    min-height: 80vh;
}

.hotwheels-card {
    background-color: #2a2a2a;
    padding: 16px;
    border-radius: 12px;
    width: 380px;
    height: 150px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);

    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hotwheels-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Contenedor de imagen */
.image-loader {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 4px solid #fdd835;
    /* color principal */
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2;
}

/* Centrado dentro del contenedor */
.card-image-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 10px;
    margin-right: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Imagen dentro de la card */
.card-image-wrapper img {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Contenedor del texto */
.card-text-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.card-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 5px;
}

.card-detail {
    font-size: 0.8em;
    color: #b0b0b0;
    margin: 1px 0;
}

.card-year {
    font-size: 1em;
    font-weight: bold;
    color: #fdd835;
    margin-top: 5px;
}

/* ================================== */
/* === MODAL (SECCIÓN MODIFICADA) === */
/* ================================== */

/* --- MODAL BASE --- */
#modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#modal-content {
    background-color: #2a2a2a;
    color: #f0f0f0;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 80%;
    overflow: hidden;
    padding: 25px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Cerrar modal */
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: bold;
    background: none;
    border: none;
    color: #f0f0f0;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    z-index: 10;
}

.modal-close:hover {
    color: #fdd835;
}

/* Layout principal del modal (flex) */
.modal-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    align-items: flex-start;
    /* Alineación arriba para mejor look */
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

/* Contenedor de la imagen (Flexibilidad para crecer/encoger pero con límites) */
.modal-image-container {
    width: 100%;
    /* Ocupa todo el ancho en móvil */
    max-width: 300px;
    /* Máximo ancho en escritorio */
    aspect-ratio: 1 / 1;
    /* Mantiene una proporción cuadrada o similar */
    flex-shrink: 0;

    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
    border-radius: 10px;
    padding: 10px;
}

/* Media query para escritorio: fuerza el tamaño fijo para el look de la foto */
@media (min-width: 600px) {
    .modal-image-container {
        width: 250px;
        height: 250px;
        max-width: none;
        aspect-ratio: auto;
    }
}


/* IMAGEN DENTRO DEL CONTENEDOR - AHORA CON MAX-WIDTH/MAX-HEIGHT AL 100% */
.modal-image-container img {
    max-width: 100%;
    /* La imagen no superará el ancho de su contenedor */
    max-height: 100%;
    /* La imagen no superará el alto de su contenedor */
    object-fit: contain;
    /* Muestra la imagen completa sin cortar */
    border-radius: 5px;
    cursor: pointer;
}

/* Contenedor de los detalles */
.modal-details-container {
    flex: 1 1 300px;
    position: relative;
    padding-bottom: 30px;
    min-width: 250px;
}

/* Título (Marca + Modelo) */
.modal-title {
    font-size: 1.8em;
    font-weight: bold;
    color: #fdd835;
    margin: 0 0 15px 0;
}

/* Párrafo de detalle */
.modal-detail {
    font-size: 1em;
    color: #f0f0f0;
    margin: 8px 0;
}

.modal-detail b {
    color: #b0b0b0;
    font-weight: normal;
}

/* ID Badge en la esquina */
.modal-id-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: #444;
    color: #b0b0b0;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: monospace;
}

/* Fullscreen imagen overlay (Sin cambios) */
.image-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.image-fullscreen img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    cursor: zoom-out;
}

/* === ANIMACIÓN (Sin cambios) === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}