/* ==========================================================================
   CONVERSION OPTIMIZATION STYLES — Klodstjek.dk
   Added 2026-08-04: Buy recommendation, live viewers, sticky mobile buy bar,
   enhanced CTA buttons (nudging)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BUY RECOMMENDATION BOX (product page)
   Shows a colour-coded nudge based on 30-day price history
   -------------------------------------------------------------------------- */
.buy-recommendation-v3 {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--r-lg);
    margin-bottom: 16px;
    border: 1px solid transparent;
    background: var(--surface);
}

.buy-recommendation-v3 .brv-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.buy-recommendation-v3 .brv-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.buy-recommendation-v3 .brv-text strong {
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.3;
}

.buy-recommendation-v3 .brv-text span {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* GREEN — good time to buy */
.buy-recommendation-v3.type-buy {
    background: var(--green-soft);
    border-color: #bfe6cf;
}

.buy-recommendation-v3.type-buy .brv-icon {
    background: var(--green);
    color: #fff;
}

.buy-recommendation-v3.type-buy .brv-text strong {
    color: #157a3e;
}

/* YELLOW — price is stable */
.buy-recommendation-v3.type-neutral {
    background: #fdfaf3;
    border-color: #f2e7c6;
}

.buy-recommendation-v3.type-neutral .brv-icon {
    background: #c9960a;
    color: #fff;
}

.buy-recommendation-v3.type-neutral .brv-text strong {
    color: #8a6508;
}

/* RED — wait for a better price */
.buy-recommendation-v3.type-wait {
    background: var(--accent-soft);
    border-color: #f5c6c6;
}

.buy-recommendation-v3.type-wait .brv-icon {
    background: var(--accent);
    color: #fff;
}

.buy-recommendation-v3.type-wait .brv-text strong {
    color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   1b. TRUST BAR (social proof — product page)
   -------------------------------------------------------------------------- */
.trust-bar-v2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    padding: 12px 18px;
    background: linear-gradient(135deg, #f2fbf4 0%, #eaf7ef 100%);
    border: 1px solid #c8e8d4;
    border-radius: 14px;
    margin-bottom: 20px;
    font-family: var(--font-sans);
}

.trust-bar-v2 .tb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #157a3e;
}

.trust-bar-v2 .tb-item b {
    font-size: 16px;
    font-weight: 800;
}

.trust-bar-v2 .tb-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .trust-bar-v2 {
        flex-wrap: nowrap;
        justify-content: space-between;
        padding: 10px 12px;
        gap: 8px;
        margin-bottom: 14px;
    }
    .trust-bar-v2 .tb-item {
        gap: 6px;
        font-size: 12px;
    }
    .trust-bar-v2 .tb-item b {
        font-size: 14px;
    }
    .trust-bar-v2 .tb-icon {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    .trust-bar-v2 .tb-label {
        display: none;
    }
}

/* Free-shipping label inside a store row's sub-line */
.free-ship-sub {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 700;
    color: #157a3e;
    background: var(--green-soft);
    border: 1px solid #bfe6cf;
    padding: 1px 6px;
    border-radius: 6px;
    margin-top: 2px;
    width: fit-content;
}

/* --------------------------------------------------------------------------
   2. LIVE VIEWERS (social proof)
   -------------------------------------------------------------------------- */
.live-viewers-v3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: #f7f5f1;
    border-radius: 10px;
    width: fit-content;
}

.live-viewers-v3 .lv-dots {
    display: flex;
    gap: 3px;
}

.live-viewers-v3 .lv-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-faint);
    animation: lv-pulse 1.6s ease-in-out infinite;
}

.live-viewers-v3 .lv-dot:nth-child(2) { animation-delay: 0.25s; }
.live-viewers-v3 .lv-dot:nth-child(3) { animation-delay: 0.5s; }

@keyframes lv-pulse {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.15); }
}

.live-viewers-v3 .lv-text {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   3. STICKY MOBILE BUY BAR
   Slides up from the bottom once the price card has scrolled past
   -------------------------------------------------------------------------- */
.sticky-buy-bar-v3 {
    display: none;
}

@media (max-width: 768px) {
    .sticky-buy-bar-v3 {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 950;
        background: rgba(250, 248, 244, 0.97);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        box-shadow: 0 -6px 24px rgba(20, 20, 30, 0.08);
        transform: translateY(110%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        font-family: var(--font-sans);
    }

    /* The site has a bottom mobile nav bar — keep the buy bar above it */
    .sticky-buy-bar-v3.visible {
        transform: translateY(0);
    }

    .sticky-buy-bar-v3 .sbb-price {
        display: flex;
        flex-direction: column;
        min-width: 0;
        flex-shrink: 1;
    }

    .sticky-buy-bar-v3 .sbb-price-lbl {
        font-size: 10.5px;
        color: var(--text-muted);
        line-height: 1.2;
    }

    .sticky-buy-bar-v3 .sbb-price-val {
        font-size: 19px;
        font-weight: 800;
        letter-spacing: -0.5px;
        font-variant-numeric: tabular-nums;
        line-height: 1.2;
        color: var(--text);
        display: inline-flex;
        align-items: baseline;
        gap: 6px;
    }

    .sticky-buy-bar-v3 .sbb-price-old {
        font-size: 11.5px;
        color: var(--text-faint);
        text-decoration: line-through;
        font-weight: 500;
        margin-left: 5px;
    }

    .sticky-buy-bar-v3 .sbb-btn {
        flex-shrink: 0;
        margin-left: auto;
        width: auto;
        min-width: 150px;
        padding: 13px 18px;
        border-radius: 12px;
        font-size: 14.5px;
        font-weight: 700;
        background: var(--accent);
        box-shadow: 0 4px 14px rgba(255, 49, 49, 0.3);
    }

    .sticky-buy-bar-v3 .sbb-btn:hover {
        background: var(--accent-hover);
        opacity: 1;
        transform: translateY(-1px);
    }

    /* Since the sticky bar sits above the bottom nav, add body padding
       cleanly handled by existing mobile nav (74px). The bar is ~64px,
       so ensure there is enough room. */
    body.page-product.sticky-buy-active {
        padding-bottom: 130px;
    }
}

/* --------------------------------------------------------------------------
   4. ENHANCED CTA BUTTONS (desktop product page)
   Gradient + subtle pulse on the primary "go to shop" button
   -------------------------------------------------------------------------- */
.btn-store-v3 {
    position: relative;
    overflow: hidden;
}

.btn-store-v3::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transition: left 0.45s ease;
    pointer-events: none;
}

.btn-store-v3:hover::after {
    left: 140%;
}

/* Stronger, more actionable "Gå til butik" rows on the price list */
.store-row-v3 .btn-store-row {
    position: relative;
    overflow: hidden;
    transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
    font-weight: 700;
}

.store-row-v3 .btn-store-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 20, 30, 0.1);
}

.store-row-v3.cheapest-row-v3 .btn-store-row {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    box-shadow: 0 4px 12px rgba(255, 49, 49, 0.25);
}

.store-row-v3.cheapest-row-v3 .btn-store-row:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    box-shadow: 0 6px 16px rgba(255, 49, 49, 0.32);
}

/* --------------------------------------------------------------------------
   5. PRODUCT CARD — direct "Køb nu" button + hover accent + image badges
   -------------------------------------------------------------------------- */
.product-card {
    position: relative;
}

/* Image badges: savings (top-left) + bundpris — sit on top of the image */
.card-image-box {
    position: relative;
}

.card-badge-image {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.2px;
    box-shadow: 0 3px 10px rgba(20,20,30,.18);
    line-height: 1.4;
    white-space: nowrap;
}

.card-badge-image.discount.strong {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 3px 10px rgba(255,49,49,.32);
}

.card-badge-image.discount.subtle {
    background: var(--text);
    color: #fff;
    box-shadow: 0 3px 10px rgba(20,20,30,.25);
}

/* Bundpris sits below the savings badge */
.card-badge-image.bundpris {
    top: 40px;
    background: var(--green);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(31,157,87,.3);
}

/* Compare button — round "➕" below the price-alert bell.
   Vertical stack on the card's right side:
   wishlist (top:11px) -> price-alert (top:47px) -> compare (top:83px)

   TEMPORARILY HIDDEN (2026-08-04) — the compare feature is deactivated on the
   site while keeping all markup/JS intact. To re-enable, change the
   `display: none` below to `display: flex`. */
.card-compare {
    position: absolute;
    top: 83px;
    right: 11px;
    z-index: 4;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border-strong);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    transition: background .15s, transform .15s;
}

.card-compare:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: scale(1.1);
}

.card-compare.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

/* Hide compare button on the front-page horizontal cards (mobile) —
   those small cards only keep the bell, matching the wishlist hide. */
.products-grid .product-card .card-compare {
    display: none !important;
}

/* Price per piece — subtle value signal on product card */
.card-price-per-piece {
    display: inline-block;
    align-self: flex-start;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 1px 6px;
    margin-bottom: 8px;
}

/* "Køb nu" CTA on browse list rows (seen on all breakpoints, key on mobile) */
.btn-see-prices-row {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 10px rgba(255, 49, 49, 0.2) !important;
    border: none !important;
}

.btn-see-prices-row:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(255, 49, 49, 0.3) !important;
}

/* Mobile: make the buy button larger / full-width driven by existing CSS */
@media (max-width: 768px) {
    .page-browse .product-item-row .btn-see-prices-row {
        background: var(--accent) !important;
        color: #fff !important;
        font-weight: 700 !important;
        border: none !important;
        box-shadow: 0 3px 10px rgba(255, 49, 49, 0.2) !important;
        padding: 11px 18px !important;
    }
    .page-browse .product-item-row .btn-see-prices-row:hover {
        background: var(--accent-hover) !important;
    }
}

.card-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: auto;
    padding: 10px 14px;
    background: var(--accent);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 3px 10px rgba(255, 49, 49, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

.card-buy-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(255, 49, 49, 0.3);
}

.card-buy-btn span {
    font-size: 14px;
    line-height: 1;
    transition: transform 0.15s;
}

.card-buy-btn:hover span {
    transform: translateX(2px);
}

/* On mobile cards the button stays compact */
@media (max-width: 768px) {
    .card-buy-btn {
        padding: 8px 12px;
        font-size: 12.5px;
        margin-top: auto;
    }
}

.product-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.2s ease;
    z-index: 2;
}

.product-card:hover::before {
    background: linear-gradient(90deg, var(--accent), #ff7a5c);
}

/* Tweak for mobile cards: keep the accent line slim */
@media (max-width: 768px) {
    .product-card::before {
        height: 2px;
    }
}
