/**
 * VISUALIZADOR 3D - ESTILOS ESPECÍFICOS
 * Estilos personalizados para el visualizador de pisos epóxicos
 */

/* Container principal del visualizador */
#viewer-3d {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
}

/* Overlay de carga */
#loading-overlay {
    backdrop-filter: blur(10px);
    transition: opacity 0.5s ease-out;
}

#loading-bar {
    transition: width 0.3s ease-out;
}

/* Panel de controles */
.controls-panel {
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.controls-panel:hover {
    box-shadow: 0 10px 40px rgba(212, 175, 55, 0.2);
}

/* Botones de habitación */
.room-btn {
    transition: all 0.2s ease;
}

.room-btn.active-room {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.1));
    border-color: rgba(212, 175, 55, 0.6);
}

/* Galería de texturas */
.texture-item {
    aspect-ratio: 1;
    transition: box-shadow 0.2s ease;
}

.texture-item:hover {
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
}

/* Estadísticas del visualizador */
#fps-counter {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

#triangle-count,
#resolution {
    font-variant-numeric: tabular-nums;
    font-size: 10px;
}

/* Animaciones para controles */
@keyframes pulse-gold {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(212, 175, 55, 0);
    }
}

.pulse-animation {
    animation: pulse-gold 2s 1;
}

/* Modal de cotización */
#quote-modal {
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

#quote-form {
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

/* Custom range sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: linear-gradient(to right, #D4AF37, #B8962E);
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #D4AF37;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    margin-top: -6px;
}

input[type="range"]::-moz-range-track {
    background: linear-gradient(to right, #D4AF37, #B8962E);
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #D4AF37;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* Notificaciones */
.notification {
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
    transform: translateX(0);
}

/* Toast del visualizador - bottom center, no tapa el panel */
.viewer-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 60;
}

.viewer-notification.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .viewer-notification {
        bottom: 96px; /* Sobre el panel móvil */
    }
}

/* Select personalizados */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23D4AF37' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Color picker personalizado */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 0;
    background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid #D4AF37;
    border-radius: 8px;
}

input[type="color"]::-moz-color-swatch {
    border: 2px solid #D4AF37;
    border-radius: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .controls-panel {
        width: calc(100% - 32px) !important;
        max-width: none !important;
        top: auto !important;
        bottom: 16px !important;
        right: 16px !important;
    }

    #viewer-3d {
        height: 400px !important;
    }

    .texture-item {
        aspect-ratio: 1;
    }

    /* Ocultar estadísticas en móvil */
    #stats-panel {
        display: none;
    }
}

@media (max-width: 480px) {
    #viewer-3d {
        height: 300px !important;
    }

    .controls-panel {
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* Animaciones de carga para texturas */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.texture-loading {
    background: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Estados hover para elementos interactivos */
.interactive-hover {
    transition: all 0.2s ease;
}

.interactive-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.interactive-hover:active {
    transform: translateY(0);
}

/* Scrollbar personalizado para el panel de controles */
#controls-content::-webkit-scrollbar {
    width: 6px;
}

#controls-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#controls-content::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.6);
    border-radius: 3px;
}

#controls-content::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.8);
}

/* Efectos de brillo para botones destacados */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
    }
}

.glow-effect {
    animation: glow-pulse 2s 1;
}

/* Estilos para screenshot */
.screenshot-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}

@keyframes flash-animation {
    0% { opacity: 0; }
    0.1% { opacity: 1; }
    0.2% { opacity: 0; }
    100% { opacity: 0; }
}

.screenshot-flash.flash {
    animation: flash-animation 0.3s ease-out;
}

/* Tooltips personalizados */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Estados de carga para diferentes elementos */
.loading-state {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading-state::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Mejoras de accesibilidad */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible para accesibilidad */
*:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: 2px;
}

/* Soporte para modo oscuro del sistema */
@media (prefers-color-scheme: dark) {
    .controls-panel {
        background: rgba(20, 20, 30, 0.95);
    }
}

/* Optimizaciones para impresión */
@media print {
    #viewer-3d,
    .controls-panel,
    #loading-overlay {
        display: none;
    }
}

/* Reducir movimiento para usuarios que prefieren menos animación */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}