/**
 * VISUALIZADOR PROFESIONAL ULTRA v3.0 - ESTILOS COMPLETOS
 * CSS para el popup del visualizador con funciones IA
 * 
 * @version 3.0
 * @date 2026-01-15
 */

/* ============================================================================
   RESET Y BASE
   ============================================================================ */

.visualizador-popup * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================================================
   POPUP CONTENEDOR PRINCIPAL
   ============================================================================ */

.visualizador-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.visualizador-popup.activo {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

/* ============================================================================
   OVERLAY OSCURO
   ============================================================================ */

.vis-pro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

/* ============================================================================
   CONTENIDO PRINCIPAL
   ============================================================================ */

.vis-pro-contenido {
    position: relative;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: popupEntrar 0.3s ease;
}

@keyframes popupEntrar {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================================================
   HEADER
   ============================================================================ */

.vis-pro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #90439e, #764ba2);
    color: white;
}

.vis-pro-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vis-pro-cerrar {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vis-pro-cerrar:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ============================================================================
   BODY - LAYOUT DOS COLUMNAS
   ============================================================================ */

.vis-pro-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Columna izquierda - Canvas */
.vis-pro-col-canvas {
    flex: 2;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #1a1a2e;
    position: relative;
}

/* Columna derecha - Controles */
.vis-pro-col-controles {
    flex: 1;
    max-width: 380px;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
    border-left: 1px solid #e0e0e0;
}

/* ============================================================================
   CANVAS CONTAINER
   ============================================================================ */

.vis-pro-canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0d0d1a;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    min-height: 400px;
}

.vis-pro-canvas-container.drag-over {
    border: 3px dashed #90439e;
    background: rgba(144, 67, 158, 0.1);
}

#vis-pro-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* Mensaje inicial */
.vis-pro-mensaje-inicial {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 40px;
}

.vis-pro-mensaje-icono {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.vis-pro-mensaje-texto strong {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 8px;
}

.vis-pro-mensaje-texto p {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Controles de zoom */
.vis-pro-zoom-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-top: 15px;
}

.vis-pro-zoom-controls button {
    width: 35px;
    height: 35px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.vis-pro-zoom-controls button:hover {
    background: rgba(144, 67, 158, 0.5);
}

.vis-pro-zoom-controls span {
    color: white;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
}

/* ============================================================================
   SECCIONES DE CONTROLES
   ============================================================================ */

.vis-pro-seccion {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.vis-pro-seccion:last-child {
    border-bottom: none;
}

.vis-pro-seccion h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================================
   ZONA DE UPLOAD
   ============================================================================ */

.vis-pro-upload-zone {
    position: relative;
}

.vis-pro-btn-upload,
.vis-pro-btn-upload-small {
    width: 100%;
    padding: 15px;
    border: 2px dashed #ddd;
    background: #fafafa;
    color: #666;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vis-pro-btn-upload:hover,
.vis-pro-btn-upload-small:hover {
    border-color: #90439e;
    background: rgba(144, 67, 158, 0.05);
    color: #90439e;
}

.vis-pro-btn-upload-small {
    padding: 10px;
    font-size: 13px;
}

/* Preview de imagen */
.vis-pro-preview {
    display: none;
    position: relative;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.vis-pro-preview.show {
    display: block;
}

.vis-pro-preview img {
    width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: cover;
    border-radius: 8px;
}

.vis-pro-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 25px;
    height: 25px;
    border: none;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    font-size: 14px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   GALERÍA DE RÓTULOS
   ============================================================================ */

.vis-pro-galeria {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.vis-pro-galeria-item {
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.vis-pro-galeria-item:hover {
    border-color: #90439e;
    transform: scale(1.05);
}

.vis-pro-galeria-item.active {
    border-color: #90439e;
    box-shadow: 0 0 0 3px rgba(144, 67, 158, 0.3);
}

.vis-pro-galeria-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vis-pro-galeria-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

.vis-pro-galeria-placeholder span {
    font-size: 24px;
}

.vis-pro-galeria-placeholder small {
    font-size: 10px;
}

/* ============================================================================
   CONTROLES DE AJUSTE (SLIDERS)
   ============================================================================ */

.vis-pro-control {
    margin-bottom: 15px;
}

.vis-pro-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
}

.vis-pro-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.vis-pro-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #90439e, #764ba2);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(144, 67, 158, 0.4);
}

.vis-pro-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #90439e, #764ba2);
    cursor: pointer;
    border: none;
}

.vis-pro-control-value {
    font-weight: 600;
    color: #90439e;
    font-size: 12px;
}

/* ============================================================================
   TEXTURAS
   ============================================================================ */

.vis-pro-texturas {
    display: flex;
    gap: 8px;
}

.vis-pro-textura {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #666;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.vis-pro-textura:hover {
    border-color: #90439e;
    color: #90439e;
}

.vis-pro-textura.active {
    border-color: #90439e;
    background: linear-gradient(135deg, #90439e, #764ba2);
    color: white;
}

/* ============================================================================
   EFECTOS (CHECKBOXES)
   ============================================================================ */

.vis-pro-efectos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vis-pro-efecto {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.vis-pro-efecto:hover {
    background: #e8e0ea;
}

.vis-pro-efecto input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #90439e;
}

/* ============================================================================
   BOTONES
   ============================================================================ */

.vis-pro-btn-reset {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.vis-pro-btn-reset:hover {
    border-color: #90439e;
    color: #90439e;
}

/* Botones IA */
.vis-pro-btn-ia {
    padding: 10px 15px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vis-pro-btn-ia:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.vis-pro-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.vis-pro-btn-secundario {
    padding: 12px 20px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vis-pro-btn-secundario:hover {
    border-color: #90439e;
    color: #90439e;
}

.vis-pro-btn-secundario:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.vis-pro-btn-primario {
    padding: 12px 25px;
    border: none;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vis-pro-btn-primario:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.vis-pro-btn-cta {
    padding: 12px 30px;
    border: none;
    background: linear-gradient(135deg, #90439e, #e91e63);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vis-pro-btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(144, 67, 158, 0.4);
}

/* ============================================================================
   VARIACIONES DE COLOR
   ============================================================================ */

.vis-pro-variaciones-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.vis-pro-variacion-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.vis-pro-variacion-color:hover {
    transform: scale(1.1);
}

.vis-pro-variacion-color.active {
    border-color: #90439e;
    box-shadow: 0 0 0 3px rgba(144, 67, 158, 0.3);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1024px) {
    .vis-pro-body {
        flex-direction: column;
    }
    
    .vis-pro-col-canvas {
        flex: none;
        height: 50vh;
        min-height: 300px;
    }
    
    .vis-pro-col-controles {
        max-width: 100%;
        max-height: 40vh;
    }
}

@media (max-width: 768px) {
    .vis-pro-contenido {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .vis-pro-header {
        padding: 15px 20px;
    }
    
    .vis-pro-header h2 {
        font-size: 1.1rem;
    }
    
    .vis-pro-col-canvas,
    .vis-pro-col-controles {
        padding: 15px;
    }
    
    .vis-pro-footer {
        flex-wrap: wrap;
        padding: 15px;
        gap: 8px;
    }
    
    .vis-pro-footer button {
        flex: 1;
        min-width: 45%;
        justify-content: center;
    }
    
    .vis-pro-galeria {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .vis-pro-galeria {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .vis-pro-texturas {
        flex-direction: column;
    }
    
    .vis-pro-footer button {
        min-width: 100%;
    }
}

/* ============================================================================
   LOADING OVERLAY IA
   ============================================================================ */

.ia-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999999;
}

.ia-loading-box {
    background: white;
    padding: 30px 50px;
    border-radius: 12px;
    text-align: center;
}

.ia-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #90439e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.ia-loading-text {
    color: #333;
    font-size: 16px;
}

/* ============================================================================
   NOTIFICACIÓN IA
   ============================================================================ */

.ia-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    z-index: 9999999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.ia-notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* ============================================================================
   PANEL HERRAMIENTAS IA
   ============================================================================ */

#vis-pro-ia-panel h3 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.vis-pro-ia-botones button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ============================================================================
   MODAL INFO IA
   ============================================================================ */

.ia-modal-info {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999999;
}

.ia-modal-contenido {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.ia-modal-cerrar {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f0f0f0;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
}

.ia-modal-icono {
    font-size: 50px;
    text-align: center;
    margin-bottom: 15px;
}

.ia-modal-contenido h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.ia-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ia-info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.ia-info-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.ia-info-valor {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.ia-btn-primario {
    width: 100%;
    padding: 15px;
    border: none;
    background: linear-gradient(135deg, #90439e, #764ba2);
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 15px;
}

.ia-btn-secundario {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 10px;
}

/* Color muestra */
.ia-color-muestra {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin: 0 auto;
    border: 1px solid #ddd;
}

/* Score legibilidad */
.ia-legibilidad-score {
    text-align: center;
    margin-bottom: 20px;
}

.ia-score-numero {
    font-size: 48px;
    font-weight: 700;
}

.ia-legibilidad-score.excelente .ia-score-numero { color: #28a745; }
.ia-legibilidad-score.bueno .ia-score-numero { color: #ffc107; }
.ia-legibilidad-score.malo .ia-score-numero { color: #dc3545; }

.ia-score-barra {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.ia-score-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #ffc107);
    border-radius: 4px;
    transition: width 0.5s;
}

.ia-score-nivel {
    font-size: 14px;
    color: #666;
}

/* Recomendaciones */
.ia-recomendaciones {
    background: #fff3cd;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}

.ia-recomendaciones h4 {
    margin-bottom: 10px;
    color: #856404;
}

.ia-recomendaciones ul {
    margin-left: 20px;
    color: #856404;
}

.ia-recomendaciones-ok {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    text-align: center;
}

/* ============================================================================
   BOTÓN TRIGGER EN FICHA PRODUCTO
   ============================================================================ */

.btn-visualizador-producto {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #90439e, #e91e63);
    color: white !important;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(144, 67, 158, 0.3);
}

.btn-visualizador-producto:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(144, 67, 158, 0.4);
}

.btn-visualizador-producto span {
    font-size: 18px;
}
