/* ═══════════════════════════════════════════════════════════
   FILE: assets/css/product-cards.css
   DESCRIPTION: Estilos tipo Mercado Libre para cards de productos
   APPROACH: Mobile-first responsive
   COLORS: WHT Brand (#1E3A8A, #3B82F6)
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   SKELETON SHIMMER ANIMATION
   ═══════════════════════════════════════════════════════════ */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-shimmer {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e8e8e8 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════
   PRODUCT GRID (MOBILE-FIRST)
   ═══════════════════════════════════════════════════════════ */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 12px;
}

/* 480px+ : 2 columnas */
@media (min-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;
    }
}

/* 768px+ : 3 columnas */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        padding: 0 24px;
    }
}

/* 1024px+ : 4 columnas */
@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
        padding: 0 32px;
        max-width: 1440px;
        margin: 0 auto;
    }
}

/* 1440px+ : 5 columnas */
@media (min-width: 1440px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════
   PRODUCT CARD (MERCADO LIBRE STYLE)
   ═══════════════════════════════════════════════════════════ */
.product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

.product-card:active {
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════
   CARD IMAGE SECTION
   ═══════════════════════════════════════════════════════════ */
.product-card .img {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fafafa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card .img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

/* Skeleton placeholder mientras carga la imagen */
.product-card .img-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            #f5f5f5 25%,
            #ebebeb 50%,
            #f5f5f5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card .img-skeleton svg {
    width: 48px;
    height: 48px;
    color: #ddd;
}

/* Placeholder cuando no hay imagen */
.product-card .img-placeholder,
.product-card .img-placeholder-mini,
.product-card .img-placeholder-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    color: #ccc;
}

/* Badge de envío gratis */
.product-card .badge-shipping {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #00a650;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Badge de descuento */
.product-card .badge-discount {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f23d4f;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   CARD BODY (INFO SECTION)
   ═══════════════════════════════════════════════════════════ */
.product-card .body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

@media (min-width: 768px) {
    .product-card .body {
        padding: 16px;
    }
}

/* Nombre del producto */
.product-card .name {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: #333;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
}

@media (min-width: 768px) {
    .product-card .name {
        font-size: 14px;
        min-height: 36px;
    }
}

/* Marca */
.product-card .brand {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   PRICE SECTION
   ═══════════════════════════════════════════════════════════ */
.product-card .price-row {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-card .price {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: #333;
    letter-spacing: -0.5px;
}

@media (min-width: 768px) {
    .product-card .price {
        font-size: 20px;
    }
}

/* Precio anterior (tachado) */
.product-card .price-original {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 2px;
}

/* Precio no disponible */
.product-card .price-unavailable {
    font-size: 13px;
    color: #1E3A8A;
    font-weight: 500;
}

/* Cuotas sin interés */
.product-card .installments {
    font-size: 12px;
    color: #00a650;
    margin-top: 4px;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   ADD TO CART BUTTON (EN CARDS)
   ═══════════════════════════════════════════════════════════ */
.product-card .btn-add-cart {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #1E3A8A;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.product-card .btn-add-cart:hover {
    background: #152a5e;
    transform: scale(1.1);
}

.product-card .btn-add-cart:active {
    transform: scale(0.95);
}

.product-card .btn-add-cart.adding {
    animation: pulse-add 0.4s ease;
}

@keyframes pulse-add {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ═══════════════════════════════════════════════════════════
   MINI CARD VARIANT
   ═══════════════════════════════════════════════════════════ */
.product-card.mini .img {
    aspect-ratio: 1 / 1;
}

.product-card.mini .body {
    padding: 8px;
}

.product-card.mini .name {
    font-size: 12px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    min-height: 32px;
}

.product-card.mini .price-mini {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

/* ═══════════════════════════════════════════════════════════
   LIST ITEM VARIANT
   ═══════════════════════════════════════════════════════════ */
.product-list-item {
    display: flex;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    padding: 12px;
    gap: 12px;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.product-list-item:hover {
    background: #fafafa;
    text-decoration: none;
}

.product-list-item .thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background: #f8f8f8;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-list-item .thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.product-list-item .meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-list-item .name {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-list-item .brand {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}

.product-list-item .price {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* ═══════════════════════════════════════════════════════════
   MODULE WRAPPERS (SIMPLIFICADOS)
   ═══════════════════════════════════════════════════════════ */
.module {
    grid-column: 1 / -1;
}

.module .inner {
    display: contents;
}

/* Ocultamos los módulos complejos en favor del grid simple */
.module--row4 .inner,
.module--row3 .inner,
.module--duo .inner,
.module--hero .inner,
.module--featstack .inner {
    display: contents;
}

.module--featstack .panel-feature,
.module--featstack .panel-stack {
    display: contents;
}

/* Grid para móvil en módulos 2up y list */
.module--2up,
.module--one,
.module--list2 {
    display: contents;
}

.module--quad4 {
    display: contents;
}

/* ═══════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════ */
.product-grid.loading::after {
    content: '';
    grid-column: 1 / -1;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   ERROR STATE
   ═══════════════════════════════════════════════════════════ */
.grid-error {
    grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════════════════════
   NO RESULTS
   ═══════════════════════════════════════════════════════════ */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-results svg {
    width: 64px;
    height: 64px;
    color: #ddd;
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 18px;
    margin: 0 0 8px;
    color: #333;
}

.no-results p {
    font-size: 14px;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE - Cards mantienen colores light
   ═══════════════════════════════════════════════════════════ */
html.dark .product-card,
html.dark .product-card .body,
html.dark .product-list-item {
    background: #fff;
    color: #333;
}

html.dark .product-card .name,
html.dark .product-list-item .name {
    color: #333;
}

html.dark .product-card .brand,
html.dark .product-list-item .brand {
    color: #999;
}

html.dark .product-card .price,
html.dark .product-card .price-mini,
html.dark .product-list-item .price {
    color: #333;
}

html.dark .product-card .price-unavailable {
    color: #1E3A8A;
}

html.dark .product-card .img,
html.dark .product-card .img-placeholder {
    background: #fafafa;
}