#esimg_results {
    display: grid;
    /* Ajusta el número de columnas a 220px como mínimo */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.esimg-item {
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    /* Agregado para indicar que es clickeable */
    /* Puedes añadir un borde o sombra si lo deseas */
}

.esimg-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    /* Asegura que la imagen cubra el área sin distorsionarse */
    display: block;
}

.esimg-item .meta {
    padding: 8px;
    font-size: 13px;
    color: #333;
}

/* Estilos para el modal */
#esimgModal .modal-body {
    text-align: center;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

#esimgModal .modal-body img {
    max-width: 100%;
    height: auto;
    max-height: 50vh;
}

#esimgModal .modal-body video {
    max-width: 100%;
    height: 50vh;
}

.play-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 1);
    mask: url('data:image/svg+xml;utf8,<svg fill="white" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M8 5v14l11-7z"/></svg>') center / contain no-repeat;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    border-radius: 4px;
}

#downloadBtn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.spinner {
    border: 3px solid #fff;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-right: 6px;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

#esimg_loader {
    display: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 6px solid #ccc;
    border-top-color: #007bff;
    /* Color azul primario */
    animation: spin 0.9s linear infinite;
    margin: 30px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* player constrols */

    /* Estilo del Contenedor de Controles */
#custom-video-controls {
    /* Posicionamiento: FLOTAR SOBRE EL VIDEO */
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    
    /* Apariencia */
    background: #12629f; /* Fondo semitransparente oscuro */
    color: white;
    padding: 8px 15px;
    box-sizing: border-box;
    display: flex !important; /* Usamos flexbox para alinear elementos */
    align-items: center;
    justify-content: flex-start; /* Alinea los elementos a la izquierda */
    font-size: 14px;
    opacity: 0.9; /* Opacidad sutil */
    transition: opacity 0.3s ease;
}

/* Estilo del Botón de Play/Pause */
#play-pause-btn {
    /* Reseteo de estilos nativos */
    background: none;
    border: none;
    color: white;
    font-size: 18px; /* Aumentamos el tamaño */
    cursor: pointer;
    padding: 0 10px;
    line-height: 1; /* Asegura que el texto esté centrado */
    /* Usaremos el texto "Play" / "Pause" para representar el estado */
}

#play-pause-btn:hover {
    color: #4CAF50; /* Color verde en hover */
}

/* Estilo del Slider de Volumen (Input Range) */
#volume-slider {
    /* Resetear apariencia nativa y hacerlo más compacto */
    -webkit-appearance: none;
    background: transparent;
    width: 80px; /* Ancho fijo para el control */
    margin: 0 8px;
    cursor: pointer;
}

/* Estilo de la pista (Track) del slider para navegadores basados en WebKit (Chrome/Safari) */
#volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3); /* Pista transparente */
    border-radius: 2px;
}

/* Estilo del pulgar (Thumb) del slider para WebKit */
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: none;
    height: 12px;
    width: 12px;
    border-radius: 50%; /* Circular */
    background: white; /* Color blanco para el control */
    margin-top: -4px; /* Centrar verticalmente */
}

/* Estilo de los textos e iconos (Volumen Display) */
.volume-icon, #volume-display {
    padding: 0 5px;
    white-space: nowrap; /* Evita que el texto de porcentaje se rompa */
}