/* =====================================================
   MODERN PRODUCTS GRID - DISEÑO ELITE RED SOCIAL
   Inspirado en Instagram, Pinterest, TikTok
   ===================================================== */

:root {
    --products-primary: #53fc1b;
    --products-primary-hover: #45d916;
    --products-text-primary: #111827;
    --products-text-secondary: #6b7280;
    --products-bg-primary: #ffffff;
    --products-bg-secondary: #f9fafb;
    --products-border: #e5e7eb;
    --products-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --products-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --products-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --products-radius: 0.75rem;
    --products-radius-lg: 1rem;
}

/* Contenedor principal */
.modern-products-section {
    margin: var(--product-spacing-xl, 2rem) 0;
    padding: 0;
}

.modern-products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--product-spacing-lg, 1.5rem);
    padding: 0 var(--product-spacing-md, 1rem);
}

.modern-products-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--products-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--product-spacing-sm, 0.75rem);
    letter-spacing: -0.02em;
}

.modern-products-title i {
    color: var(--products-text-secondary, #6b7280);
    font-size: 1.375rem;
    opacity: 0.7;
}

/* Botón "Ver más" */
.modern-products-view-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--products-text-secondary, #6b7280);
    text-decoration: none !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--products-radius, 0.5rem);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.modern-products-view-more:hover {
    color: var(--products-text-primary, #111827);
    background: var(--products-bg-secondary, #f9fafb);
    border-color: var(--products-border, #e5e7eb);
}

.modern-products-view-more:active,
.modern-products-view-more:focus,
.modern-products-view-more:visited {
    color: var(--products-text-primary, #111827);
    text-decoration: none !important;
}

.modern-products-view-more i {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.modern-products-view-more:hover i {
    transform: translateX(2px);
}

.modern-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--product-spacing-md, 1rem);
    padding: 0 var(--product-spacing-md, 1rem);
}

/* Card de producto */
.modern-product-card {
    position: relative;
    background: var(--products-bg-primary);
    border-radius: var(--products-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--products-shadow);
    border: 1px solid var(--products-border);
    text-decoration: none !important;
    color: inherit;
    display: block;
    aspect-ratio: 1;
}

/* Estados del enlace - texto negro sin subrayado */
.modern-product-card:link,
.modern-product-card:visited,
.modern-product-card:hover,
.modern-product-card:active,
.modern-product-card:focus {
    text-decoration: none !important;
    color: inherit;
}

.modern-product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--products-shadow-lg);
    border-color: var(--products-primary);
}

.modern-product-image-wrapper {
    position: relative;
    width: 100%;
    height: 70%;
    overflow: hidden;
    background: var(--products-bg-secondary);
}

.modern-product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-product-card:hover .modern-product-image-wrapper img {
    transform: scale(1.1);
}

/* Overlay sutil en hover */
.modern-product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-product-card:hover .modern-product-overlay {
    opacity: 1;
}

/* Badge de "Nuevo" */
.modern-product-badge {
    position: absolute;
    top: var(--product-spacing-xs, 0.5rem);
    right: var(--product-spacing-xs, 0.5rem);
    background: var(--products-primary);
    color: #000;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(83, 252, 27, 0.3);
}

/* Información del producto */
.modern-product-info {
    padding: var(--product-spacing-sm, 0.75rem);
    height: 30%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--products-bg-primary);
}

.modern-product-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--products-text-secondary, #9ca3af); /* Gris claro por defecto */
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    transition: color 0.2s ease;
    text-decoration: none !important;
}

/* Texto negro cuando se selecciona/hace hover */
.modern-product-card:hover .modern-product-name,
.modern-product-card:active .modern-product-name,
.modern-product-card:focus .modern-product-name {
    color: var(--products-text-primary, #111827) !important; /* Negro cuando se selecciona */
    text-decoration: none !important;
}

/* Texto negro cuando está visitado (ya seleccionado) */
.modern-product-card:visited .modern-product-name {
    color: var(--products-text-primary, #111827) !important; /* Negro cuando está visitado */
    text-decoration: none !important;
}

/* Placeholder cuando no hay imagen */
.modern-product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--products-bg-secondary) 0%, var(--products-bg-primary) 100%);
    color: var(--products-text-secondary);
}

.modern-product-placeholder i {
    font-size: 3rem;
    opacity: 0.3;
}

/* Responsive */
@media (max-width: 1200px) {
    .modern-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 768px) {
    .modern-products-header {
        padding: 0 var(--product-spacing-sm, 0.75rem);
        margin-bottom: var(--product-spacing-md, 1rem);
    }
    
    .modern-products-title {
        font-size: 1.25rem;
    }
    
    .modern-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--product-spacing-sm, 0.75rem);
        padding: 0 var(--product-spacing-sm, 0.75rem);
    }
    
    .modern-product-info {
        padding: var(--product-spacing-xs, 0.5rem);
    }
    
    .modern-product-name {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .modern-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--product-spacing-xs, 0.5rem);
    }
    
    .modern-product-title {
        font-size: 1.125rem;
    }
}

/* Dark mode */
.dark-mode {
    --products-text-primary: #f9fafb;
    --products-text-secondary: #d1d5db;
    --products-bg-primary: #1f2937;
    --products-bg-secondary: #111827;
    --products-border: #374151;
}

.dark-mode .modern-product-card {
    background: var(--products-bg-primary);
    border-color: var(--products-border);
}

.dark-mode .modern-product-card:hover {
    border-color: var(--products-primary);
    box-shadow: 0 10px 25px rgba(83, 252, 27, 0.2);
}

.dark-mode .modern-product-info {
    background: var(--products-bg-primary);
}

.dark-mode .modern-product-placeholder {
    background: linear-gradient(135deg, var(--products-bg-secondary) 0%, var(--products-bg-primary) 100%);
}

/* Animación de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modern-product-card {
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.modern-product-card:nth-child(1) { animation-delay: 0.05s; }
.modern-product-card:nth-child(2) { animation-delay: 0.1s; }
.modern-product-card:nth-child(3) { animation-delay: 0.15s; }
.modern-product-card:nth-child(4) { animation-delay: 0.2s; }
.modern-product-card:nth-child(5) { animation-delay: 0.25s; }
.modern-product-card:nth-child(6) { animation-delay: 0.3s; }
.modern-product-card:nth-child(n+7) { animation-delay: 0.35s; }

