/**
 * Estilos para Popovers de Imágenes - Versión 2 (Simplificada y Segura)
 * Inventario - SGB
 * Fecha: 2025-11-11
 */

/* Contenedor principal del popover */
.sgb-popover-wrapper {
    position: absolute;
    z-index: 1050;
    pointer-events: auto;
    /* NO usar fixed para evitar bloqueos */
}

/* Contenedor interno - Diseño mejorado (similar a popover de código) */
.sgb-image-popover-v2 {
    width: 300px;
    background: white;
    border: 2px solid #667eea; /* Se sobrescribe inline con color dinámico */
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25); /* Se puede mejorar con color dinámico */
    padding: 10px;
    animation: sgbPopoverFadeIn 0.3s ease-out;
    font-family: 'Poppins', sans-serif;
    transition: box-shadow 0.3s ease;
}

/* Cabecera del Popover */
.sgb-popover-header {
    display: flex;
    align-items: center;
}

/* Contenedor de imagen mejorado */
.sgb-image-container-v2 {
    position: relative;
}

/* Animación de entrada mejorada */
@keyframes sgbPopoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Contenedor de la imagen */
.sgb-image-container {
    width: 100%;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.sgb-image-container img {
    max-width: 250px;
    max-height: 250px;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Información y botones */
.sgb-image-info {
    text-align: center;
}

.sgb-image-info .badge {
    font-size: 0.7rem;
    padding: 0.3em 0.6em;
}

/* Botón de sugerir - Estilo mejorado */
.btn-sugerir-imagen-v2 {
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
    transition: all 0.3s ease;
    /* Los colores se aplican inline dinámicamente */
}

.btn-sugerir-imagen-v2:hover {
    transform: translateY(-2px);
    filter: brightness(0.9) saturate(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Barra de progreso */
.sgb-image-popover-v2 .progress {
    border-radius: 4px;
    background-color: #e9ecef;
}

.sgb-image-popover-v2 .progress-bar {
    transition: width 0.6s ease;
}

/* Modal de sugerencia */
#modalSugerirImagen .modal-header {
    background-color: #0d6efd !important; /* Bootstrap primary */
}

#modalSugerirImagen .modal-title {
    color: white !important;
}

/* Forzar centrado vertical del modal según STYLEGUIDE.md */
#modalSugerirImagen .modal-dialog {
    display: flex !important;
    align-items: center !important;
    min-height: calc(100% - 1rem);
    margin: 0.5rem auto;
}

/* CRÍTICO: Asegurar que el resto de la página funcione */
body, body * {
    pointer-events: auto !important;
}

.sgb-popover-wrapper {
    pointer-events: auto !important;
}

/* Responsive */
@media (max-width: 768px) {
    .sgb-image-popover {
        width: 220px;
    }
    
    .sgb-image-container {
        height: 200px;
    }
    
    .sgb-image-container img {
        max-width: 200px;
        max-height: 200px;
    }
}

/* ============================================ */
/* MODAL DE SUGERENCIA - Centrado y atractivo */
/* ============================================ */
#modalSugerirImagen .modal-dialog {
    max-width: 600px;
}

#modalSugerirImagen .modal-content {
    border: 2px solid #667eea;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

#modalSugerirImagen .modal-header {
    border-top-left-radius: 13px;
    border-top-right-radius: 13px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#modalSugerirImagen .modal-body {
    padding: 25px;
}

#modalSugerirImagen #sugerenciaProductoNombre {
    color: #667eea;
    font-weight: 600;
    font-size: 1.1rem;
}

#modalSugerirImagen #sugerenciaPreview {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modalSugerirImagen #sugerenciaPreview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #e9ecef;
}

#modalSugerirImagen .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 0.25em;
    color: #667eea;
}

#modalSugerirImagen .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    transition: all 0.3s ease;
}

#modalSugerirImagen .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Responsive para el modal */
@media (max-width: 768px) {
    #modalSugerirImagen .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    #modalSugerirImagen .modal-body {
        padding: 15px;
    }
    
    #modalSugerirImagen #sugerenciaPreview img {
        max-height: 200px;
    }
}

