/* ============================================================================
   V4.18 INTEGRAL · CSS premium para Home
   ============================================================================
   Cargar al final del _Host.cshtml para que sobrescriba a v416/v417.
   Cambios:
     [1] Saludo premium con greeting card animada
     [2] Hero NUEVA VENTA + CONSULTAR PRECIO hermanados, mismo language visual
     [3] Animaciones de entrada (fadeUp + stagger)
     [4] Mejoras al stock list (header sticky, contador "X de Y total")
   ============================================================================ */


/* =====================================================================
   [1] SALUDO PREMIUM
   ===================================================================== */

/* Wrapper greeting card — gradient sutil + glassmorphism */
.home-head {
    margin: 6px 0 22px 0 !important;
    animation: v418FadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hh-saludo {
    display: flex !important;
    align-items: center;
    gap: 18px !important;
    padding: 18px 24px !important;
    border-radius: 20px;
    background:
        radial-gradient(circle at 0% 0%, rgba(245, 166, 35, 0.10) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(62, 207, 142, 0.07) 0%, transparent 50%),
        linear-gradient(135deg, rgba(28, 32, 44, 0.88), rgba(20, 23, 31, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.30);
    position: relative;
    overflow: hidden;
}

/* Sweep de luz sobre el saludo (anima 1 vez al entrar) */
.hh-saludo::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.07) 50%,
        transparent 70%);
    animation: v418Sweep 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s 1 forwards;
    pointer-events: none;
}

.hh-emoji {
    font-size: 42px !important;
    filter: drop-shadow(0 4px 14px rgba(245, 166, 35, 0.45));
    animation: v418Wave 2.4s ease-in-out infinite;
    transform-origin: 70% 70%;
    position: relative;
    z-index: 1;
}

.hh-titulo {
    font-size: 24px !important;
    font-weight: 900 !important;
    background: linear-gradient(90deg, #fff 0%, #fde68a 50%, #f5a623 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent !important;
    letter-spacing: 0.01em;
    line-height: 1.1;
    position: relative;
    z-index: 1;
}

.hh-sub {
    font-size: 13px !important;
    color: #9aa5b4 !important;
    margin-top: 4px !important;
    font-weight: 500;
    position: relative;
    z-index: 1;
}


/* =====================================================================
   [2] HERO DUO premium — NUEVA VENTA + CONSULTAR PRECIO hermanados
   ===================================================================== */

.home-shell .hero-duo {
    display: grid !important;
    grid-template-columns: 1.15fr 1fr !important;
    gap: 14px !important;
    margin: 0 0 16px 0 !important;
    animation: v418FadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

@media (max-width: 760px) {
    .home-shell .hero-duo {
        grid-template-columns: 1fr !important;
    }
}

/* Card base unificada (ambas) */
.home-shell .hero-card,
.home-shell .hero-duo .cp-trigger {
    all: unset;
    box-sizing: border-box;
    position: relative;
    display: grid;
    grid-template-columns: 64px 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 18px;
    row-gap: 2px;
    grid-template-areas:
        "ico txt arrow"
        "ico sub arrow";
    align-items: center;
    padding: 22px 26px;
    border-radius: 18px;
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    min-height: 116px;
    transition:
        transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    isolation: isolate;
    will-change: transform;
    user-select: none;
}

.home-shell .hero-card:focus-visible,
.home-shell .hero-duo .cp-trigger:focus-visible {
    outline: 2px solid rgba(245, 166, 35, 0.55);
    outline-offset: 3px;
}

/* === NUEVA VENTA · gradient verde con mesh animado === */
.home-shell .hero-venta {
    background:
        radial-gradient(circle at 18% 82%, rgba(255, 255, 255, 0.18) 0%, transparent 38%),
        radial-gradient(circle at 82% 22%, rgba(255, 234, 128, 0.16) 0%, transparent 32%),
        linear-gradient(135deg, #14532d 0%, #15803d 35%, #16a34a 70%, #22c55e 100%) !important;
    background-size: 100% 100%, 100% 100%, 220% 220% !important;
    animation: v418MeshShift 14s ease-in-out infinite;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 10px 28px rgba(20, 83, 45, 0.42),
        0 2px 6px rgba(0, 0, 0, 0.20);
}

/* === CONSULTAR PRECIO · gradient azul con mesh desfasado === */
.home-shell .hero-duo .cp-trigger {
    background:
        radial-gradient(circle at 18% 82%, rgba(255, 255, 255, 0.16) 0%, transparent 38%),
        radial-gradient(circle at 82% 22%, rgba(165, 180, 255, 0.18) 0%, transparent 32%),
        linear-gradient(135deg, #1e3a8a 0%, #2563eb 35%, #3b82f6 70%, #60a5fa 100%) !important;
    background-size: 100% 100%, 100% 100%, 220% 220% !important;
    animation: v418MeshShift 14s ease-in-out infinite;
    animation-delay: -5s !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 10px 28px rgba(30, 58, 138, 0.42),
        0 2px 6px rgba(0, 0, 0, 0.20);
}

/* Hover compartido */
.home-shell .hero-card:hover,
.home-shell .hero-duo .cp-trigger:hover {
    transform: translateY(-3px) scale(1.005);
    filter: brightness(1.08);
}

.home-shell .hero-venta:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 16px 38px rgba(20, 83, 45, 0.55),
        0 4px 10px rgba(0, 0, 0, 0.25);
}

.home-shell .hero-duo .cp-trigger:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 16px 38px rgba(30, 58, 138, 0.55),
        0 4px 10px rgba(0, 0, 0, 0.25);
}

/* Active (click) */
.home-shell .hero-card:active,
.home-shell .hero-duo .cp-trigger:active {
    transform: translateY(-1px) scale(0.998);
    transition-duration: 0.1s;
}

/* Sweep de luz sutil sobre los heros (loop lento) */
.home-shell .hero-card::after,
.home-shell .hero-duo .cp-trigger::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.10) 50%,
        transparent 70%);
    transform: translateX(-100%);
    animation: v418HeroSweep 6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
    pointer-events: none;
}

.home-shell .hero-duo .cp-trigger::after {
    animation-delay: -3s;
}

/* Iconos con backdrop suave + shadow */
.home-shell .hero-card .hero-ico,
.home-shell .hero-duo .cp-trigger .cp-trigger-ico {
    grid-area: ico;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px !important;
    color: #fff;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.20),
        0 4px 14px rgba(0, 0, 0, 0.18);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-shell .hero-card:hover .hero-ico,
.home-shell .hero-duo .cp-trigger:hover .cp-trigger-ico {
    transform: scale(1.06) rotate(-3deg);
}

/* Textos */
.home-shell .hero-card .hero-text,
.home-shell .hero-duo .cp-trigger .cp-trigger-txt {
    grid-area: txt;
    font-size: 22px !important;
    font-weight: 900 !important;
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.home-shell .hero-card .hero-h1 {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1.1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.home-shell .hero-card .hero-h2,
.home-shell .hero-duo .cp-trigger .cp-trigger-sub {
    grid-area: sub;
    font-size: 13px !important;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.86) !important;
    letter-spacing: 0.005em;
    line-height: 1.3;
    margin-top: 2px;
}

/* Flecha animada hover */
.home-shell .hero-card .hero-arrow {
    grid-area: arrow;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.85);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-shell .hero-card:hover .hero-arrow {
    transform: translateX(6px);
    color: #fff;
}

/* Si CONSULTAR PRECIO no tiene flecha propia, le agregamos una */
.home-shell .hero-duo .cp-trigger::before {
    content: "→";
    grid-area: arrow;
    font-size: 28px;
    color: rgba(255, 255, 255, 0.85);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: right;
}

.home-shell .hero-duo .cp-trigger:hover::before {
    transform: translateX(6px);
    color: #fff;
}


/* =====================================================================
   [3] HERO MANOLIN IA · igualar lenguaje visual al duo
   ===================================================================== */

.home-shell .hero-manolin-ia {
    border-radius: 18px !important;
    padding: 22px 26px !important;
    margin: 0 0 16px 0 !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 10px 28px rgba(124, 58, 237, 0.42),
        0 2px 6px rgba(0, 0, 0, 0.20) !important;
    transition:
        transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    position: relative;
    isolation: isolate;
    animation: v418FadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
}

.home-shell .hero-manolin-ia:hover {
    transform: translateY(-3px) scale(1.005);
    filter: brightness(1.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 16px 38px rgba(124, 58, 237, 0.55),
        0 4px 10px rgba(0, 0, 0, 0.25) !important;
}


/* =====================================================================
   [4] STOCK · contador real visible + mejoras
   ===================================================================== */

.stk-contador {
    background: linear-gradient(135deg, rgba(62, 207, 142, 0.10), rgba(62, 207, 142, 0.04)) !important;
    border-color: rgba(62, 207, 142, 0.25) !important;
    font-weight: 600;
    padding: 8px 14px !important;
}

/* Aviso "se mostraron N de Y total" cuando hay paginación visible */
.stk-cap-aviso {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.30);
    border-radius: 8px;
    color: #fde68a;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 600;
}

.stk-summary b { color: #fff; }


/* =====================================================================
   [5] ANIMACIONES
   ===================================================================== */

@keyframes v418FadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes v418Sweep {
    0%   { left: -100%; }
    100% { left: 100%; }
}

@keyframes v418HeroSweep {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(100%); }
    100% { transform: translateX(100%); }
}

@keyframes v418MeshShift {
    0%, 100% { background-position: 0% 0%, 100% 100%, 0% 50%; }
    50%      { background-position: 100% 100%, 0% 0%, 100% 50%; }
}

@keyframes v418Wave {
    0%, 60%, 100% { transform: rotate(0deg); }
    10%           { transform: rotate(14deg); }
    20%           { transform: rotate(-8deg); }
    30%           { transform: rotate(14deg); }
    40%           { transform: rotate(-4deg); }
    50%           { transform: rotate(10deg); }
}

/* Reducir movimiento si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
    .hh-emoji,
    .home-shell .hero-card,
    .home-shell .hero-duo .cp-trigger,
    .home-shell .hero-card::after,
    .home-shell .hero-duo .cp-trigger::after,
    .hh-saludo::before {
        animation: none !important;
    }
    .home-shell .hero-card:hover,
    .home-shell .hero-duo .cp-trigger:hover {
        transform: none !important;
    }
}
