/* Tarjetas de producto: CardProducto y CardProductoPromocion (y, mas abajo,
   CardProductoListResponsive e IconoStock).

   Vivia en un <style> DENTRO de cada componente, asi que se repetia una vez por
   tarjeta: 36 copias de 8 KB en la home (~300 KB de los ~780 KB del HTML), y viajaba
   tambien en cada render batch del circuito. Un <style> en un componente es global de
   todos modos: este archivo conserva los mismos selectores y especificidad.

   Fuera de wwwroot/css/*.css a proposito: el bundler solo toma ese nivel (no
   subcarpetas), y site.min.css se carga diferido (media=print); este va bloqueante
   para que la tarjeta no pinte sin estilos. Se enlaza en App.razor DESPUES de
   bootstrap.min.css: .card-body existe en los dos y aqui tiene que ganar, igual que
   ganaba el <style> inline que venia mas abajo en el documento.

   El distintivo BIG TURBO de CardProductoPromocion es .card-bigturbo-compacto (mismos
   valores que tenia su propio .card-bigturbo, que chocaba con el de CardProducto en
   PromocionDetalle, donde conviven las dos tarjetas).

   Subir el ?v= de App.razor en cada cambio. */

.card-producto {
    position: relative;
    max-width: 350px;
    min-height: 516px;
    margin: auto;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Contorno: el borde define la tarjeta, la sombra solo la separa del fondo.
       Antes solo habia sombra (.08) y sobre blanco casi no se distinguia el limite. */
    border: 1px solid var(--ba-border, #dee2e6);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
/* Hover solo con cursor: en tactil quedaba "pegado" tras el toque. El foco cuenta solo
   si es de teclado (:focus-visible): con :focus-within, tocar "Agregar al carrito"
   dejaba la tarjeta levantada hasta tocar otra cosa. En tactil responde :active. */
@media (hover: hover) {
    .card-producto:hover {
        border-color: #aab2bb;
        box-shadow: 0 10px 24px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
        transform: translateY(-4px);
    }
}
.card-producto:has(:focus-visible) {
    border-color: #aab2bb;
    box-shadow: 0 10px 24px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
    transform: translateY(-4px);
}
.card-producto:active {
    border-color: #aab2bb;
    box-shadow: 0 8px 18px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .08);
    transform: translateY(-2px);
    transition-duration: .12s;
}
@media (prefers-reduced-motion: reduce) {
    .card-producto { transition: none; }
    .card-producto:hover,
    .card-producto:has(:focus-visible),
    .card-producto:active { transform: none; }
}

.card-img-link {
    display: block;
    width: 100%;
}
/* Esqueleto de carga. El brillo se anima con transform sobre un pseudo-elemento,
   que el navegador compone en GPU. Antes se animaba background-position: no es una
   propiedad compuesta, asi que cada tarjeta repintaba en cada frame mientras su foto
   no cargaba -- Lighthouse contaba 26 "animaciones no compuestas" en la home, y las
   tarjetas lazy fuera de pantalla seguian repintando sin fin. */
.card-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #eceff1;
}
.card-img-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .65) 50%, rgba(255, 255, 255, 0) 100%);
    transform: translateX(-100%);
    animation: card-shimmer 1.4s ease-in-out infinite;
    pointer-events: none;
}
@keyframes card-shimmer {
    100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
    .card-img-wrapper::before { animation: none; }
}
.card-img-wrapper .img-fluid {
    width: 100%; height: 100%; max-height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity .4s ease-in;
}
.card-img-wrapper .img-fluid.loaded { opacity: 1; }
.card-img-wrapper.loaded { background-color: transparent; }
.card-img-wrapper.loaded::before { content: none; animation: none; }

.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 0; flex: 1; }

/* ---- Distintivo BIG TURBO ----
   Antes: pegado al borde izquierdo (left:0), sin padding, con el logo a un
   porcentaje del ancho (max-width:22%) -- asi el icono cambiaba de tamano
   segun la tarjeta y el texto a peso 900 en rojo competia con el precio,
   que es el dato que debe ganar en la tarjeta.
   Ahora: pastilla despegada del borde, logo en tamano FIJO (no porcentual),
   texto alineado a la izquierda y jerarquia interna -- "Recogelo al
   instante" manda y el resto es apoyo en un gris legible. */
.card-bigturbo {
    position: absolute;
    top: 8px; left: 8px; right: 8px; z-index: 2;
    background: #fff;
    border: 1px solid #F3C7CE;
    border-left: 3px solid var(--ba-red, #c41230);
    border-radius: 10px;
    padding: 6px 10px 6px 8px;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .10);
}
/* Tamano fijo: el 22% anterior encogia el logo en tarjetas estrechas hasta
   volverlo ilegible, y lo inflaba en las anchas. */
.card-bigturbo svg { width: 46px; height: auto; flex: none; }

/* Variante compacta (modo administracion): mismos valores que el distintivo
   de CardProductoPromocion -- solo el logo, sin caja ni texto. */
.card-bigturbo-compacto {
    right: auto;
    width: 64px;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    justify-content: center;
}
/* El viewBox es 468.07 x 236.77 (~1.98:1); sin esto el SVG cae al alto
   intrinseco por defecto (150px) y el badge se ve recortado/deforme. */
.card-bigturbo-compacto svg {
    width: 100%;
    height: auto;
    aspect-ratio: 468.07 / 236.77;
    flex-shrink: 0;
    display: block;
}
.card-bigturbo svg path, .card-bigturbo svg rect { fill: var(--ba-red, #c41230) !important; }
.card-bigturbo svg .bt-turbo path { fill: #000 !important; }
.card-bigturbo-text {
    font-weight: 700; font-size: 0.6875rem; line-height: 1.25;
    color: #5A6472; text-align: left; text-wrap: balance;
    min-width: 0;
}
/* La promesa de inmediatez es lo unico que se lee de un vistazo. */
.card-bigturbo-text strong {
    display: block;
    font-weight: 800; font-size: 0.75rem;
    color: var(--ba-red, #c41230);
}

.card-disp {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.75rem; font-weight: 600; line-height: 1.3; margin-top: 2px;
}
.card-disp-no { font-weight: 600; }

.card-promo-tag {
    display: inline-block;
    background: #049a3b; color: #fff;
    font-size: 0.75rem; font-weight: 600; line-height: 1.3;
    padding: 2px 8px; border-radius: 4px;
    margin: 2px 0 4px;
    width: fit-content;
}
.card-promo-tag-blue {
    background: #0669f9;
}

.card-titulo {
    font-size: var(--ba-text-lg,1.25rem)!important; font-weight: 600; line-height: 1.3;
    display: block; overflow: hidden; margin: 0;
    text-align: left;
    white-space: nowrap; text-overflow: ellipsis;
    color: var(--ba-text, #212121)!important;
}
.card-titulo a, .card-titulo a b, .card-titulo b {
    color: var(--ba-text, #212121) !important;
    display: block; max-width: 100%;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}

.card-sku-wrap { display: flex; justify-content: space-between; gap: .5rem; align-items: center; min-height: 50px; }
.card-sku { font-size: 0.875rem; font-weight: 400; line-height: 1.4; color: #666; margin: 0;
            overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-sku b { font-weight: 500; color: #444; }
/* --ba-text-muted (5.2:1): el #888 anterior daba 3.5:1, por debajo de AA. */
.card-sku-label { color: var(--ba-text-muted, #6B6E6E); font-weight: 400; }
.card-marca-logo { width: 100px; height: 50px; object-fit: contain; object-position: right center; flex-shrink: 0; }

.card-marca { font-size: 0.875rem; font-weight: 400; line-height: 1.4; color: var(--ba-text-muted, #6B6E6E); margin: 0; }
.card-marca b { font-weight: 500; }

/* Existencias por sucursal: solo las pinta CardProductoPromocion. */
.card-stock-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin-top: 6px;
}
.card-stock-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8125rem;
    line-height: 1.3;
    color: var(--ba-text-muted, #666);
    white-space: nowrap;
}
.card-stock-item img { width: 16px; height: 20px; object-fit: contain; flex-shrink: 0; }
.card-stock-item.is-empty img { filter: grayscale(100%); opacity: .5; }
.card-stock-item b { font-weight: 700; color: var(--ba-text, #212121); }
.card-stock-item.is-empty b { color: var(--ba-text-muted, #666); }

.card-precio-wrap { margin-top: auto; padding-top: 6px; display: flex; justify-content: flex-start; gap: .5rem; align-items: baseline; }
.card-precio-actual {
    color: var(--ba-text); font-size: var(--ba-text-xl); font-weight: 700;
    line-height: 1.1;
}
.card-precio-actual--promo { color: var(--ba-text); font-size: var(--ba-text-xl); }
.card-precio-original {
    color: var(--ba-text-muted); text-decoration: line-through;
    font-size: 0.875rem; font-weight: 900; line-height: 1.4;
}

.card-cta {
    display: inline-flex; align-items: center; justify-content: center; width: 100%; margin-top: 10px;
    background-color: rgba(33, 59, 120, 1) !important;
    color: #fff !important; text-align: center;
    font-weight: 600; font-size: 1rem; line-height: 1.5;
    border: none; border-radius: 6px; padding: 10px 0;
    cursor: pointer; transition: background .2s, box-shadow .2s;
    text-decoration: none;
}
.card-cta:hover {
    background-color: rgba(46, 81, 165, 1) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.card-cta:disabled {
    opacity: .45; cursor: not-allowed;
    box-shadow: none;
}

/* CTA del modo administracion (catalogo del home page). Mismo cuerpo que
   .card-cta: solo cambia el color, porque es una accion destructiva. */
.card-cta-quitar { background-color: #E50E20 !important; }
.card-cta-quitar:hover { background-color: #c00c1c !important; }

.card-ver-detalle {
    display: block; text-align: center;
    font-size: 0.875rem; font-weight: 400; line-height: 1.4;
    color: #0669f9;
    text-decoration: underline !important; margin-top: 6px;
    transition: color .15s;
    font-weight:700;
}
.card-ver-detalle:hover { color: #044bb5; }

@media screen and (max-width: 950px) {
    .card-producto { min-height: 430px; }
}

/* =====================================================================
   Tarjeta en fila: CardProductoListResponsive (catalogo, aplicaciones,
   favoritos). Su layout vive en CardProductoListResponsive.razor.css (prefijo
   pcard-). Aqui solo quedan las piezas de la imagen que no dependen del
   layout: overlay y badge "NO DISPONIBLE" (el badge tambien lo usa la ficha)
   y el fundido de carga.
   ===================================================================== */
.overlay-no-disponible {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    z-index: 1;
    pointer-events: none;
}
.badge-no-disponible {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #616161cc;
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}
.badge-bigturbo{
    justify-content: left !important;
}
.img-low-opacity { opacity: 0.7; filter: grayscale(100%); }
@media screen and (max-width: 1024px) {
    .badge-bigturbo{
        justify-content: center !important;
    }
}

.img-producto-fade { opacity: 0; transition: opacity 0.3s ease; }
.img-producto-fade.loaded { opacity: 1; }


/* IconoStock (stock en tienda / en linea): lo usan la ficha, las tarjetas y el
   carrito. Antes un <style> dentro del componente, repetido por icono. */
.icono-stock { display: inline-block; flex: none; vertical-align: middle; color: var(--ba-primary, #1b408e); }
.icono-stock.is-agotado { color: var(--ba-text-muted, #6b6e6e); opacity: .6; }
