/**
 * Grilla de Productos - Estilos
 * Version: 3.4.0
 */

/* ===== ESTILOS GENERALES ===== */
.pgw-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* ===== GRID ===== */
.pgw-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
}

/* ===== TARJETA ===== */
.pgw-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #eef2f7;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pgw-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    transform: translateY(-4px);
}

/* ===== IMAGEN - MODIFICADO ===== */
.pgw-card-image {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background: #f8fafc;
    overflow: hidden;
}

.pgw-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cambiado de contain a cover */
    transition: transform 0.3s ease;
}

.pgw-card:hover .pgw-card-image img {
    transform: scale(1.02);
}

/* ===== ETIQUETA ===== */
.pgw-card-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #1a2634;
    color: #ffffff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* ===== BODY ===== */
.pgw-card-body {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pgw-product-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1a2634;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

/* ===== ATRIBUTOS - MODIFICADO (FILA HORIZONTAL) ===== */
.pgw-attributes {
    display: flex;
    flex-direction: row; /* Cambiado de column a row */
    flex-wrap: wrap; /* Permite que bajen si no caben */
    gap: 8px 12px;
    font-size: 0.82rem;
    color: #4a5a6b;
    margin: 6px 0 12px 0;
}

.pgw-attr-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pgw-attr-item i {
    width: 16px;
    font-size: 0.8rem;
    color: #1a2634;
    flex-shrink: 0;
    text-align: center;
}

.pgw-attr-item img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.pgw-attr-item .pgw-bullet {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #1a2634;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== DISPONIBILIDAD ===== */
.pgw-availability {
    font-size: 0.78rem;
    color: #2e7d32;
    font-weight: 500;
    margin: 4px 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pgw-availability::before {
    content: "●";
    font-size: 0.5rem;
    color: #2e7d32;
}

/* ===== BOTÓN ===== */
.pgw-card-action {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f2f7;
}

.pgw-btn-ver-mas {
    background: #1a2634;
    color: #ffffff;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: all 0.3s ease;
    font-family: inherit;
}

.pgw-btn-ver-mas:hover {
    background: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pgw-btn-ver-mas i {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.pgw-btn-ver-mas:hover i {
    transform: translateX(4px);
}

/* ============================================ */
/* ===== MODAL ===== */
/* ============================================ */

.pgw-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.pgw-modal-overlay.active {
    display: flex;
}

.pgw-modal-container {
    background: #fff;
    max-width: 820px;
    width: 100%;
    border-radius: 28px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.3);
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    position: relative;
    max-height: 90vh;
}

/* ===== GALERÍA ===== */
.pgw-modal-gallery {
    padding: 24px 16px 24px 24px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pgw-modal-main-image {
    width: 100%;
    aspect-ratio: 1/1;
    background: #eef1f5;
    border-radius: 20px;
    overflow: hidden;
}

.pgw-modal-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer; /* Indica que es clickeable */
}

.pgw-modal-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pgw-modal-thumb {
    width: 60px;
    height: 55px;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.pgw-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pgw-modal-thumb.active {
    border-color: #1a2634;
}

.pgw-modal-thumb:hover {
    border-color: #1a2634;
}

/* ===== INFO MODAL - MODIFICADO PARA SCROLL ===== */
.pgw-modal-body {
    padding: 28px 28px 28px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden; /* Evita que el body entero scrollee */
}

.pgw-modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #141f2b;
    margin: 0 0 16px 0;
}

.pgw-modal-attrs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 0.9rem;
    color: #1e2a3a;
    margin-bottom: 20px;
    overflow-y: auto; /* Añadido scroll vertical */
    max-height: 40vh; /* Altura máxima para el scroll */
    padding-right: 5px; /* Espacio para la barra de scroll */
}

.pgw-modal-attr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f2f5;
}

.pgw-modal-attr:last-child {
    border-bottom: none;
}

.pgw-modal-attr i {
    width: 20px;
    font-size: 1rem;
    color: #1a2634;
    text-align: center;
}

.pgw-modal-attr .pgw-bullet {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #1a2634;
    border-radius: 50%;
    flex-shrink: 0;
}

.pgw-modal-attr img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.pgw-modal-btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #25D366;
    color: #fff;
    padding: 14px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    width: 100%;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Evita que el botón se encoja */
}

.pgw-modal-btn-whatsapp:hover {
    background: #1da851;
    transform: scale(1.02);
}

.pgw-modal-btn-whatsapp i {
    font-size: 1.2rem;
}

.pgw-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.95);
    border: none;
    font-size: 1.2rem;
    color: #6b7b8c;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 30px;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: all 0.2s;
}

.pgw-modal-close:hover {
    background: #ffffff;
    color: #1a2634;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

/* ============================================ */
/* ===== LIGHTBOX (NUEVO) ===== */
/* ============================================ */
.pgw-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    padding: 20px;
}

.pgw-lightbox-overlay.active {
    display: flex;
}

.pgw-lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.pgw-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
}

.pgw-lightbox-close:hover {
    transform: scale(1.1);
}

/* ============================================ */
/* ===== RESPONSIVE ===== */
/* ============================================ */

/* Tablet: 2 columnas */
@media (max-width: 991px) {
    .pgw-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Celular: 1 columna */
@media (max-width: 576px) {
    .pgw-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .pgw-card-image {
        padding-top: 65%;
    }
    
    .pgw-product-title {
        font-size: 0.95rem;
    }
    
    .pgw-modal-container {
        grid-template-columns: 1fr;
        max-width: 500px;
        border-radius: 20px;
    }
    
    .pgw-modal-gallery {
        padding: 20px;
        border-radius: 20px 20px 0 0;
    }
    
    .pgw-modal-body {
        padding: 20px 24px 24px;
    }
    
    .pgw-modal-main-image {
        aspect-ratio: 16/9;
    }
    
    .pgw-modal-thumb {
        width: 50px;
        height: 45px;
    }

    .pgw-modal-attrs {
        max-height: 30vh; /* Ajuste para móviles */
    }
}

@media (max-width: 400px) {
    .pgw-wrapper {
        padding: 10px 8px;
    }
    
    .pgw-card-body {
        padding: 12px 14px 14px;
    }
    
    .pgw-attributes {
        font-size: 0.75rem;
    }
    
    .pgw-btn-ver-mas {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
}