/* ==========================================
   GRID DE PRODUCTOS
========================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.products-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.products-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto 3rem;
}

/* ==========================================
   TARJETA DE PRODUCTO
========================================== */
.product-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 1.5rem;
    padding: 2rem 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    height: 100%;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(220, 38, 38, 0.05);
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(220, 38, 38, 0.08), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.product-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.product-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.03) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 1.2rem;
}

.product-card:hover::before {
    left: 100%;
    opacity: 1;
}

.product-card:hover::after {
    transform: scaleX(1);
}

.product-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 
        0 25px 50px rgba(220, 38, 38, 0.2),
        0 0 0 2px rgba(220, 38, 38, 0.1);
    border-color: var(--secondary);
}

/* ==========================================
   CONTENIDO DE LA TARJETA
========================================== */
.product-icon {
    width: 180px;
    height: 180px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border: 3px solid transparent;
    box-shadow: 
        0 12px 35px rgba(220, 38, 38, 0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.product-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.product-card:hover .product-icon {
    transform: scale(1.05);
    background: linear-gradient(135deg, #FFF5F5 0%, #FEE2E2 100%);
    border-color: var(--secondary);
    box-shadow: 
        0 15px 35px rgba(220, 38, 38, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.product-card:hover .product-icon img {
    transform: scale(1.1);
}

.product-icon i {
    font-size: 3.5rem;
    color: var(--secondary);
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.2));
}

.product-card:hover .product-icon i {
    color: var(--secondary);
    filter: drop-shadow(0 3px 6px rgba(220, 38, 38, 0.3));
    transform: scale(1.15);
}

.product-name {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0;
    color: var(--text);
    line-height: 1.2;
    transition: all 0.3s ease;
    letter-spacing: -0.3px;
    order: -1;
}

.product-card:hover .product-name {
    color: var(--secondary);
}

.product-desc {
    color: var(--text-light);
    text-align: center;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    max-width: 260px;
}

.product-btn {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 100%;
    max-width: 200px;
    margin-top: auto;
    box-shadow: 
        0 6px 20px rgba(220, 38, 38, 0.3),
        0 0 0 2px rgba(220, 38, 38, 0.1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.product-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.product-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 10px 25px rgba(220, 38, 38, 0.4),
        0 0 0 3px rgba(220, 38, 38, 0.2);
}

.product-btn:hover::before {
    left: 100%;
}

.product-btn:active {
    transform: translateY(-1px);
}

.product-btn i {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.product-btn:hover i {
    transform: translateX(4px);
}

/* ==========================================
   VARIANTES DE ICONOS
========================================== */
.icon-red {
    background-color: #FEE2E2;
}

.icon-red i {
    color: #DC2626;
}

.icon-blue {
    background-color: #DBEAFE;
}

.icon-blue i {
    color: #2563EB;
}

.icon-purple {
    background-color: #F3E8FF;
}

.icon-purple i {
    color: #9333EA;
}

.icon-orange {
    background-color: #FFEDD5;
}

.icon-orange i {
    color: #EA580C;
}

.icon-yellow {
    background-color: #FEF3C7;
}

.icon-yellow i {
    color: #D97706;
}

.icon-green {
    background-color: #D1FAE5;
}

.icon-green i {
    color: #059669;
}

.icon-gray {
    background-color: #F3F4F6;
}

.icon-gray i {
    color: #6B7280;
}

/* ==========================================
   RESPONSIVE - TABLET
========================================== */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .products-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .products-grid,
    .products-grid-3,
    .products-grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .product-card {
        padding: 1.25rem 1rem;
    }
    
    .product-icon {
        width: 120px;
        height: 120px;
        margin: 1rem 0;
        border-radius: 16px;
    }
    
    .product-icon i {
        font-size: 2.5rem;
    }
    
    .product-name {
        font-size: 1.1rem;
        letter-spacing: -0.5px;
    }
    
    .product-desc {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 1rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .product-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        max-width: none;
        width: 100%;
    }
}

/* ==========================================
   GRID DE 4 COLUMNAS
========================================== */
.products-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    width: 100%;
}

/* ==========================================
   MARCO DE CATEGORÍA
========================================== */
.category-wrapper {
    width: 100%;
}

.category-frame {
    background: var(--white);
    border: 3px solid var(--secondary);
    border-radius: 1.5rem;
    padding: 2.5rem 2rem 2rem;
    position: relative;
    box-shadow: 0 8px 30px rgba(220, 38, 38, 0.15);
}

.category-frame-header {
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    padding: 0.75rem 2.5rem;
    border-radius: 9999px;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    z-index: 10;
}

.category-frame-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--white);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-frame-description {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    line-height: 1.6;
}

/* ==========================================
   RESPONSIVE - TABLET
========================================== */
@media (max-width: 1100px) {
    .products-grid-4 {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    /* Botones más compactos en tablet de 3 columnas */
    .product-variants {
        gap: 0.4rem;
    }
    
    .variant-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        min-width: 45px;
    }
    
    .product-card-variants {
        padding: 1.25rem 0.75rem;
    }
    
    .product-card-variants .product-name {
        font-size: 0.95rem;
    }
}

@media (max-width: 900px) {
    .products-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .category-frame {
        padding: 2rem 1.5rem 1.5rem;
    }
    
    .category-frame-title {
        font-size: 1rem;
    }
    
    /* Botones en 2 columnas para tablet */
    .product-variants {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
}

/* ==========================================
   TARJETAS CON VARIANTES
========================================== */
.product-card-variants {
    padding: 1.5rem 1rem;
    border: 2px solid var(--border);
    background: var(--white);
}

.product-card-variants .product-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
    text-align: center;
    order: -1;
}

.product-image-container {
    width: 100%;
    aspect-ratio: 4/3;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e5e7eb;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.product-icon-fallback {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-icon-fallback i {
    font-size: 3rem;
}

.product-variants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.variant-btn {
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    color: #4b5563;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
    text-align: center;
}

.variant-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    transform: translateY(-2px);
}

.variant-btn.active {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    border-color: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.variant-btn.active:hover {
    background: linear-gradient(135deg, var(--secondary-dark) 0%, #991b1b 100%);
}

/* ==========================================
   RESPONSIVE - MÓVIL
========================================== */
@media (max-width: 640px) {
    .products-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .category-frame {
        padding: 1.5rem 0.5rem 0.75rem;
        border-width: 2px;
        border-radius: 1rem;
    }
    
    .category-frame-header {
        padding: 0.4rem 1rem;
        top: -1rem;
    }
    
    .category-frame-title {
        font-size: 0.75rem;
        letter-spacing: 0.3px;
    }
    
    .category-frame-description {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
        margin-top: 0.25rem;
    }
    
    /* Botones de variantes más compactos en móvil */
    .product-variants {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
        margin-bottom: 0.5rem;
        padding: 0;
    }
    
    .variant-btn {
        padding: 0.2rem 0.25rem;
        font-size: 0.55rem;
        min-width: auto;
        border-radius: 4px;
        border-width: 1px;
        font-weight: 600;
    }
    
    /* Imagen más compacta en móvil */
    .product-image-container {
        aspect-ratio: 1/1;
        margin-bottom: 0.4rem;
    }
    
    .product-card-variants {
        padding: 0.5rem 0.4rem;
    }
    
    .product-card-variants .product-name {
        font-size: 0.75rem;
        margin-bottom: 0.35rem;
    }
    
    .product-desc {
        font-size: 0.65rem;
        margin-bottom: 0.35rem;
        line-clamp: 2;
        -webkit-line-clamp: 2;
    }
    
    .product-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.65rem;
    }
}

/* ==========================================
   RESPONSIVE - MÓVIL PEQUEÑO
========================================== */
@media (max-width: 360px) {
    .products-grid,
    .products-grid-3,
    .products-grid-2,
    .products-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .product-card {
        padding: 0.5rem 0.4rem;
    }
    
    .product-card-variants {
        padding: 0.5rem 0.4rem;
    }
    
    .product-card-variants .product-name {
        font-size: 0.75rem;
        margin-bottom: 0.35rem;
    }
    
    .product-image-container {
        aspect-ratio: 1/1;
        margin-bottom: 0.4rem;
    }
    
    .product-icon {
        width: 70px;
        height: 70px;
        margin: 0.25rem 0;
    }
    
    .product-name {
        font-size: 0.8rem;
    }
    
    .product-desc {
        font-size: 0.65rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 0.4rem;
    }
    
    .product-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.65rem;
    }
    
    /* Botones ultra compactos en móvil pequeño */
    .product-variants {
        gap: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    .variant-btn {
        padding: 0.2rem 0.25rem;
        font-size: 0.55rem;
        min-width: auto;
        border-radius: 4px;
        font-weight: 600;
    }
}