/* product-detail.css */

/* Prevenir scrollbar horizontal global si la ventana se ajusta */
body {
    overflow-x: hidden;
}

.product-detail-main {
    padding: 20px 0 60px;
    background-color: #fcfcfc;
}

.product-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Breadcrumb Estilo Minimalista */
.product-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    margin-bottom: 24px;
    flex-wrap: wrap;
    font-family: inherit;
}

.product-breadcrumb a {
    color: #2563eb; /* Azul estilo enlace web */
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.product-breadcrumb a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.product-breadcrumb .separator {
    color: #64748b;
    font-size: 0.85rem;
    user-select: none;
}

.product-breadcrumb .current {
    color: #475569;
    font-weight: 400;
}

/* Grid de 2 Columnas Principal */
.product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}

@media (min-width: 992px) {
    .product-layout {
        grid-template-columns: 1.1fr 0.9fr; /* Columna de galería ligeramente más ancha */
        align-items: start;
    }
}

/* Placeholders */
.gallery-placeholder, .info-placeholder {
    background: #ffffff;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    color: #888;
}

/* --- GALERÍA DE PRODUCTO --- */
.product-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 20px;
}

/* Vista Principal */
.gallery-main-view {
    position: relative;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.gallery-main-view .main-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Muestra el producto completo sin recortarlo */
    padding: 10px;       /* Pequeño respiro alrededor */
    transition: transform 0.3s ease;
    cursor: zoom-in;     /* Indica al usuario que puede ampliar la imagen */
}

.gallery-main-view:hover .main-image {
    transform: scale(1.02);
}

/* Badges sobre la foto */
.gallery-badges {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
}

.gallery-badges .badge {
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.badge-sale {
    background-color: #e63946;
    color: #ffffff;
}

.badge-featured {
    background-color: #0d2b45;
    color: #ffffff;
}

/* Tira de Miniaturas */
.gallery-thumbnails {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.thumb-btn {
    width: 80px;
    height: 80px;
    min-width: 80px;
    border: 2px solid #eef0f2;
    border-radius: 8px;
    background: #fff;
    padding: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.thumb-btn:hover {
    border-color: #cbd5e1;
}

.thumb-btn.active {
    border-color: #0d2b45;
}

/* ==========================================
   VISOR PANTALLA COMPLETA (LIGHTBOX)
   ========================================== */
.product-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.product-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.product-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Botón de Cierre */
.lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    background: transparent;
    color: #ffffff;
    border: none;
    font-size: 36px;
    cursor: pointer;
    font-weight: 300;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
    color: #ef4444;
    transform: scale(1.15);
}

/* Botones de Navegación (Anterior / Siguiente) */
.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
    user-select: none;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

/* --- INFORMACIÓN DE PRODUCTO --- */
.product-info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-meta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
}

/* Categoría con el Azul Institucional */
.product-category-tag {
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #0051bb;
    font-size: 1rem;
}

.product-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.25;
}

/* Bloque Precios */
.product-price-box {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.price-current {
    font-size: 2rem;
    font-weight: 800;
    color: #0d2b45;
}

.price-current small {
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
}

.price-old {
    font-size: 1.1rem;
    color: #94a3b8;
    text-decoration: line-through;
}

.discount-badge {
    background-color: #fee2e2;
    color: #ef4444;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Bloque Addi */
.addi-payment-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #166534;
}

.addi-logo-badge {
    background-color: #00005c;
    color: #fff;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Descripción Corta */
.product-short-description {
    font-size: 0.98rem;
    color: #475569;
    line-height: 1.6;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
}

/* Botón de Acción */
.btn-product-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background-color: #25d366;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

.btn-product-whatsapp:hover {
    background-color: #1ebc57;
    transform: translateY(-1px);
}

/* Destacados / Beneficios */
.product-highlights {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #64748b;
}

.highlight-item svg {
    color: #0d2b45;
}

/* --- SECCIÓN INFERIOR: AMBIENTACIÓN + TABS --- */
.product-tabs-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
    max-width: 1400px;
    margin: 30px auto 0;
    padding: 0 30px;
    box-sizing: border-box;
}

/* Columna Izquierda: Imagen Ambientada */
.tabs-ambient-image {
    width: 100%;
    height: 450px;
    overflow: hidden;
    background-color: #f8fafc;
    border-radius: 12px;
    border: 1px solid #eef0f2;
}

.tabs-ambient-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Columna Derecha: Contenedor Tabs */
.product-tabs-container {
    height: 450px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Encabezados de Pestañas */
.tabs-header {
    display: flex;
    background-color: #f8fafc;
    border-bottom: 1px solid #eef0f2;
    flex-shrink: 0;
}

.tab-btn {
    padding: 18px 28px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #0051bb;
}

.tab-btn.active {
    color: #0051bb;
    border-bottom-color: #0051bb;
    background-color: #ffffff;
}

/* Cuerpo con Scroll Interno */
.tabs-body {
    padding: 35px 40px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Scrollbar Personalizado */
.tabs-body::-webkit-scrollbar {
    width: 6px;
}

.tabs-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.tabs-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.tabs-body::-webkit-scrollbar-thumb:hover {
    background: #0051bb;
}

/* Ocultar pestañas inactivas y mostrar activa */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block !important;
}

/* --- SECCIÓN: TAMBIÉN TE PUEDE INTERESAR --- */
.related-products-section {
    padding: 60px 0 80px;
    background-color: #fcfcfc;
    border-top: 1px solid #eef0f2;
    margin-top: 50px;
}

.related-products-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    box-sizing: border-box;
}

.related-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0051bb;
    margin-bottom: 28px;
    position: relative;
    text-align: center;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Tarjeta de Producto Relacionado */
.product-card {
    background: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* Enlace/Contenedor de Imagen de la Tarjeta */
.card-image-link {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 4;
    overflow: hidden;
    background-color: #f8fafc;
}

.card-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

/* Imagen Principal (Base) */
.card-image-link .img-primary {
    position: relative;
    z-index: 1;
    opacity: 1;
}

/* Imagen Secundaria / Hover (Superpuesta) */
.card-image-link .img-hover {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
}

/* --- EFECTO HOVER EN PRODUCTOS --- */
.product-card:hover .card-image-link:not(.has-hover) .img-primary {
    transform: scale(1.05);
}

.product-card:hover .card-image-link.has-hover .img-primary {
    opacity: 0;
}

.product-card:hover .card-image-link.has-hover .img-hover {
    opacity: 1;
    transform: scale(1.05);
}

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: #e63946;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 3;
}

/* Contenido de la Tarjeta */
.card-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: #0051bb;
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 12px;
    line-height: 1.3;
}

.card-title a {
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s ease;
}

.card-title a:hover {
    color: #0051bb;
}

.card-price-box {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.card-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0d2b45;
}

.card-old-price {
    font-size: 0.88rem;
    color: #94a3b8;
    text-decoration: line-through;
}

/* --- RESPONSIVO --- */
@media (max-width: 1200px) {
    .related-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .product-tabs-section {
        grid-template-columns: 1fr;
        padding: 0 15px;
        gap: 20px;
        margin-top: 30px;
    }

    .tabs-ambient-image {
        height: 280px;
    }

    .product-tabs-container {
        height: auto;
        min-height: 380px;
    }

    .tabs-header {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .tabs-header::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: 0 0 auto;
        padding: 14px 18px;
        font-size: 0.88rem;
        scroll-snap-align: start;
    }

    .tabs-body {
        padding: 20px 18px;
    }
}

@media (max-width: 768px) {
    .related-products-section {
        padding: 40px 0 60px;
    }

    .related-products-container {
        padding: 0 15px;
    }

    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card-content {
        padding: 12px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .card-price {
        font-size: 1rem;
    }

    /* Ajustes móviles para el Lightbox */
    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.4);
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }
}