/*
 * CSS específico para página individual de producto
 * Optimizado para WPO (Web Performance Optimization)
 * Carga diferida para evitar bloqueo de renderizado
 */

/*
 * CSS específico para página individual de producto
 * Optimizado para WPO (Web Performance Optimization)
 * Carga diferida para evitar bloqueo de renderizado
 */

/* --------------------------------------------------------------------------
 * 1. LAYOUT PRINCIPAL DE DOS COLUMNAS - IMAGEN A LA IZQUIERDA (ORIGINAL)
 * -------------------------------------------------------------------------- */

/* Breadcrumb - ajustar posición para evitar conflicto con menú principal */
.single-product-page .woocommerce-breadcrumb {
    margin: 6rem 0 1rem 0; /* Más margen superior para bajar la barra */
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    background: transparent;
}

/* Layout principal de producto */
.single-product-layout {
    display: block;
    margin: 1rem 0 2rem 0; /* Reducir margen superior ya que breadcrumb ya tiene espacio */
    width: 100%;
    position: relative; /* Asegurar que tenga contexto de posicionamiento */
    z-index: 1; /* Debajo del menú si es necesario */
}

@media (min-width: 768px) {
    .single-product-layout {
        display: grid;
        grid-template-columns: 60% 40%;
        gap: 2rem;
        align-items: start;
    }
}

/* Columnas del grid */
.product-gallery-column {
    width: 100%;
    padding-top: 2rem; /* Más espacio adicional en la columna de galería */
}

.product-info-column {
    width: 100%;
}

/* Reset de estilos heredados de WooCommerce */
.single-product-layout .woocommerce-product-gallery,
.single-product-layout .woocommerce-product-details__short-description,
.single-product-layout .product_meta {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    float: none;
}

/* Eliminar floats heredados */
.single-product-layout:after {
    content: "";
    display: table;
    clear: both;
}

/* Asegurar orden correcto en móviles */
@media (max-width: 991px) {
    .product-gallery-column {
        order: 1; /* Imagen primero en móviles */
    }
    
    .product-info-column {
        order: 2; /* Información después en móviles */
    }
}

/* --------------------------------------------------------------------------
 * 2. GALERÍA DE IMÁGENES OPTIMIZADA
 * -------------------------------------------------------------------------- */

/* Imagen principal */
.product-main-image {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Lazy loading para imágenes */
.product-main-image img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.product-main-image img.loaded {
    opacity: 1;
}

/* Miniaturas */
.product-thumbnails {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.product-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.product-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.product-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.product-thumbnail:hover {
    border-color: #ff6b00;
    transform: scale(1.05);
}

.product-thumbnail.active {
    border-color: #ff6b00;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.2);
}

/* --------------------------------------------------------------------------
 * 3. INFORMACIÓN DEL PRODUCTO PARA CATÁLOGO - PAQUETE UNIFICADO
 * -------------------------------------------------------------------------- */

/* Título H1 */
.product-title {
    font-size: 1.75rem;
    color: #1a1a1a;
    margin: 3rem 0 1rem 0; /* Reducir margen superior ya que breadcrumb proporciona espacio */
    line-height: 1.2;
    font-weight: 700;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
    text-align: left;
}

@media (max-width: 767px) {
    .product-title {
        font-size: 1.5rem;
        text-align: center;
        margin: 1rem 0 0.75rem 0; /* Mantener margen reducido en móviles */
        padding-bottom: 0.75rem;
    }
}

/* Contenedor de información del producto */
.product-summary {
    display: block;
    width: 100%;
}

/* --------------------------------------------------------------------------
 * 4. BOTÓN WHATSAPP MINIMALISTA Y ELEGANTE
 * -------------------------------------------------------------------------- */
.whatsapp-cta-socoda {
    margin: 0 0 1.5rem 0;
    width: 100%;
    max-width: 400px;
}

/* Botón WhatsApp minimalista - estilo corporativo */
.btn-whatsapp-socoda {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #FF6B00; /* Color corporativo sólido */
    color: white;
    padding: 1.125rem 2.5rem;
    border-radius: 8px; /* Bordes ligeramente redondeados */
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
    /* Sin sombras pesadas, solo una sutil para profundidad */
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.2);
    letter-spacing: 0.3px;
}

.btn-whatsapp-socoda:hover {
    background: #E65100; /* Color más oscuro al hover */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.25);
}

.btn-whatsapp-socoda:active {
    transform: translateY(0);
}

/* Eliminar icono de emoji - solo texto */
.whatsapp-icon {
    display: none; /* Ocultar el emoji */
}

.whatsapp-note {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
    font-style: italic;
    opacity: 0.8;
}

/* --------------------------------------------------------------------------
 * 5. METADATOS DEL PRODUCTO - CENTRADO Y LIMPIO
 * -------------------------------------------------------------------------- */
.product-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #555;
    margin: 0.75rem 0 0 0;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    width: 100%;
    max-width: 400px;
    text-align: left;
}

/* Ajuste de margen para galería */
.product-gallery-column {
    width: 100%;
    margin-top: 0; /* Sin margen superior */
}


/* --------------------------------------------------------------------------
 * 7. LAYOUT DE DOS COLUMNAS PARA DESCRIPCIÓN CORTA E INFORMACIÓN DEL PRODUCTO
 * -------------------------------------------------------------------------- */
.product-details-layout {
    display: block;
    margin: 3rem 0;
    gap: 3rem;
}

@media (min-width: 992px) {
    .product-details-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        align-items: start;
    }
}

/* Columna izquierda: Descripción corta */
.product-short-description-column {
    width: 100%;
}

.short-description-content {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid #eaeaea;
}

.short-description-title {
    font-size: 1.5rem;
    color: #1a1a1a;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ff6b00;
}

.short-description-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #444;
}

.short-description-text p {
    margin-bottom: 1rem;
}

.short-description-text p:last-child {
    margin-bottom: 0;
}

/* Columna derecha: Información del producto */
.product-info-details-column {
    width: 100%;
}

/* --------------------------------------------------------------------------
 * 8. ACORDEÓN CSS PURO PARA INFORMACIÓN TÉCNICA
 * -------------------------------------------------------------------------- */
.product-technical-info {
    margin: 0;
    padding: 0;
}

.technical-info-title {
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
    text-align: left;
}

.accordion-container {
    max-width: 100%;
    margin: 0;
}

.accordion-item {
    margin-bottom: 1rem;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
}

.accordion-checkbox {
    display: none;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.3s ease;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.accordion-icon {
    font-size: 1.5rem;
    color: #666;
    transition: transform 0.3s ease;
}

.accordion-checkbox:checked + .accordion-header .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

/* CORRECCIÓN: Usar el selector correcto para hermano general */
.accordion-checkbox:checked + .accordion-header + .accordion-content {
    max-height: 2000px;
}

/* Contenido del acordeón */
.accordion-content > div {
    padding: 1.5rem;
}

/* Tabla de especificaciones */
.specifications-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.specifications-table th,
.specifications-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eaeaea;
}

.specifications-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    width: 40%;
}

.specifications-table tr:last-child th,
.specifications-table tr:last-child td {
    border-bottom: none;
}

/* Información de garantía y envío */
.warranty-info h3,
.shipping-info h3 {
    color: #333;
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.2rem;
}

.warranty-info h3:first-child,
.shipping-info h3:first-child {
    margin-top: 0;
}

.warranty-info ul,
.shipping-info ul {
    margin: 0.75rem 0;
    padding-left: 1.25rem;
}

.warranty-info li,
.shipping-info li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
 * 9. PRODUCTOS RELACIONADOS
 * -------------------------------------------------------------------------- */
.related-products-section {
    margin: 3rem 0;
    padding: 2rem 0;
    border-top: 2px solid #eaeaea;
}

.section-title {
    font-size: 1.75rem;
    color: #1a1a1a;
    margin-bottom: 2rem;
    text-align: center;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .related-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.related-product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eaeaea;
    transition: all 0.3s ease;
}

.related-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #ff6b00;
}

.related-product-image {
    display: block;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.related-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.related-product-card:hover .related-product-image img {
    transform: scale(1.05);
}

.related-product-content {
    padding: 1.25rem;
}

.related-product-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    line-height: 1.3;
}

.related-product-content h3 a {
    color: #333;
    text-decoration: none;
}

.related-product-content h3 a:hover {
    color: #ff6b00;
}

.whatsapp-text-link {
    display: inline-block;
    color: #FF6B00;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    transition: color 0.3s ease;
}

.whatsapp-text-link:hover {
    color: #E65100;
    text-decoration: underline;
}

.btn-view-product {
    display: inline-block;
    background: #f8f9fa;
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-view-product:hover {
    background: #ff6b00;
    color: white;
}

/* --------------------------------------------------------------------------
 * 10. CTA FINAL OPTIMIZADO - FULL WIDTH
 * -------------------------------------------------------------------------- */
.product-final-cta {
    margin: 3rem 0 0 0; /* Quitar margen inferior para que llegue hasta el footer */
    padding: 5rem 0; /* Aumentar un poco la altura del banner */
    background: linear-gradient(135deg, #FF6B00 0%, #E65100 100%);
    border-radius: 0;
    text-align: center;
    color: white;
    width: 100vw; /* Full viewport width */
    margin-left: calc(50% - 50vw); /* Centrar con viewport */
    margin-right: calc(50% - 50vw);
}

.cta-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.product-final-cta h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.cta-description {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

@media (min-width: 576px) {
    .cta-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

.btn-cta-whatsapp,
.btn-cta-phone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    min-width: 250px;
}

.btn-cta-whatsapp {
    background: white;
    color: #25D366;
}

.btn-cta-whatsapp:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.btn-cta-phone {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-cta-phone:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.cta-icon {
    font-size: 1.2rem;
}

/* --------------------------------------------------------------------------
 * 11. OPTIMIZACIONES WPO
 * -------------------------------------------------------------------------- */

/* Carga diferida de imágenes */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Evitar layout shift */
.product-main-image,
.related-product-image {
    aspect-ratio: 4/3;
}

/* Optimización para móviles */
@media (max-width: 768px) {
    .single-product-layout {
        gap: 2rem;
    }
    
    .product-title {
        font-size: 1.5rem;
    }
    
    .btn-whatsapp-socoda,
    .btn-cta-whatsapp,
    .btn-cta-phone {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .accordion-header {
        padding: 1rem 1.25rem;
    }
    
    .accordion-content > div {
        padding: 1.25rem;
    }
}

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

/* --------------------------------------------------------------------------
 * 12. MEJORAS DE ACCESIBILIDAD
 * -------------------------------------------------------------------------- */

/* Focus styles para teclado */
.btn-whatsapp-socoda:focus,
.btn-cta-whatsapp:focus,
.btn-cta-phone:focus,
.accordion-header:focus {
    outline: 2px solid #ff6b00;
    outline-offset: 2px;
}
