/* =====================================================
   CORRECCIONES DETALLE PRODUCTO
   Específico para la página de detalle
   ===================================================== */

/* Contenedor principal galería con ancho limitado */
.producto-galeria {
    max-width: 100%;
    overflow: hidden;
}

/* Galería principal - DEBE SER VISIBLE */
.galeria-principal {
    position: relative;
    background: #fff !important;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    min-height: 400px !important;
    height: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: 2px solid #e5e7eb !important;
}

.imagen-principal {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
}

/* Container miniaturas con flechas HORIZONTAL */
.galeria-miniaturas-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    width: 100%;
    max-width: 100%;
}

.galeria-miniaturas {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    min-width: 0;
}

.galeria-miniaturas::-webkit-scrollbar {
    display: none;
}

.galeria-arrow {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    z-index: 10;
}

.galeria-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.galeria-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Miniaturas */
.miniatura {
    position: relative;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.miniatura:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.miniatura.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.miniatura img,
.miniatura-video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Miniatura 3D Viewer especial */
.miniatura-3d-viewer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.miniatura-3d-viewer::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.miniatura-3d-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 1;
}

.icon-3d {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.text-3d {
    color: white;
    font-weight: 900;
    font-size: 13px;
    text-align: center;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.miniatura-3d-viewer:hover {
    transform: scale(1.1);
    border-color: #fff;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
}

.video-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Preview 3D Viewer en área principal */
.visor-3d-preview {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.visor-3d-header-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.visor-icon {
    font-size: 48px;
}

.visor-3d-header-preview h3 {
    margin: 0;
    font-size: 2rem;
    color: #1e293b;
    font-weight: 800;
}

.visor-subtitle {
    color: #64748b;
    font-size: 1.1rem;
    margin: 0 0 32px 0;
}

.archivos-3d-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 600px;
}

.archivo-3d-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.archivo-3d-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.archivo-3d-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.archivo-3d-icon {
    font-size: 32px;
}

.archivo-3d-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.archivo-3d-nombre {
    font-weight: 700;
    color: #1e293b;
    font-size: 1rem;
}

.archivo-3d-size {
    color: #64748b;
    font-size: 0.9rem;
}

.btn-ver-3d-inline {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-ver-3d-inline:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6441a5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
}

@media (max-width: 768px) {
    .visor-3d-preview {
        padding: 20px;
        min-height: 300px;
    }
    
    .visor-3d-header-preview h3 {
        font-size: 1.5rem;
    }
    
    .archivo-3d-item {
        flex-direction: column;
        gap: 16px;
    }
    
    .btn-ver-3d-inline {
        width: 100%;
    }
}

/* Videos sin controles */
video.imagen-principal {
    outline: none;
}

video.imagen-principal::-webkit-media-controls {
    display: none !important;
}

video.imagen-principal::-webkit-media-controls-enclosure {
    display: none !important;
}

video.imagen-principal::-webkit-media-controls-panel {
    display: none !important;
}

/* Precio y botón */
.producto-precio-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 20px 0;
}

.form-agregar-inline {
    margin: 0;
}

.btn-add-cart {
    padding: 12px 24px;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Archivos Premium - CON BORDE VISIBLE */
.archivos-descarga-premium {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.archivos-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.archivos-icon {
    font-size: 28px;
}

.archivos-header h3 {
    margin: 0;
    color: #1e40af;
    font-size: 1.2rem;
    font-weight: 700;
}

.archivos-subtitle {
    color: #1e40af;
    margin: 0 0 16px 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Archivos Bloqueado - CON BORDE VISIBLE */
.archivos-descarga-locked {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
}

.archivos-descarga-locked .archivos-header h3 {
    color: #64748b;
}

.archivos-descarga-locked .archivos-subtitle {
    color: #64748b;
}

.lista-archivos {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.archivo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.2s;
}

.archivo-descargable {
    text-decoration: none;
    color: inherit;
}

.archivo-descargable:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateX(6px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.archivo-bloqueado {
    opacity: 0.65;
    cursor: not-allowed;
}

.archivo-nombre {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.archivo-size {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.archivos-empty {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Tags - HOVER CON COLOR VISIBLE */
.producto-tags {
    margin: 16px 0;
    padding: 16px 0;
    border-top: 1px solid #e5e7eb;
}

.tag-badge {
    display: inline-block;
    padding: 6px 14px;
    margin: 4px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.tag-badge:hover {
    background: #667eea;
    color: white !important;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

/* BOTÓN LIKE EN DETALLE - INTEGRADO CON META */
.producto-meta .like-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    background: none;
    border: none;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 500;
}

.producto-meta .like-btn:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.producto-meta .like-btn.liked {
    color: #ef4444;
}

.producto-meta .like-btn.liked:hover {
    transform: scale(1.15);
}

.producto-meta .like-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.producto-meta .like-counter {
    font-weight: 600;
    min-width: 22px;
    text-align: center;
}

/* Móvil vertical - Galería en columna única */
@media (max-width: 768px) and (orientation: portrait) {
    .producto-detalle-enhanced {
        display: block;
    }
    
    /* Título primero */
    .producto-info-enhanced .producto-header-row {
        order: -1;
        margin-bottom: 1.5rem;
    }
    
    /* Luego galería en columna completa */
    .producto-galeria {
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .galeria-principal {
        min-height: 280px !important;
        width: 100%;
    }
    
    .imagen-principal {
        max-height: 350px;
        width: 100%;
        object-fit: contain;
    }
    
    .galeria-miniaturas-container {
        width: 100%;
    }
    
    .producto-precio-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-add-cart {
        width: 100%;
    }
}

/* =====================================================
   COLECCIONES EN DETALLE PRODUCTO - ESTILO DISCRETO
   ===================================================== */

.producto-colecciones {
    margin: 20px 0 !important;
    padding: 16px 0 !important;
    border-top: 1px solid #e5e7eb !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.producto-colecciones strong {
    display: block !important;
    margin-bottom: 10px !important;
    color: #475569 !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
}

.badge-coleccion {
    display: inline-block !important;
    padding: 6px 12px !important;
    margin: 4px 4px 4px 0 !important;
    background: #667eea !important;
    color: white !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    border: 1px solid #667eea !important;
}

.badge-coleccion:hover {
    background: #5568d3 !important;
    border-color: #5568d3 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25) !important;
}

/* =====================================================
   PRODUCTO YA ADQUIRIDO - BADGE
   ===================================================== */

.producto-adquirido {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    border: 2px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
    margin-top: 10px;
}

.producto-adquirido::before {
    content: '✓';
    font-size: 1.3rem;
    font-weight: bold;
}

@media (max-width: 768px) {
    .producto-adquirido {
        width: 100%;
        justify-content: center;
        padding: 15px;
    }
}

/* =====================================================
   VISOR 3D - MODAL FULLSCREEN
   ===================================================== */

.archivo-item-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

.archivo-item-wrapper .archivo-item {
    flex: 1;
}

.btn-ver-3d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-ver-3d:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6441a5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
}

.btn-ver-3d:active {
    transform: translateY(0);
}

/* Modal Visor 3D */
.modal-visor-3d {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Header del visor */
.visor-3d-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 2px solid #667eea;
}

.visor-3d-title-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.visor-3d-header h3 {
    margin: 0;
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
}

.modelo-dimensiones {
    background: rgba(102, 126, 234, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    border: 1px solid rgba(102, 126, 234, 0.5);
    font-family: 'Courier New', monospace;
    display: inline-block;
    width: fit-content;
}

.modelo-dimensiones strong {
    color: #a5b4fc;
    margin-right: 8px;
}

.visor-3d-close {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visor-3d-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: rotate(90deg);
}

/* Container del canvas */
.visor-3d-container {
    position: relative;
    flex: 1;
    overflow: hidden;
}

#canvas3D {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

#canvas3D:active {
    cursor: grabbing;
}

/* Loading */
.loading-3d {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: rgba(26, 26, 46, 0.9);
    padding: 40px 60px;
    border-radius: 16px;
    border: 2px solid #667eea;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-3d p {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

/* Controles del visor */
.visor-3d-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
    border-top: 2px solid #667eea;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.control-label {
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.control-desc {
    color: #94a3b8;
    font-size: 0.85rem;
}

.btn-reset-camera {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-reset-camera:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6441a5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-reset-camera:active {
    transform: translateY(0);
}

.btn-toggle-wireframe {
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-toggle-wireframe:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-toggle-wireframe.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-toggle-wireframe.active:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-toggle-wireframe:active {
    transform: translateY(0);
}

/* Responsive móvil */
@media (max-width: 768px) {
    .archivo-item-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .archivo-item-wrapper .archivo-item {
        width: 100%;
    }
    
    .btn-ver-3d {
        width: 100%;
        padding: 12px;
    }
    
    .visor-3d-header {
        padding: 15px 20px;
    }
    
    .visor-3d-title-container {
        gap: 6px;
    }
    
    .visor-3d-header h3 {
        font-size: 1.1rem;
    }
    
    .modelo-dimensiones {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .visor-3d-close {
        width: 42px;
        height: 42px;
        font-size: 28px;
    }
    
    .visor-3d-controls {
        gap: 15px;
        padding: 15px;
    }
    
    .control-group {
        font-size: 0.85rem;
    }
    
    .btn-reset-camera {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .btn-toggle-wireframe {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}
