/* ===== ESTILOS PARA PRODUCTOS RELACIONADOS ===== */

.custom-related-section {
    margin: 60px 0;
    padding: 40px 0;
    text-align: center;
    width: 100%;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.section-title h2 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    position: relative;
    padding-bottom: 15px;
    text-align: center;
    margin: 0 auto;
}

.section-title h2:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-radius: 2px;
    margin: 0 auto;
}

.custom-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(305px, 305px));
    gap: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    justify-items: start; /* Alinear a la izquierda */
}

/* Remover centrado para productos individuales */
.custom-related-grid:has(.custom-related-card:only-child) {
    justify-items: start; /* Alinear a la izquierda en lugar de centrar */
}

/* Cuando hay 2 productos */
.custom-related-grid:has(.custom-related-card:first-child:nth-last-child(2)),
.custom-related-grid:has(.custom-related-card:first-child:nth-last-child(2) ~ .custom-related-card) {
    grid-template-columns: repeat(auto-fill, minmax(305px, 305px));
    justify-items: start; /* Alinear a la izquierda */
    max-width: 900px;
}

/* Cuando hay 3 productos */
.custom-related-grid:has(.custom-related-card:first-child:nth-last-child(3)),
.custom-related-grid:has(.custom-related-card:first-child:nth-last-child(3) ~ .custom-related-card) {
    grid-template-columns: repeat(auto-fill, minmax(305px, 305px));
    justify-items: start; /* Alinear a la izquierda */
    max-width: 1200px;
}

.custom-related-card {
    background: #fff;
    border-radius: 32px;
    box-shadow: 0 4px 24px rgba(85,19,12,0.08);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 390px; /* Altura fija en lugar de min-height */
    width: 305px; /* Ancho fijo de 305px */
    max-width: 305px; /* Ancho máximo de 305px */
    position: relative;
    padding: 0;
}

.custom-related-card:hover {
    box-shadow: 0 8px 32px rgba(85,19,12,0.16);
    transform: translateY(-6px) scale(1.03);
}

.custom-related-img-link {
    width: 100%;
    height: 154px; /* Altura fija reducida en 30% (220px * 0.7) */
    background: #F8D2CE;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0; /* Evitar que se comprima */
    min-height: 154px; /* Altura mínima fija */
    max-height: 154px; /* Altura máxima fija */
}

.custom-related-img-link img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    margin: 0 auto;
    display: block;
    max-height: 139px; /* 90% de 154px para consistencia */
    min-height: 139px; /* Altura mínima para la imagen */
}

.custom-related-card:hover .custom-related-img-link img {
    transform: scale(1.05);
}

.custom-related-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.2rem 1.2rem 1.5rem 1.2rem;
}

.custom-related-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #55130C;
    margin: 1.1rem 0 0.5rem 0;
    text-align: left;
    min-height: 48px;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.custom-related-title:hover {
    color: #AA2718;
}

.custom-related-excerpt {
    font-size: 16px;
    color: #6c757d;
    margin: 0;
    text-align: left;
}

/* Responsive */
@media (max-width: 768px) {
    .custom-related-section {
        margin: 40px 0;
        padding: 30px 0;
    }
    
    .section-title h2 {
        font-size: 24px;
    }
    
    .custom-related-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 305px));
        gap: 20px;
        padding: 0 15px;
        justify-items: center; /* Centrar en tablet */
        justify-content: center; /* Centrar el grid */
    }
    
    /* Centrar productos individuales en tablet */
    .custom-related-grid:has(.custom-related-card:only-child) {
        justify-items: center;
    }
    
    /* Cuando hay 2 productos en tablet */
    .custom-related-grid:has(.custom-related-card:first-child:nth-last-child(2)),
    .custom-related-grid:has(.custom-related-card:first-child:nth-last-child(2) ~ .custom-related-card) {
        grid-template-columns: repeat(auto-fill, minmax(280px, 305px));
        justify-items: center; /* Centrar en tablet */
        justify-content: center; /* Centrar el grid */
        max-width: 100%;
    }
    
    .custom-related-card {
        height: 380px; /* Aumentar altura en tablet */
        width: 280px; /* Ancho fijo en tablet */
        max-width: 305px; /* Ancho máximo */
    }
    
    .custom-related-img-link {
        height: 160px; /* Aumentar altura del área rosada en tablet */
        min-height: 160px;
        max-height: 160px;
    }
    
    .custom-related-img-link img {
        max-height: 144px; /* 90% de 160px */
        min-height: 144px;
    }
    
    .custom-related-body {
        padding: 15px;
    }
    
    .custom-related-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .custom-related-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        justify-items: center; /* Centrar en móvil */
        justify-content: center; /* Centrar el grid */
    }
    
    /* En móvil pequeño, siempre una columna pero centrada */
    .custom-related-grid:has(.custom-related-card:first-child:nth-last-child(2)),
    .custom-related-grid:has(.custom-related-card:first-child:nth-last-child(2) ~ .custom-related-card),
    .custom-related-grid:has(.custom-related-card:first-child:nth-last-child(3)),
    .custom-related-grid:has(.custom-related-card:first-child:nth-last-child(3) ~ .custom-related-card) {
        grid-template-columns: 1fr;
        max-width: 350px;
        margin: 0 auto;
        justify-items: center; /* Centrar en móvil */
        justify-content: center; /* Centrar el grid */
    }
    
    /* Centrar productos individuales en móvil */
    .custom-related-grid:has(.custom-related-card:only-child) {
        justify-items: center;
    }
    
    .custom-related-card {
        height: 360px; /* Aumentar altura en móvil */
        width: 100%; /* Ancho completo en móvil */
        max-width: 305px; /* Ancho máximo */
    }
    
    .custom-related-img-link {
        height: 140px; /* Aumentar altura del área rosada en móvil */
        min-height: 140px;
        max-height: 140px;
    }
    
    .custom-related-img-link img {
        max-height: 126px; /* 90% de 140px */
        min-height: 126px;
    }
} 