/* Módulo: productos (grid, cards, skeleton)
   Parcial asociado: resources/views/catalogo/partials/productos.blade.php
   JS relacionado: public/catalogo/js/productos.js, virtualizacion.js (mismas clases en HTML generado)
   Responsabilidad:
   - .producto-card, imagen, badges promo, título/descripcion/precio
   - cantidades, .btn-agregar, skeleton
   - @keyframes fadeUp (entrada cards)
*/
@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ESTILO DE IMÁGENES DE PRODUCTOS */
.producto-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100%;
    padding: 10px 10px 0;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.4s ease forwards;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.06),
        0 2px 4px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform;
}

.producto-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(
        120deg,
        rgba(198, 40, 40, 0.15),
        rgba(255, 255, 255, 0),
        rgba(198, 40, 40, 0.15)
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.producto-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 16px 32px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.06);
    border-color: rgba(198, 40, 40, 0.12);
}

.promo-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    border-radius: 999px;
    z-index: 10;
    overflow: hidden;
    text-transform: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    animation: floatBadge 4s ease-in-out infinite;
}

.promo-badge .shine {
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.1),
        rgba(255,255,255,0.6),
        rgba(255,255,255,0.1)
    );
    transform: skewX(-20deg);
    animation: shineMove 2.8s infinite;
}

@keyframes floatBadge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes shineMove {
    0% { left: -60%; }
    100% { left: 140%; }
}

.promo-amarillo {
    background: rgba(251, 191, 36, 0.9);
    color: #1f2937;
    border-color: rgba(255, 255, 255, 0.45);
}

.promo-azul {
    background: rgba(37, 99, 235, 0.88);
}

.promo-verde {
    background: rgba(22, 163, 74, 0.88);
}

.promo-naranja {
    background: rgba(249, 115, 22, 0.88);
}

.promo-morado {
    background: rgba(124, 58, 237, 0.88);
}

.promo-descuento {
    background: rgba(14, 165, 233, 0.88);
}

.promo-badge.promo {
    background: rgba(251, 191, 36, 0.9);
    color: #1f2937;
}

.promo-badge.oferta {
    background: rgba(22, 163, 74, 0.88);
}

.producto-card > img.card-img-top.producto-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    max-height: none;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    background-color: #fff;
    margin-bottom: 8px;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

.producto-card > img.card-img-top.producto-img.contain {
    object-fit: contain;
    padding: 6px;
}

.producto-card:hover > img.card-img-top.producto-img {
    transform: scale(1.05);
}

.producto-card .card-body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
    height: 100%;
    padding: 8px 12px 0;
    gap: 5px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}

.producto-card h6 {
    font-size: 13px;
    margin-bottom: 2px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    min-height: auto;
    letter-spacing: -0.15px;
    text-transform: none;
}

.producto-titulo {
    min-height: calc(1.3em * 2);
    max-height: calc(1.3em * 2);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.producto-card .descripcion {
    font-size: 11px;
    margin-bottom: 2px;
    line-height: 1.35;
    color: #666;
    min-height: calc(1.35em * 2);
    max-height: calc(1.35em * 2);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.descripcion--placeholder {
    visibility: hidden;
}

.producto-card .precio {
    font-size: 13px;
    margin-bottom: 4px;
    line-height: 1.1;
    font-weight: 700;
    color: var(--rojo);
    letter-spacing: -0.3px;
}

.producto-card .precio-convertido {
    font-size: 11px;
    line-height: 1.1;
    font-weight: 600;
    color: #5c6b7a;
    margin-bottom: 4px;
}

/* Selector de cantidad oculto en la ficha; siempre se muestra solo "Agregar" */
.producto-card .cantidad-container {
    display: none !important;
}

.btn-cantidad {
    background: transparent;
    color: #6b7280;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cantidad:hover {
    background: rgba(205, 2, 32, 0.08);
    color: #cd0220;
    transform: none;
}

.input-cantidad {
    width: 28px;
    height: 28px;
    text-align: center;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 700;
    background: transparent;
    color: #cd0220;
    box-sizing: border-box;
    box-shadow: none;
}

.input-cantidad:focus {
    outline: none;
    border-color: transparent;
}

.btn-agregar {
    background: var(--rojo);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    min-height: 44px;
    padding: 10px 8px;
    font-size: 0.9rem;
    transition: transform 0.3s ease, background 0.2s ease, box-shadow 0.3s ease;
    width: 100%;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    z-index: 0;
    box-shadow: 0 8px 16px rgba(211, 47, 47, 0.16);
}

.btn-agregar .btn-agregar-label {
    position: relative;
    z-index: 2;
}

.btn-agregar::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    top: 0;
    left: -100%;
    transition: left 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.btn-agregar:hover {
    background: var(--rojo-oscuro);
    box-shadow: 0 14px 24px rgba(183, 28, 28, 0.22);
}

.btn-agregar:hover::after {
    left: 100%;
}

.producto-card .btn-agregar {
    margin-top: 0;
    width: 100%;
    padding: 10px 8px;
    font-size: 13px;
}

/* Pie de tarjeta: botones a ancho completo pegados al borde inferior */
.producto-card__foot {
    margin-top: auto;
    margin-left: -12px;
    margin-right: -12px;
    width: calc(100% + 24px);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.producto-card__foot .btn-agregar {
    border-radius: 0 0 16px 16px;
    box-shadow: none;
    min-height: 46px;
}

.producto-card__foot .btn-mitad-pizza {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid rgba(205, 2, 32, 0.12);
    margin-top: 0;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    min-height: 40px;
    background: #fff;
    color: var(--rojo);
    border-color: rgba(205, 2, 32, 0.2);
}

.producto-card__foot .btn-mitad-pizza:hover,
.producto-card__foot .btn-mitad-pizza:focus,
.producto-card__foot .btn-mitad-pizza:focus-visible {
    color: var(--rojo);
    background: rgba(205, 2, 32, 0.06);
    border-color: rgba(205, 2, 32, 0.28);
    box-shadow: none;
}

.producto-card__foot .btn-mitad-pizza:active {
    color: #fff;
    background: var(--rojo);
    border-color: var(--rojo);
}

.producto-card:hover .btn-agregar {
    transform: none;
}

.producto-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px !important;
}

.producto-item > .producto-card {
    flex: 1;
}

@media (max-width: 576px) {
    .producto-card {
        padding: 9px 9px 0;
        border-radius: 12px;
    }

    .producto-card .card-body {
        padding: 8px 10px 0;
        gap: 4px;
    }

    .producto-card__foot {
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }

    .producto-card__foot .btn-agregar {
        border-radius: 0 0 12px 12px;
        min-height: 40px;
    }

    .btn-agregar {
        min-height: 40px;
        font-size: 0.9rem;
    }

    .producto-card h6 {
        font-size: 12px;
    }

    .producto-card .descripcion {
        font-size: 10px;
    }

    .producto-card .precio {
        font-size: 12px;
    }

    .producto-card .precio-convertido {
        font-size: 10px;
    }

    .producto-item {
        margin-bottom: 14px !important;
    }
}

/* Skeleton Loader */
.skeleton-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
    padding: 15px;
    overflow: hidden;
}

.skeleton {
    background: linear-gradient(90deg, #eee 25%, #f6f6f6 37%, #eee 63%);
    background-size: 400% 100%;
    animation: shimmer 1.2s ease infinite;
    border-radius: 12px;
}

.skeleton-img {
    width: 100%;
    aspect-ratio: 1 / 1.05;
    max-height: 180px;
    margin-bottom: 12px;
}

.skeleton-line {
    height: 14px;
    width: 90%;
    margin: 10px 0;
}

.skeleton-line.small {
    width: 70%;
    height: 12px;
}

.skeleton-btn {
    height: 36px;
    width: 100%;
    border-radius: 12px;
    margin-top: 12px;
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
