/* Configurador de Puertas - Estilos Modernos */

/* Contenedor principal */
.configurador-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Layout responsivo mejorado */
@media (max-width: 1023px) {
    .grid.grid-cols-1.lg\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .sticky.top-6 {
        position: static !important;
    }
}

/* Mejoras visuales para el visualizador */
#product-visualizer {
    transition: all 0.3s ease;
}

#product-visualizer .product-image {
    width: 100%;
    max-width: 400px;
    height: 450px;
    margin: 0 auto;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e2e8f0;
    padding: 20px;
    box-sizing: border-box;
}

#product-visualizer:hover {
    transform: translateY(-2px);
}

/* Animación para las capas de imagen */
.image-layer {
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mejoras en el botón de agregar al carrito */
#add-to-cart-btn:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

#add-to-cart-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* Skeleton loader para el precio */
.price-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    height: 36px;
    width: 120px;
    margin-left: auto;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Mejoras en el contenedor de precio */
#price-container {
    transition: all 0.3s ease;
}

#price-container.price-updated {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

/* Mejoras en el resumen de configuración */
#selection-summary {
    transition: all 0.3s ease;
}

#summary-content .config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

#summary-content .config-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

#summary-content .config-item .config-label {
    font-weight: 600;
    color: #374151;
    margin-right: 8px;
    min-width: 120px;
}

#summary-content .config-item .config-value {
    color: #1f2937;
    font-weight: 500;
}

/* Indicador de progreso mejorado */
#progress-bar {
    background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 50%, #1e40af 100%);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Efectos de hover para las tarjetas */
.bg-white.rounded-lg.shadow-lg {
    transition: all 0.3s ease;
}

.bg-white.rounded-lg.shadow-lg:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
}

/* Animaciones suaves */
.attribute-field {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-in-out;
}

.attribute-field[style*="block"], .attribute-field:not([style*="none"]) {
    opacity: 1;
    transform: translateY(0);
}

/* Estilos para Select2 mejorados */
.select2-container {
    width: 100% !important;
    margin-bottom: 0;
}

.select2-container .select2-selection--single {
    height: 48px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.select2-container .select2-selection--single:hover {
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #374151 !important;
    line-height: 44px !important;
    padding-left: 16px !important;
    font-size: 16px !important;
    font-weight: 500;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af !important;
    font-weight: 400;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px !important;
    right: 12px !important;
    width: 20px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #6b7280 transparent transparent transparent !important;
    border-width: 6px 6px 0 6px !important;
    margin-top: -3px !important;
}

/* Dropdown mejorado */
.select2-dropdown {
    border: 2px solid #e5e7eb !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    margin-top: 4px;
}

.select2-container--default .select2-results__option {
    padding: 12px 16px !important;
    font-size: 16px !important;
    transition: all 0.15s ease;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #3b82f6 !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    font-weight: 600;
}

/* Barra de progreso personalizada */
#progress-bar {
    background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* === SISTEMA DE CAPAS DE IMÁGENES === */

/* Contenedor del visualizador */
#product-visualizer {
    transition: all 0.3s ease;
}

#product-visualizer:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Capas de imágenes */
.image-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    z-index: 1;
}

.image-layer.active {
    opacity: 1;
}

.image-layer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Capa base */
#base-layer {
    z-index: 0;
    transition: opacity 0.3s ease;
}

#base-layer.hidden {
    opacity: 0;
}

/* Efectos de carga */
.image-layer.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Indicador de carga de imagen */
.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive para el visualizador */
@media (max-width: 640px) {
    #product-visualizer .relative {
        width: 250px !important;
        height: 320px !important;
    }
    
    #product-visualizer h3 {
        font-size: 1rem;
    }
}

/* Contenedor de precio */
#price-container {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #3b82f6;
    transition: opacity 0.2s ease;
}

/* Animación suave solo para el contenido del precio */
#current-price {
    transition: all 0.15s ease;
}

/* Animación inicial solo cuando aparece por primera vez */
#price-container:not(.price-updated) {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Resumen de configuración */
#selection-summary {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid #e5e7eb;
}

/* Botón de agregar al carrito */
#add-to-cart-btn {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#add-to-cart-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

#add-to-cart-btn:disabled {
    transform: none;
    box-shadow: none;
}

/* Contenedor del select */
.configurador-select {
    position: relative;
}

/* Efectos de hover para campos */
.attribute-field:hover .configurador-select + .select2-container .select2-selection--single {
    border-color: #6366f1;
}

/* Mejoras para Select2 */

/* Ocultar botón de limpiar (X) */
.select2-container--default .select2-selection--single .select2-selection__clear {
    display: none !important;
}

/* Dropdown mejorado - más separado */
.select2-container--default .select2-dropdown {
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    margin-top: 12px !important;
}

/* Campo de búsqueda en el dropdown */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    margin: 8px !important;
    width: calc(100% - 16px) !important;
    box-sizing: border-box !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #3b82f6 !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Opciones del dropdown */
.select2-container--default .select2-results__option {
    padding: 12px 16px !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    transition: all 0.15s ease !important;
}

.select2-container--default .select2-results__option:last-child {
    border-bottom: none !important;
}

.select2-container--default .select2-results__option--highlighted {
    background-color: #eff6ff !important;
    color: #1e40af !important;
}

.select2-container--default .select2-results__option--selected {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    font-weight: 500 !important;
}

/* Ajustar posición del dropdown para evitar solapamientos */
.select2-container--open .select2-dropdown--below {
    margin-top: 2px !important;
}

.select2-container--open .select2-dropdown--above {
    margin-bottom: 2px !important;
}

/* Responsive */
@media (max-width: 640px) {
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        font-size: 14px !important;
    }
    
    .select2-container--default .select2-results__option {
        padding: 10px 12px !important;
        font-size: 14px !important;
    }
    
    .select2-container--default .select2-search--dropdown .select2-search__field {
        font-size: 14px !important;
        padding: 6px 10px !important;
    }
}

/* Loading state */
.configurador-loading {
    position: relative;
    pointer-events: none;
}

.configurador-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 40px;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
