/* ========================================================

   ESTILOS PARA MINIATURAS DE BÚSQUEDA
   Proporciona estilos consistentes para las imágenes en miniatura
   mostradas en resultados de búsqueda, incluyendo hover effects,
   proporción de aspecto, y animaciones de carga.
   ======================================================== */

/* Contenedor básico de miniaturas - polaroid style */
.item-producto.polaroid {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin: 0.6em;
    padding: 0.7em 0.7em 1em;
    overflow: hidden;
    width: 240px;
    height: 240px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.item-producto.polaroid:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* Imagen dentro de la miniatura */
.item-producto.polaroid img {
    width: 100%;
    height: 180px;
    display: block;
    object-fit: cover;
    border-radius: 6px;
    background-color: #f5f5f5;
}

/* Nombre del producto */
.nombre-producto {
    font-size: 0.95em;
    font-weight: 500;
    text-align: center;
    color: #333;
    padding: 0.5em 0.2em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: none;
    line-height: 1.2;
}

/* Transición de carga de imagen */
.item-producto.polaroid img.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.item-producto.polaroid img.lazy-image.loaded {
    opacity: 1;
}

/* Efectos de carga y placeholder */
.item-producto.polaroid .image-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(110deg, #f5f5f5 30%, #efefef 50%, #f5f5f5 70%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 6px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Grid responsivo en pantallas más pequeñas */
@media (max-width: 768px) {
    .galeria-items {
        justify-content: center;
    }
    
    .item-producto.polaroid {
        width: 180px;
        height: 220px;
        margin: 0.4em;
    }
    
    .item-producto.polaroid img {
        height: 160px;
    }
    
    .nombre-producto {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .item-producto.polaroid {
        width: calc(50% - 1em);
        margin: 0.4em;
    }
}

/* Indicador de carga específico para miniaturas */
.miniature-loading {
    position: relative;
}

.miniature-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(247, 146, 30, 0.2);
    border-top-color: #f7921e;
    border-radius: 50%;
    animation: mini-spin 1s linear infinite;
    z-index: 1;
}

@keyframes mini-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Estilos para miniaturas en vistas múltiples y scroll infinito */
.galeria-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 1em;
    margin: 0 auto;
    max-width: 1200px;
}

/* Efecto de focus para accesibilidad */
.item-producto.polaroid:focus {
    outline: none;
    box-shadow: 0 0 0 2px #f7921e, 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* Estilos para indicar cuando un producto tiene múltiples imágenes */
.item-producto.polaroid.has-multiple::after {
    content: "+";
    position: absolute;
    right: 10px;
    top: 10px;
    background: #f7921e;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}