/* ===== ESTILOS PERSONALIZADOS - COMPLEMENTO A BOOTSTRAP ===== */

/* -------------------------------------
    COLORES PERSONALIZADOS
-------------------------------------- */
.bg-purple {
  background-color: #6f42c1 !important;
}
.text-purple {
  color: #6f42c1 !important;
}
.border-purple {
  border-color: #6f42c1 !important;
}

/* -------------------------------------
    LOGIN SECTION
-------------------------------------- */
.login-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 40%, #415a77 100%);
}
.login-section .card {
  border: none;
  border-radius: 1rem;
}
.login-section .card-header {
  border-radius: 1rem 1rem 0 0 !important;
}

/* -------------------------------------
    ADMIN PANEL
-------------------------------------- */
.admin-header {
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.98) !important;
}

.admin-main {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 40%, #415a77 100%);
    color: #f8f9fa;
    min-height: 100vh;
    background-attachment: fixed;
}

/* -------------------------------------
    TABS PERSONALIZADAS
-------------------------------------- */
/*.nav-tabs .nav-link {
  border: none;
  border-bottom: 3px solid transparent;
  color: #6c757d;
  font-weight: 500;
  padding: 1rem 1.5rem;
  transition: all 0.3s ease;
}
.nav-tabs .nav-link:hover {
  border-bottom-color: #dee2e6;
  color: #495057;
  background-color: rgba(0, 0, 0, 0.02);
}
.nav-tabs .nav-link.active {
  border-bottom-color: #0d6efd;
  color: #0d6efd;
  background-color: transparent;
}*/

.nav-tabs .nav-link {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin: 0 2px;
}

.nav-tabs .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.nav-tabs .nav-link.active {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background-color: transparent;
    border-bottom: 1px solid rgba(13, 110, 253, 0.8);
    font-weight: bold;
}



/* -------------------------------------
    CARDS Y TABLAS
-------------------------------------- */
.card {
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.table th {
  border-top: none;
  font-weight: 600;
  background-color: #f8f9fa;
  color: #495057;
}
.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* -------------------------------------
   ️ BADGES Y UTILIDADES
-------------------------------------- */
.badge {
  font-size: 0.75em;
  font-weight: 500;
}
.text-shadow {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.box-shadow {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.hover-lift:hover {
  transform: translateY(-3px);
  transition: transform 0.2s ease-in-out;
}

/* -------------------------------------
    BULK UPLOAD (CARGA MASIVA)
-------------------------------------- */
.bulk-upload-section {
  position: relative;
  padding: 1rem;
}

/* Pasos numerados */
.upload-steps {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
.step {
  display: flex;
  align-items: center;
  flex: 1 1 30%;
  gap: 0.75rem;
  opacity: 0.6;
  transition: all 0.3s ease;
}
.step.active,
.step.completed {
  opacity: 1;
}
.step-number {
  background-color: #6c63ff;
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
.step.active .step-number {
  background-color: #0d6efd;
  transform: scale(1.1);
}
.step.completed .step-number {
  background-color: #198754;
  transform: scale(1.15);
}

/* Info de pasos */
.step-info h6 {
  margin: 0;
  font-weight: 600;
}
.step-info p {
  margin: 0;
  font-size: 0.85rem;
  color: #6c757d;
}

/* Formularios */
.upload-form {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  transition: all 0.25s ease;
}
.upload-form:hover {
  border-color: #0d6efd;
  box-shadow: 0 0 0.5rem rgba(13, 110, 253, 0.2);
}

/* Barra de progreso */
#bulk-progress {
  height: 28px;
  background-color: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  transition: opacity 0.4s ease-in-out;
  position: relative;
}
#bulk-progress-bar {
  height: 100%;
  background-color: #0d6efd;
  color: #fff;
  font-weight: 600;
  line-height: 28px;
  text-align: center;
  font-size: 0.9rem;
  transition: width 0.4s ease-in-out;
}
#bulk-progress.d-none {
  opacity: 0;
}

/* Check animado al 100% */
.bulk-progress-check {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 1.5rem;
  color: #198754;
  opacity: 0;
  transition: all 0.4s ease-in-out;
}
.bulk-progress-check.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Botones */
.bulk-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.bulk-actions button {
  min-width: 180px;
  transition: all 0.2s ease-in-out;
}
.bulk-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Formato CSV/JSON */
.file-format-info {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 0.375rem;
  border-left: 4px solid #007bff;
  margin-top: 1rem;
}
.file-format-info pre {
  background: #2d3748;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  font-size: 0.8rem;
}

/* -------------------------------------
   RESPONSIVE DESIGN
-------------------------------------- */
@media (max-width: 768px) {
  .login-section {
    padding: 2rem 1rem;
  }
  .admin-header .d-flex {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  .upload-steps {
    flex-direction: column;
    gap: 1rem;
  }
  .bulk-actions {
    flex-direction: column;
  }
}

/* -------------------------------------
    SCROLLBAR PERSONALIZADO
-------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/*===============================================================*/

/* =========================================================
    ESTILO CORPORATIVO PARA ETIQUETAS (BADGES)
   ========================================================= */

.badge {
    background: #ffffff;           /* fallback sólido */
  background: transparent !important;
  border: 1px solid #dee2e6;
  color: #212529 !important;
  font-weight: 500;
  font-size: 1.0rem;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  letter-spacing: 0.2px;
  transition: all 0.2s ease-in-out;
}

.badge:hover {
  border-color: #adb5bd;
  background: rgba(0, 0, 0, 0.03);
}

/* Badges de las secciones superiores (tipo, cliente, fabricante) */
.badge-section-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

/*Badges de especificaciones técnicas (SR, I, 1E, etc.)*/ 
.badge-section-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

/* En pantallas pequeñas, mantener legibilidad */
@media (max-width: 576px) {
  .badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
  }
}

/*======================================PREVIEW DE IMAGENES===================================*/
/* =========================================================
   ️ ESTILOS PARA PREVIEW DE IMÁGENES
   ========================================================= */

/* Contenedor de previsualizaciones */
#image-previews-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    min-height: 50px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

/* Cada preview individual */
.image-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: visible !important;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-preview:hover {
    border-color: #6f42c1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* La imagen dentro del preview */
.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Botón de eliminar */
.remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
}

.image-preview:hover .remove-image {
    opacity: 1;
}

.remove-image:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Placeholder cuando no hay imágenes */
#image-previews-container:empty::before {
    content: "No hay imágenes seleccionadas";
    color: #6c757d;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .image-preview {
        width: 60px;
        height: 60px;
    }
    
    #image-previews-container {
        gap: 8px;
        padding: 8px;
    }
}

/* =========================================================
    ESTILOS PARA BARRA DE BÚSQUEDA
   ========================================================= */

#equipment-search {
    border-radius: 0.375rem 0 0 0.375rem;
}

#search-results-count {
    font-size: 0.875rem;
}

/* =========================================================
    FONDO CORPORATIVO NUCLEONOVA
   ======================================================== */
body.bg-light {
  background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 40%, #415a77 100%);
  color: #f8f9fa;
  min-height: 100vh;
  background-attachment: fixed;
}

/* Aseguramos contraste en el contenido */
.card {
  background: rgba(255, 255, 255, 0.95);
  color: #212529;
}

.navbar.bg-white {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(8px);
}

/* =========================================================
    BOTÓN DE IDIOMA CON BANDERAS
   ========================================================= */
.lang-flag {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    margin-right: 6px;
}

/* Bandera España */
.flag-es {
    background-size: cover;
    background-position: center;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="640" height="480"><path fill="%23AA151B" d="M0 0h640v480H0z"/><path fill="%23F1BF00" d="M0 120h640v240H0z"/></svg>');
}

/* Bandera Reino Unido */
.flag-en {
    background-size: cover;
    background-position: center;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 30"><clipPath id="a"><path d="M0 0h60v30H0z"/></clipPath><clipPath id="b"><path d="M30 15h30v15z"/></clipPath><g clip-path="url(%23a)"><path fill="%23012f6b" d="M0 0h60v30H0z"/><path stroke="%23fff" stroke-width="6" d="M0 0l60 30M60 0L0 30"/><path stroke="%23c8102e" stroke-width="4" d="M0 0l60 30M60 0L0 30"/><path stroke="%23fff" stroke-width="10" d="M30 0v30M0 15h60"/><path stroke="%23c8102e" stroke-width="6" d="M30 0v30M0 15h60"/></g></svg>');
}

/* =========================================================
   ESTILOS PARA INPUTS DE ARCHIVO PERSONALIZADOS
   ========================================================= */
.file-input-wrapper {
    position: relative;
}

.file-input-label {
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-label:hover {
    background-color: #0d6efd;
    color: white;
    transform: translateY(-1px);
}

.file-name-display {
    min-height: 20px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.file-name-display.has-file {
    color: #198754;
    font-weight: 500;
    background-color: #d1e7dd;
}

/* =========================================================
   ESTILOS MEJORADOS PARA MODALES
   ========================================================= */

/* Mejorar contraste en modales */
.modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa !important;
}

/* Mejorar legibilidad de labels */
.modal-body .form-label {
    color: #212529 !important;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Mejorar inputs en modales */
.modal-body .form-control,
.modal-body .form-select {
    border: 1px solid #ced4da;
    background-color: #fff;
    color: #212529;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Estilos específicos para el modal de edición */
#existing-images-container .image-preview {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 4px;
    background: white;
}

#existing-images-container .image-preview img {
    border-radius: 4px;
}

/* Botón cerrar blanco para headers oscuros */
.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Mejorar contenedores de imágenes */
.bg-light {
    background-color: #f8f9fa !important;
}

.bg-white {
    background-color: #ffffff !important;
}

/* =========================================================
   ESTILOS PARA ELIMINACIÓN DE IMÁGENES EN MODAL DE EDICIÓN
   ========================================================= */

/* Contenedor de imágenes existentes */
#existing-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 120px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

/* Preview de imágenes existentes */
#existing-images-container .image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: visible; /* Cambiado de hidden a visible para que los iconos no se recorten */
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#existing-images-container .image-preview:hover {
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Imagen dentro del preview (esta sí debe mantener overflow hidden) */
#existing-images-container .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* Imagen marcada para eliminación */
#existing-images-container .image-preview.marked-for-deletion {
    opacity: 0.6;
    border-color: #dc3545;
    border-style: dashed;
    background: linear-gradient(45deg, transparent 49%, rgba(220, 53, 69, 0.1) 49%, rgba(220, 53, 69, 0.1) 51%, transparent 51%);
}

#existing-images-container .image-preview.marked-for-deletion:hover {
    border-color: #dc3545;
    opacity: 0.8;
}

/* Botón de eliminar/restaurar - POSICIÓN CORREGIDA */
.image-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.image-preview:hover .image-delete-btn {
    opacity: 1;
}

/* Estado normal del botón (eliminar) */
.image-delete-btn.delete {
    background: rgba(220, 53, 69, 0.95);
    color: white;
}

.image-delete-btn.delete:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Estado cuando está marcado para eliminar (restaurar) */
.image-delete-btn.restore {
    background: rgba(25, 135, 84, 0.95);
    color: white;
    opacity: 1 !important;
}

.image-delete-btn.restore:hover {
    background: #198754;
    transform: scale(1.1);
}

/* Badge de imagen existente - POSICIÓN CORREGIDA */
.image-preview .bg-success {
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 0.6rem;
    padding: 3px 6px;
    z-index: 5;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Asegurar que los iconos dentro de los botones se vean completos */
.image-delete-btn i {
    font-size: 0.8rem;
    line-height: 1;
}

.bg-success i {
    font-size: 0.7rem;
    line-height: 1;
}

/* Tooltip personalizado para imágenes marcadas */
.image-preview.marked-for-deletion::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 20;
}

.image-preview.marked-for-deletion:hover::after {
    opacity: 1;
}

/* Contador de imágenes a eliminar */
.images-deletion-counter {
    background: #dc3545;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mensaje cuando no hay imágenes */
#existing-images-container:empty::before {
    content: attr(data-empty-message);
    color: #6c757d;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 30px;
    display: block;
}

/* Responsive para imágenes existentes */
@media (max-width: 768px) {
    #existing-images-container .image-preview {
        width: 80px;
        height: 80px;
    }
    
    #existing-images-container {
        gap: 8px;
        padding: 10px;
    }
    
    .image-delete-btn {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
        top: -6px;
        right: -6px;
    }
    
    .image-preview .bg-success {
        top: -6px;
        left: -6px;
        font-size: 0.5rem;
        padding: 2px 4px;
    }
}

/* Estilos para el modal de confirmación de eliminación */
.delete-confirmation-modal .modal-content {
    border: 2px solid #dc3545;
}

.delete-confirmation-modal .modal-header {
    background: #dc3545;
    color: white;
}

/* Mejora visual para el contenedor de nuevas imágenes */
#edit-image-previews-container {
    border: 1px dashed #28a745;
    background: rgba(40, 167, 69, 0.05);
}

/* =========================================================
   ESTILOS PARA ELIMINACIÓN DE IMÁGENES EN MODAL DE EDICIÓN
   ========================================================= */

/* Contenedor de imágenes existentes */
#existing-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 120px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

/* Preview de imágenes existentes */
#existing-images-container .image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: visible; /* Para que los iconos no se recorten */
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#existing-images-container .image-preview:hover {
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Imagen dentro del preview */
#existing-images-container .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* Imagen marcada para eliminación - SIN BORDE PUNTEADO VERDE */
#existing-images-container .image-preview.marked-for-deletion {
    opacity: 0.6;
    border-color: #dc3545;
    /* Quitamos el background con patrón de tachado */
    background: white;
}

#existing-images-container .image-preview.marked-for-deletion:hover {
    border-color: #dc3545;
    opacity: 0.8;
}

/* Botón de eliminar/restaurar */
.image-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.image-preview:hover .image-delete-btn {
    opacity: 1;
}

/* Estado normal del botón (eliminar) */
.image-delete-btn.delete {
    background: rgba(220, 53, 69, 0.95);
    color: white;
}

.image-delete-btn.delete:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Estado cuando está marcado para eliminar (restaurar) */
.image-delete-btn.restore {
    background: rgba(25, 135, 84, 0.95);
    color: white;
    opacity: 1 !important;
}

.image-delete-btn.restore:hover {
    background: #198754;
    transform: scale(1.1);
}

/* Badge de imagen existente */
.image-preview .bg-success {
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 0.6rem;
    padding: 3px 6px;
    z-index: 5;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Asegurar que los iconos dentro de los botones se vean completos */
.image-delete-btn i {
    font-size: 0.8rem;
    line-height: 1;
}

.bg-success i {
    font-size: 0.7rem;
    line-height: 1;
}

/* Contador de imágenes a eliminar */
.images-deletion-counter {
    background: #dc3545;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mensaje cuando no hay imágenes */
#existing-images-container:empty::before {
    content: attr(data-empty-message);
    color: #6c757d;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 30px;
    display: block;
}

/* Responsive para imágenes existentes */
@media (max-width: 768px) {
    #existing-images-container .image-preview {
        width: 80px;
        height: 80px;
    }
    
    #existing-images-container {
        gap: 8px;
        padding: 10px;
    }
    
    .image-delete-btn {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
        top: -6px;
        right: -6px;
    }
    
    .image-preview .bg-success {
        top: -6px;
        left: -6px;
        font-size: 0.5rem;
        padding: 2px 4px;
    }
}

/* =========================================================
   ESTILOS PARA ELIMINACIÓN DE IMÁGENES EN MODAL DE EDICIÓN
   ========================================================= */

/* Contenedor de imágenes existentes - SIN BORDE PUNTEADO */
#existing-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 120px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6; /* Cambiado de dashed a solid */
}

/* Preview de imágenes existentes */
#existing-images-container .image-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: visible; /* Para que los iconos no se recorten */
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#existing-images-container .image-preview:hover {
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Imagen dentro del preview */
#existing-images-container .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* Imagen marcada para eliminación */
#existing-images-container .image-preview.marked-for-deletion {
    opacity: 0.6;
    border-color: #dc3545;
    background: white;
}

#existing-images-container .image-preview.marked-for-deletion:hover {
    border-color: #dc3545;
    opacity: 0.8;
}

/* Botón de eliminar/restaurar */
.image-delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.image-preview:hover .image-delete-btn {
    opacity: 1;
}

/* Estado normal del botón (eliminar) */
.image-delete-btn.delete {
    background: rgba(220, 53, 69, 0.95);
    color: white;
}

.image-delete-btn.delete:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Estado cuando está marcado para eliminar (restaurar) */
.image-delete-btn.restore {
    background: rgba(25, 135, 84, 0.95);
    color: white;
    opacity: 1 !important;
}

.image-delete-btn.restore:hover {
    background: #198754;
    transform: scale(1.1);
}

/* Badge de imagen existente */
.image-preview .bg-success {
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 0.6rem;
    padding: 3px 6px;
    z-index: 5;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Asegurar que los iconos dentro de los botones se vean completos */
.image-delete-btn i {
    font-size: 0.8rem;
    line-height: 1;
}

.bg-success i {
    font-size: 0.7rem;
    line-height: 1;
}

/* Contador de imágenes a eliminar */
.images-deletion-counter {
    background: #dc3545;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mensaje cuando no hay imágenes */
#existing-images-container:empty::before {
    content: attr(data-empty-message);
    color: #6c757d;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 30px;
    display: block;
}

/* Responsive para imágenes existentes */
@media (max-width: 768px) {
    #existing-images-container .image-preview {
        width: 80px;
        height: 80px;
    }
    
    #existing-images-container {
        gap: 8px;
        padding: 10px;
    }
    
    .image-delete-btn {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
        top: -6px;
        right: -6px;
    }
    
    .image-preview .bg-success {
        top: -6px;
        left: -6px;
        font-size: 0.5rem;
        padding: 2px 4px;
    }
}

/* =========================================================
   ESTILOS PARA NUEVAS IMÁGENES
   ========================================================= */

/* Contenedor de nuevas imágenes */
#edit-image-previews-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6; /* Cambiado de dashed a solid */
}

/* Preview de nuevas imágenes - OVERFLOW VISIBLE PARA ICONOS */
#edit-image-previews-container .image-preview {
    position: relative;
    width: 100px;
    height: 80px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: visible; /* hidden a visible para que los iconos no se recorten */
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#edit-image-previews-container .image-preview:hover {
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Imagen dentro del preview - MANTENER OVERFLOW HIDDEN SOLO PARA LA IMAGEN */
#edit-image-previews-container .image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 6px;
    overflow: hidden; /* La imagen sí mantiene hidden */
}

/* Botón de eliminar en nuevas imágenes */
#edit-image-previews-container .btn-danger {
    position: absolute;
    top: -8px; /* Posicionado fuera del contenedor */
    right: -8px; /* Posicionado fuera del contenedor */
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#edit-image-previews-container .image-preview:hover .btn-danger {
    opacity: 1;
}

#edit-image-previews-container .btn-danger:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* Asegurar que los iconos en botones de nuevas imágenes se vean bien */
#edit-image-previews-container .btn-danger i {
    font-size: 0.8rem;
    line-height: 1;
}

/* Mensaje cuando no hay nuevas imágenes */
#edit-image-previews-container:empty::before {
    content: "No hay nuevas imágenes seleccionadas";
    color: #6c757d;
    font-style: italic;
    width: 100%;
    text-align: center;
    padding: 20px;
    display: block;
}

/* Responsive para nuevas imágenes */
@media (max-width: 768px) {
    #edit-image-previews-container .image-preview {
        width: 80px;
        height: 70px;
    }
    
    #edit-image-previews-container {
        gap: 8px;
        padding: 8px;
    }
    
    #edit-image-previews-container .btn-danger {
        width: 22px;
        height: 22px;
        top: -6px; /* Ajustado para responsive */
        right: -6px; /* Ajustado para responsive */
    }
}

/* =========================================================
   ESTILOS PARA LA SECCIÓN COMPLETA DE NUEVAS IMÁGENES
   ========================================================= */

/* El contenedor principal de "Agregar Nuevas Imágenes" */
.modal-body .border.rounded {
    border: 1px solid #dee2e6 !important; /* Borde sólido normal */
    background: #f8f9fa !important;
}

/* Efecto hover en toda la sección */
.modal-body .border.rounded:hover {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1) !important;
}

/* ============================================
   PRIORIDAD SOLO PARA EL MODAL DE RECORTE
   ============================================ */
/* Si el modal de edición sigue abierto debajo,
   no lo subimos, para evitar conflicto. */
#edit-item-modal {
  z-index: 1055 !important; 
}

/* ============================================
   MODAL DE RECORTE - DISEÑO MEJORADO COMPLETO
   ============================================ */

#image-cropper-modal {
  z-index: 1085 !important;
}

/* 🔹 MODAL MÁS PEQUEÑO Y MEJOR CENTRADO */
#image-cropper-modal .modal-dialog {
  max-width: 90vw !important;      /* 🔹 Reducido de 95vw */
  max-height: 85vh !important;     /* 🔹 Reducido de 95vh */
  width: auto !important;
  height: auto !important;
  margin: auto !important;         /* 🔹 Centrado perfecto */
  display: flex;
  align-items: center;
  justify-content: center;
}

#image-cropper-modal .modal-content {
  width: 100%;
  max-width: 1200px;               /* 🔹 Ancho máximo fijo */
  max-height: 85vh;                /* 🔹 Altura máxima reducida */
  border-radius: 0.75rem;
  border: none;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header compacto */
#image-cropper-modal .card-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(13, 110, 253, 0.15) !important;
  padding: 0.75rem 1.25rem !important;  /* 🔹 Un poco más de padding lateral */
  flex-shrink: 0;
}

#image-cropper-modal .card-title {
  color: #0d6efd !important;
  font-weight: 600;
  font-size: 1.1rem !important;    /* 🔹 Un poco más grande */
  margin: 0;
}

/* Botón cerrar más pequeño */
#image-cropper-modal .btn-close-sm {
  padding: 0.25rem;
  background-size: 0.75rem;
  opacity: 0.7;
}

#image-cropper-modal .btn-close-sm:hover {
  opacity: 1;
}

/* Cuerpo del modal - ÁREA OPTIMIZADA */
#image-cropper-modal .modal-body {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 🔹 CONTENEDOR DEL CROPPER - ALTURA MÍNIMA PARA MEJOR VISUALIZACIÓN */
#image-cropper-modal .cropper-wrapper {
  flex: 1;
  min-height: 400px;               /* 🔹 Altura mínima garantizada */
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #1a202c;
  position: relative;
  width: 100%;
}

/* 🔹 IMPORTANTE: Forzar viewMode 2 (iPhone-like) */
#image-cropper-modal .cropper-container {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  background: #1a202c !important;
  overflow: hidden !important;
}

/* Cuando viewMode=2, el canvas se ajusta automáticamente */
.cropper-canvas {
  background: transparent !important;
}

/* La imagen debe adaptarse */
#image-cropper-modal #cropper-image {
  display: block;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto;
  height: auto;
}

/* ============================================
   ESTILOS DE CROPPER.js - MEJORADOS (viewMode 2)
   ============================================ */

/* 🔹 ÁREA DE RECORTE CON viewMode=2 (NO SALE DEL CONTENEDOR) */
.cropper-view-box {
  outline: 2px solid #0d6efd !important;
  outline-color: rgba(13, 110, 253, 0.85) !important;
  box-shadow: 0 0 0 9999px rgba(26, 32, 44, 0.9) !important;
}

/* 🔹 PUNTOS DE LAS ESQUINAS - VISIBLES PERO DISCRETOS */
.cropper-point {
  background-color: #0d6efd !important;
  border: 2px solid white !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  opacity: 0.9 !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 2px !important;
  transition: all 0.2s ease;
  z-index: 11 !important;
}

.cropper-point:hover {
  transform: scale(1.2);
  background-color: #0b5ed7 !important;
}

/* Puntos de las esquinas específicos */
.cropper-point.point-se {
  cursor: nwse-resize;
  bottom: -8px;
  right: -8px;
}

.cropper-point.point-sw {
  cursor: nesw-resize;
  bottom: -8px;
  left: -8px;
}

.cropper-point.point-ne {
  cursor: nesw-resize;
  top: -8px;
  right: -8px;
}

.cropper-point.point-nw {
  cursor: nwse-resize;
  top: -8px;
  left: -8px;
}

/* Puntos laterales - MÁS DISCRETOS */
.cropper-point.point-n,
.cropper-point.point-s {
  width: 14px !important;
  height: 8px !important;
  border-radius: 4px !important;
}

.cropper-point.point-e,
.cropper-point.point-w {
  width: 8px !important;
  height: 14px !important;
  border-radius: 4px !important;
}

/* Líneas del recorte - TRANSPARENTES */
.cropper-line {
  background-color: rgba(13, 110, 253, 0.25) !important;
}

/* Líneas de guía */
.cropper-dashed {
  border-color: rgba(255, 255, 255, 0.2) !important;
  border-style: dashed !important;
}

/* ============================================
   CONTROLES DE PROPORCIÓN
   ============================================ */

.ratio-controls {
  background: #f8f9fa;
  border-top: 1px solid #dee2e6;
  flex-shrink: 0;
  padding: 0.75rem 1.25rem !important;  /* 🔹 Más padding lateral */
}

.ratio-controls .btn-sm {
  padding: 0.375rem 0.75rem !important;  /* 🔹 Un poco más de padding */
  font-size: 0.85rem;
  min-height: 34px;                     /* 🔹 Altura mínima */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Botones de proporción activos */
.ratio-controls .ratio-btn.active {
  background-color: #0d6efd !important;
  color: white !important;
  border-color: #0d6efd !important;
  font-weight: 500;
}

.ratio-controls .ratio-btn.active:hover {
  background-color: #0b5ed7 !important;
  border-color: #0b5ed7 !important;
}

/* Separador vertical */
.ratio-controls .vr {
  width: 1px;
  height: 24px;
  background-color: #dee2e6;
  margin: 0 0.5rem;
  align-self: center;
}

/* ============================================
   BOTONES GENERALES - MEJOR ESPACIADO
   ============================================ */

#image-cropper-modal .btn {
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;                      /* 🔹 Más espacio entre icono y texto */
}

#image-cropper-modal .btn-sm {
  padding: 0.5rem 0.875rem;           /* 🔹 Más padding */
  font-size: 0.875rem;
}

#image-cropper-modal .btn-outline-secondary {
  border-color: #6c757d;
  color: #6c757d;
}

#image-cropper-modal .btn-outline-secondary:hover {
  background-color: #6c757d;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#image-cropper-modal .btn-outline-primary {
  border-color: #0d6efd;
  color: #0d6efd;
}

#image-cropper-modal .btn-outline-primary:hover {
  background-color: #0d6efd;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

#image-cropper-modal .btn-outline-warning {
  border-color: #ffc107;
  color: #ffc107;
}

#image-cropper-modal .btn-outline-warning:hover {
  background-color: #ffc107;
  color: #212529;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(255, 193, 7, 0.2);
}

#image-cropper-modal .btn-outline-success {
  border-color: #198754;
  color: #198754;
}

#image-cropper-modal .btn-outline-success:hover {
  background-color: #198754;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(25, 135, 84, 0.2);
}

/* ============================================
   FOOTER - MEJOR POSICIONADO Y CON MÁRGENES
   ============================================ */

#image-cropper-modal .card-footer {
  background: transparent !important;
  border-top: 1px solid rgba(13, 110, 253, 0.15) !important;
  padding: 1.25rem 1.5rem !important;    /* 🔹 Más padding */
  flex-shrink: 0;
}

/* Botones principales con buen espaciado */
#image-cropper-modal .card-footer .btn {
  min-width: 150px;                     /* 🔹 Un poco más ancho */
  padding: 0.75rem 1.75rem;            /* 🔹 Más padding */
  font-size: 1rem;
}

/* 🔹 CONTENEDOR DE BOTONES CENTRADO CON MÁRGENES */
#image-cropper-modal .card-footer .d-flex.justify-content-center {
  padding: 0 1.5rem;                   /* 🔹 Más margen interno */
}

/* Texto informativo */
#image-cropper-modal .text-muted {
  color: #6c757d !important;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;             /* 🔹 Centrado */
  text-align: center;
  margin-bottom: 0.5rem;               /* 🔹 Separación de botones */
}

/* ============================================
   RESPONSIVE PARA PANTALLAS PEQUEÑAS
   ============================================ */

@media (max-width: 1200px) {
  #image-cropper-modal .modal-dialog {
    max-width: 95vw !important;
  }
}

@media (max-width: 992px) {
  #image-cropper-modal .modal-dialog {
    max-width: 98vw !important;
    max-height: 90vh !important;
  }
  
  #image-cropper-modal .modal-content {
    max-height: 90vh;
  }
  
  /* Altura mínima reducida en tablets */
  #image-cropper-modal .cropper-wrapper {
    min-height: 350px;
  }
}

@media (max-width: 768px) {
  #image-cropper-modal .modal-dialog {
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0.5rem !important;        /* 🔹 Pequeño margen en móviles */
  }
  
  #image-cropper-modal .modal-content {
    max-height: 100vh;
    border-radius: 0.5rem;             /* 🔹 Bordes más suaves en móvil */
  }
  
  /* Header más compacto */
  #image-cropper-modal .card-header {
    padding: 0.5rem 1rem !important;
  }
  
  /* Altura mínima reducida en móviles */
  #image-cropper-modal .cropper-wrapper {
    min-height: 300px;
  }
  
  /* 🔹 OCULTAR TEXTO EN BOTONES PEQUEÑOS, SOLO MOSTRAR ICONOS */
  .ratio-controls span.d-none,
  #image-cropper-modal .card-footer span.d-none {
    display: none !important;
  }
  
  .ratio-controls .vr {
    display: none !important;
  }
  
  /* Botones de herramientas en columna */
  #image-cropper-modal .card-footer .d-flex.flex-wrap {
    justify-content: center !important;
    gap: 0.5rem !important;
  }
  
  /* Botones principales apilados en móvil */
  #image-cropper-modal .card-footer .d-flex.justify-content-center {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 !important;
  }
  
  #image-cropper-modal .card-footer .btn {
    width: 100%;
    max-width: 280px;                  /* 🔹 Un poco más ancho en móvil */
    margin: 0 auto;
  }
  
  /* Puntos más pequeños en móviles */
  .cropper-point {
    width: 14px !important;
    height: 14px !important;
  }
  
  .cropper-point.point-n,
  .cropper-point.point-s {
    width: 12px !important;
    height: 6px !important;
  }
  
  .cropper-point.point-e,
  .cropper-point.point-w {
    width: 6px !important;
    height: 12px !important;
  }
}

@media (max-width: 480px) {
  /* Controles de proporción en grid */
  .ratio-controls .d-flex {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;                      /* 🔹 Más espacio entre botones */
  }
  
  .ratio-controls .btn-sm {
    width: 100%;
    padding: 0.375rem 0.5rem !important;
    font-size: 0.8rem;
  }
  
  /* Texto informativo en varias líneas */
  #image-cropper-modal .text-muted {
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
    font-size: 0.8rem;
  }
  
  /* Altura mínima muy reducida en móviles pequeños */
  #image-cropper-modal .cropper-wrapper {
    min-height: 250px;
  }
}

/* ============================================
   ANIMACIÓN SUAVE PARA MEJOR EXPERIENCIA
   ============================================ */

#image-cropper-modal .modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   MEJORAS ESPECÍFICAS PARA viewMode 2
   ============================================ */

/* viewMode 2 ya restringe el recuadro, así que podemos relajar algunos estilos */
.cropper-view-box {
  cursor: move !important; /* Mejor feedback visual */
}

/* Cuando viewMode=2 está activo, el recuadro NO PUEDE salir del contenedor */
.cropper-container.cropper-bg {
  overflow: hidden !important;
}

/* Mejorar el feedback al arrastrar */
.cropper-drag-box {
  cursor: move !important;
}

/* Arreglar el problema de accesibilidad del modal */
#image-cropper-modal.show {
  display: block !important;
  padding-right: 0px !important; /* Eliminar scrollbar fantasma */
}

#image-cropper-modal.show .modal-dialog {
  transform: none !important; /* Eliminar transformaciones problemáticas */
}

/* Asegurar que el modal no tenga problemas de enfoque */
#image-cropper-modal .modal-content:focus {
  outline: none;
}

/* Botón cerrar sin problemas de focus */
#image-cropper-modal .btn-close:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* ===== VISOR DE IMÁGENES (LIGHTBOX TIPO AMAZON) ===== */

.image-viewer-overlay {
  position: fixed;
  inset: 0;
  /* GRIS SUAVE, parecido al backdrop de Bootstrap */
  background: rgba(15, 23, 42, 0.55);  /* antes: rgba(0,0,0,0.85) */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1055;
}

/* Clase que activa la visibilidad (coincide con JS: is-visible) */
.image-viewer-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.iv-no-scroll {
  overflow: hidden;
}

/* Contenedor general del visor: estilo card clara */
.image-viewer-inner {
  max-width: 95vw;
  max-height: 90vh;
  background: #f8f9fa;               /* card clara como el resto del sitio */
  border-radius: 1rem;
  padding: 1rem 1.5rem 1rem;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: #212529;                     /* texto oscuro */
  position: relative;
}

/* Layout tipo Amazon: imagen grande + columna de miniaturas */
.iv-layout {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

/* Imagen principal */
.image-viewer-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#iv-main-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  transition: transform 0.2s ease;
}

/* Miniaturas (columna derecha) */
.image-viewer-thumbs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 80vh;
  overflow-y: auto;
}

.iv-thumb {
  border: 2px solid transparent;
  padding: 0;
  background: transparent;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.iv-thumb img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 0.75rem;
}

.iv-thumb:hover {
  transform: translateY(-1px);
  border-color: rgba(13, 110, 253, 0.4);  /* azul suave */
  background-color: rgba(15, 23, 42, 0.04);
}

.iv-thumb.is-active {
  border-color: #0d6efd;               /* azul Bootstrap */
}

/* Barra inferior */
.image-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: #6c757d;
}

/* Botones generales: estilo iOS redondo */
.iv-btn {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.95);
  color: #111827;
  font-size: 1.4rem;
  padding: 0;
  width: 42px;
  height: 42px;
  border-radius: 999px;                      /* 🔵 círculo */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
  transition:
    background 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.iv-btn:hover {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35);
}

/* Botón de cerrar (✕) en la esquina */
.iv-btn.iv-close {
  position: absolute;
  top: 0.85rem;
  right: 1.4rem;
  font-size: 1.3rem;
}

/* Flechas laterales */
.iv-btn.iv-prev,
.iv-btn.iv-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.iv-btn.iv-prev {
  left: 0.9rem;
}

.iv-btn.iv-next {
  right: 0.9rem;
}

/* Por si en el futuro vuelves a usar iconos especiales */
.iv-btn.iv-icon {
  font-size: 1.3rem;
}



/* Responsive: en pantallas pequeñas, miniaturas debajo de la imagen */
@media (max-width: 768px) {
  .iv-layout {
    flex-direction: column;
  }

  .image-viewer-thumbs {
    flex-direction: row;
    max-width: 100%;
    max-height: 90px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .iv-thumb img {
    width: 64px;
    height: 64px;
  }
}

/*==================================================*/
/* ===== ZOOM TIPO AMAZON ===== */

/* Contenedor del main image (para posicionar lens) */
#iv-main-wrapper {
  position: relative;
}

/* Cuadrado que sigue el mouse (lens) */
#iv-zoom-lens {
  position: absolute;
  border: 2px solid rgba(13, 110, 253, 0.8);
  /* 🔹 AHORA ES PORCENTAJE, no fijo en píxeles */
  width: 18%;
  aspect-ratio: 1 / 1;          /* siempre cuadrado */
  min-width: 80px;              /* no se hace ridículamente pequeño */
  max-width: 160px;             /* ni gigantesco */
  opacity: 0;
  pointer-events: none;
  background-color: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(2px);
  transition: opacity 0.1s ease;
  z-index: 10;
}

/* Panel del zoom a la derecha */
#iv-zoom-result {
  position: absolute;
  right: -420px;
  top: 0;
  width: 400px;
  height: 400px;
  border: 2px solid #dee2e6;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}

/* En pantallas estrechas, puedes (opcional) mover el zoom abajo */
@media (max-width: 1200px) {
  #iv-zoom-result {
    position: static;
    margin-top: 0.75rem;
    width: 100%;
    max-width: 420px;
    height: 320px;
  }
}