/*
 * 📱 live-layout 2.0.0 — the /live page frame, the owner's design "/live — página del cliente"
 * (2026-12-03): LIGHT page (#F4F4F6), white cards, Barlow + Barlow Condensed, red = "¡cómpralo ya!".
 * Replaces live-layout_1-0-0.css (kept on disk for a rollback: switch the list in src/Http/Pages.php).
 *
 * ▸ Mobile first (360–430 px). Desktop (≥ 900 px): ① + ② left, ③ right.
 * ▸ Heavy specificity: every rule starts with #cshow-live.cs-screen.
 * ▸ CSP: no inline styles; fonts are local (assets/fonts, SIL OFL).
 */

/* ---------------------------------------------------------------- fonts (local, font-src 'self') */

@font-face { font-family: "cs-barlow"; src: url("../../fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "cs-barlow"; src: url("../../fonts/barlow-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "cs-barlow"; src: url("../../fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "cs-barlow"; src: url("../../fonts/barlow-700.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "cs-barlow-cond"; src: url("../../fonts/barlow-condensed-700.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "cs-barlow-cond"; src: url("../../fonts/barlow-condensed-800.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }

/* ---------------------------------------------------------------- colors (one job each) */

#cshow-live.cs-screen.cs-live {
    --lv-bg: #F4F4F6;
    --lv-card: #FFFFFF;
    --lv-soft: #FAFAFB;
    --lv-line: #E6E6EA;
    --lv-line-2: #ECECF1;
    --lv-ink: #141416;          /* text, VENDIDO, the black boxes */
    --lv-ink-2: #3A3A42;
    --lv-dim: #5B5B66;          /* second text */
    --lv-mute: #8B8B96;
    --lv-red: #E00B0A;          /* ONLY "buy now": ¡LO QUIERO!, live price, QUEDAN */
    --lv-red-2: #C40908;
    --lv-red-hi: #FF2E2D;
    --lv-pink: #FF2D55;         /* EN VIVO pill */
    --lv-yellow: #FFC21A;       /* ⚡ flash deals */
    --lv-green: #047857;        /* Ahorras · sold toast · paid */
    --lv-green-bg: #ECFDF5;
    --lv-green-line: #A7F3D0;
    --lv-used: #B45309;         /* Estado not "Nuevo" (amber: read it before buying) */
    --lv-used-bg: #FFF7E6;
    --lv-used-line: #F5C77E;
    --lv-font: "cs-barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --lv-cond: "cs-barlow-cond", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;

    max-width: 560px;
    margin: 0 auto;
    padding: 0 0 calc(24px + env(safe-area-inset-bottom));
    background: var(--lv-bg);
    color: var(--lv-ink);
    font-family: var(--lv-font);
    font-size: 16px;
}

/* the page behind the 560 px column is light too (base css paints html/body black) */
html:has(#cshow-live.cs-live),
html:has(#cshow-live.cs-live) body { background: #F4F4F6; }

#cshow-live.cs-screen.cs-live.has-buybar {
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

#cshow-live.cs-screen [hidden] {
    display: none !important;
}

#cshow-live.cs-screen.cs-live a { color: #B30908; }
#cshow-live.cs-screen.cs-live a:hover { color: #7A0605; }

/* ---------------------------------------------------------------- header (scrolls away) */

#cshow-live.cs-screen .cs-lv-head {
    padding: 10px 16px;
    background: var(--lv-card);
    border-bottom: 1px solid var(--lv-line);
}

#cshow-live.cs-screen .cs-lv-head .cs-lv-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* the logo: the white CrazyStore logo in a black square */
#cshow-live.cs-screen .cs-lv-head .cs-lv-logo {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--lv-ink) url("../../img/escenario/logo-blanco.webp") center / 80% auto no-repeat;
}

#cshow-live.cs-screen .cs-lv-head .cs-lv-head-txt {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

#cshow-live.cs-screen .cs-lv-head .cs-lv-title {
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 👁 "214 viendo" — only above 20 people (Q12 · task 7.1) */
#cshow-live.cs-screen .cs-lv-head .cs-lv-viewers {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    color: var(--lv-dim);
    font-size: 12px;
    font-weight: 600;
}

/* an eye drawn in CSS */
#cshow-live.cs-screen .cs-lv-eye {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 9px;
    border: 1.8px solid currentColor;
    border-radius: 70% 0;
    transform: rotate(45deg) scale(0.8);
}

#cshow-live.cs-screen .cs-lv-eye::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    border-radius: 50%;
    background: currentColor;
}

/* EN VIVO: pink-red pill, a light sweep + a ping on the dot */
#cshow-live.cs-screen .cs-lv-onair {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    padding: 5px 10px 5px 9px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--lv-pink) 0%, var(--lv-red) 55%, #FF4D2E 100%);
    color: #FFFFFF;
    font-family: var(--lv-cond);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(255, 45, 85, 0.40);
    animation: cs-lv-glow 1.6s ease-in-out infinite;
}

#cshow-live.cs-screen .cs-lv-onair::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 45%;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-20deg);
    animation: cs-lv-sweep 2.8s ease-in-out infinite;
}

#cshow-live.cs-screen .cs-lv-dot {
    position: relative;
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FFFFFF;
}

#cshow-live.cs-screen .cs-lv-onair .cs-lv-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #FFFFFF;
    animation: cs-lv-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

#cshow-live.cs-screen .cs-lv-head .cs-lv-testtag {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: #FF7A1A;
    color: #000000;
    font-size: 12px;
    font-weight: 800;
}

#cshow-live.cs-screen .cs-lv-head .cs-lv-loading {
    padding: 40vh 0 0;
    color: var(--lv-dim);
    text-align: center;
}

#cshow-live.cs-screen .cs-lv-head .cs-lv-loading .cs-lv-dot { background: var(--lv-red); animation: cs-lv-blink 1.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- sticky shortcut bar */

#cshow-live.cs-screen .cs-lv-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--lv-line);
    box-shadow: 0 4px 12px rgba(20, 20, 22, 0.05);
}

#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #E2E2E8;
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--lv-ink);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab .cs-lv-tab-n {
    padding: 1px 8px;
    border-radius: 999px;
    background: #F1F1F4;
    color: var(--lv-dim);
    font-size: 13px;
}

#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab.cs-lv-tab-flash {
    border-color: transparent;
    background: var(--lv-yellow);
    color: var(--lv-ink);
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(255, 194, 26, 0.45);
    animation: cs-lv-chip 2.4s ease-in-out infinite;
}

#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab.cs-lv-tab-flash .cs-lv-tab-n { background: var(--lv-ink); color: var(--lv-yellow); }
#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab.cs-lv-tab-flash.is-pulse { animation: cs-pulse 0.6s ease-in-out 2; }
#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab.is-on:not(.cs-lv-tab-flash) { border-color: var(--lv-ink); }

#cshow-live.cs-screen .cs-lv-bar .cs-lv-tab.cs-lv-tab-now {
    border-color: transparent;
    background: var(--lv-red);
    color: #FFFFFF;
    animation: cs-lv-blink 0.9s ease-in-out infinite;
}

/* the 4-squares icon of "Todos los productos" */
#cshow-live.cs-screen .cs-lv-ico-grid {
    display: inline-block;
    width: 15px;
    height: 15px;
    background:
        linear-gradient(currentColor, currentColor) 0 0 / 6px 6px no-repeat,
        linear-gradient(currentColor, currentColor) 100% 0 / 6px 6px no-repeat,
        linear-gradient(currentColor, currentColor) 0 100% / 6px 6px no-repeat,
        linear-gradient(currentColor, currentColor) 100% 100% / 6px 6px no-repeat;
    border-radius: 2px;
}

/* ---------------------------------------------------------------- columns + sections */

#cshow-live.cs-screen .cs-lv-cols > div > section,
#cshow-live.cs-screen .cs-lv-idle,
#cshow-live.cs-screen .cs-lv-foot {
    padding: 12px 16px 4px;
    scroll-margin-top: 64px;   /* below the sticky bar */
}

#cshow-live.cs-screen .cs-lv-sec-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 12px;
}

#cshow-live.cs-screen .cs-lv-sec-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-family: var(--lv-cond);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
}

/* ⚡ in a yellow square */
#cshow-live.cs-screen .cs-lv-sec-title .cs-lv-sec-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--lv-yellow);
    font-size: 16px;
}

#cshow-live.cs-screen .cs-lv-sec-sub {
    margin: 4px 0 0;
    color: var(--lv-dim);
    font-size: 13px;
}

#cshow-live.cs-screen .cs-lv-sec-right {
    flex: 0 0 auto;
    color: var(--lv-dim);
    font-size: 13px;
    font-weight: 600;
}

#cshow-live.cs-screen .cs-lv-netslot .cs-lv-net {
    margin: 8px 16px 0;
    padding: 8px 12px;
    border: 1px solid #F6C6C6;
    border-radius: 12px;
    background: #FFF4F4;
    color: var(--lv-red-2);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

/* ---------------------------------------------------------------- ¿CÓMO COMPRO? + footer */

#cshow-live.cs-screen .cs-lv-buyhow {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 8px 0 4px;
    padding: 16px;
    border: 1px solid var(--lv-line);
    border-radius: 18px;
    background: var(--lv-card);
}

#cshow-live.cs-screen .cs-lv-buyhow .cs-lv-buyhow-h {
    margin: 0;
    font-family: var(--lv-cond);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

#cshow-live.cs-screen .cs-lv-buyhow .cs-lv-buyhow-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#cshow-live.cs-screen .cs-lv-buyhow .cs-lv-buyhow-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
}

#cshow-live.cs-screen .cs-lv-buyhow .cs-lv-buyhow-n {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--lv-red);
    color: #FFFFFF;
    font-weight: 800;
}

#cshow-live.cs-screen .cs-lv-buyhow .cs-lv-buyhow-n.is-ok { background: var(--lv-green); }

#cshow-live.cs-screen .cs-lv-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 0 24px;
    color: var(--lv-dim);
    font-size: 13px;
    text-align: center;
}

#cshow-live.cs-screen .cs-lv-footer a { font-weight: 700; }

/* 💬 WhatsApp bubble drawn in CSS (no image, no font) */
#cshow-live.cs-screen .cs-lv-wa-ico {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #FFFFFF;
}

#cshow-live.cs-screen .cs-lv-wa-ico::before {   /* the bubble's tail */
    content: "";
    position: absolute;
    left: -2px;
    bottom: -1px;
    width: 0;
    height: 0;
    border-top: 7px solid #FFFFFF;
    border-right: 7px solid transparent;
    transform: rotate(-20deg);
}

#cshow-live.cs-screen .cs-lv-wa-ico::after {    /* the phone inside */
    content: "";
    position: absolute;
    top: 27%;
    left: 27%;
    width: 46%;
    height: 46%;
    border-radius: 50%;
    border: 3px solid #25D366;
    border-top-color: transparent;
    border-right-color: transparent;
    transform: rotate(-45deg);
    box-sizing: border-box;
}

/* "¿Dudas? WhatsApp 71490659" as a green pill */
#cshow-live.cs-screen.cs-live .cs-lv-footer a.cs-lv-footer-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #25D366;
    color: #FFFFFF;
    font-size: 15px;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
}
#cshow-live.cs-screen .cs-lv-footer p { margin: 0; }

/* ---------------------------------------------------------------- bottom buy bar */

#cshow-live.cs-screen .cs-lv-buybar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--lv-line);
    box-shadow: 0 -10px 28px rgba(20, 20, 22, 0.14);
    animation: cs-lv-slide-up 0.25s ease-out;
}

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-buybar-in {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
}

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-buybar-info {
    flex: 1 1 auto;
    min-width: 0;
}

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-buybar-name {
    margin: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-buybar-cond { color: var(--lv-dim); font-weight: 600; }
#cshow-live.cs-screen .cs-lv-buybar .cs-lv-buybar-cond.is-used { color: var(--lv-used); font-weight: 800; }

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-buybar-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 2px 0 0;
}

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-price {
    color: var(--lv-red);
    font-family: var(--lv-cond);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

#cshow-live.cs-screen .cs-lv-buybar .cs-lv-price-usd { color: var(--lv-dim); font-size: 13px; font-weight: 700; }
#cshow-live.cs-screen .cs-lv-buybar .cs-lv-clock { margin-left: auto; font-size: 18px; }

/* ---------------------------------------------------------------- toasts: "✓ ¡Alguien se llevó…!" */

#cshow-live.cs-screen .cs-lv-toasts {
    position: fixed;
    top: 68px;
    left: 50%;
    z-index: 40;
    width: min(92vw, 420px);
    transform: translateX(-50%);
    pointer-events: none;
}

#cshow-live.cs-screen .cs-lv-toasts .cs-lv-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    padding: 10px 12px;
    border: 1px solid #CDEBDD;
    border-radius: 14px;
    background: #FFFFFF;
    color: var(--lv-ink);
    box-shadow: 0 6px 18px rgba(4, 120, 87, 0.16);
    animation: cs-lv-drop-in 0.25s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

#cshow-live.cs-screen .cs-lv-toasts .cs-lv-toast .cs-lv-toast-ic {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--lv-green);
    color: #FFFFFF;
    font-size: 17px;
    font-weight: 900;
}

#cshow-live.cs-screen .cs-lv-toasts .cs-lv-toast p { margin: 0; font-size: 14px; line-height: 1.3; }
#cshow-live.cs-screen .cs-lv-toasts .cs-lv-toast p span { color: var(--lv-dim); }

#cshow-live.cs-screen .cs-lv-toasts .cs-lv-toast.is-out {
    opacity: 0;
    transform: translateY(-10px);
}

/* ---------------------------------------------------------------- motion */

@keyframes cs-lv-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

@keyframes cs-lv-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes cs-lv-drop-in {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cs-lv-ping {
    0%        { transform: scale(1); opacity: 0.9; }
    80%, 100% { transform: scale(2.6); opacity: 0; }
}

@keyframes cs-lv-glow {
    0%, 100% { box-shadow: 0 4px 14px rgba(255, 45, 85, 0.35); }
    50%      { box-shadow: 0 4px 22px rgba(255, 45, 85, 0.75); }
}

@keyframes cs-lv-sweep {
    0%, 55% { left: -60%; }
    100%    { left: 130%; }
}

@keyframes cs-lv-chip {
    0%, 100% { transform: scale(1); }
    8%       { transform: scale(1.04); }
    16%      { transform: scale(1); }
}

/* ---------------------------------------------------------------- desktop: ① ② left, ③ right */

@media (min-width: 900px) {
    #cshow-live.cs-screen.cs-live {
        max-width: 1180px;
    }

    #cshow-live.cs-screen.cs-live.is-live .cs-lv-cols,
    #cshow-live.cs-screen.cs-live.is-ended .cs-lv-cols {
        display: grid;
        grid-template-columns: minmax(380px, 460px) 1fr;
        gap: 12px;
        align-items: start;
    }

    #cshow-live.cs-screen.cs-live .cs-lv-bar {
        justify-content: center;
    }

    #cshow-live.cs-screen.cs-live .cs-lv-bar .cs-lv-tab {
        flex: 0 0 auto;
        min-width: 220px;
    }

    #cshow-live.cs-screen.cs-live .cs-lv-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }

    #cshow-live.cs-screen.cs-live .cs-lv-foot {
        max-width: 640px;
        margin: 0 auto;
    }
}
