/**
 * Copyright © Caravel. All rights reserved.
 *
 * "Calculadora de BTU" widget (Block\Widget\BtuCalculator, templates/widget/btu-calculator.phtml), after the
 * "calc" section of the Black Cassol mockup. Loaded by the cassol_blackfriday_active layout handle next to
 * black-friday.css, whose tokens (--bf-*) it reuses. Plain CSS with its own class names (bf-calc__*); fonts are the
 * theme's. The result card always has four product rows (placeholders when fewer), so the component keeps its size.
 */

.bf-calc {
    color: var(--bf-text);
    background: linear-gradient(180deg, #0b0b0b, var(--bf-surface));
    border-top: 1px solid var(--bf-line);
    border-bottom: 1px solid var(--bf-line);
    padding: clamp(40px, 5.6vw, 77px) 0;
    --bf-calc-ease: cubic-bezier(.2, .7, .2, 1);
}

.bf-calc__wrap {
    max-width: 1360px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 48px);
}

.bf-calc__grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(24px, 5vw, 72px);
    align-items: start;
}

/* ---------- left column: heading and controls ---------- */
.bf-calc__kick {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--bf-muted);
    margin-bottom: 14px;
}

.bf-calc__kick::before {
    content: "";
    width: 28px;
    height: 2px;
    background: var(--bf-red);
}

.bf-calc__title {
    margin: 0;
    font-weight: 900;
    font-size: clamp(32px, 4.2vw, 56px);
    line-height: 1;
    text-transform: uppercase;
    color: var(--bf-text);
}

.bf-calc__lead {
    color: var(--bf-muted);
    max-width: 560px;
    margin: 14px 0 0;
    font-size: 16px;
}

.bf-calc__fields {
    display: grid;
    gap: 22px;
    margin-top: 30px;
}

.bf-calc__field {
    display: grid;
    gap: 10px;
}

.bf-calc__field > label,
.bf-calc__lb {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-weight: 700;
    font-size: 15px;
    color: var(--bf-text);
    /* the theme styles every label as a floating form label (white gradient, lifted); not here */
    background: none !important;
    transform: none;
}

.bf-calc__val {
    font-size: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* range: red progress up to the thumb (--bf-calc-fill set by Alpine), light thumb with a soft halo */
.bf-calc input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 44px;
    margin: 0;
    background: none;
    cursor: pointer;
    --bf-calc-fill: 30%;
}

.bf-calc input[type="range"]:focus-visible {
    outline: 2px solid var(--bf-outline);
    outline-offset: 4px;
    border-radius: 6px;
}

.bf-calc input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--bf-red) var(--bf-calc-fill), var(--bf-line-2) var(--bf-calc-fill));
}

.bf-calc input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: var(--bf-line-2);
}

.bf-calc input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--bf-red);
}

.bf-calc input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bf-text);
    border: 0;
    margin-top: -9px;
    box-shadow: 0 0 0 6px rgba(244, 241, 234, .12);
}

.bf-calc input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bf-text);
    border: 0;
    box-shadow: 0 0 0 6px rgba(244, 241, 234, .12);
}

.bf-calc__seg {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--bf-line-2);
    border-radius: 999px;
}

.bf-calc__seg button {
    min-height: 44px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-weight: 700;
    font-size: 15px;
    color: var(--bf-muted);
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

.bf-calc__seg button:hover {
    color: var(--bf-text);
}

.bf-calc__seg button[aria-pressed="true"] {
    background: var(--bf-text);
    color: #050505;
}

.bf-calc__step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bf-calc__step button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--bf-line-2);
    border-radius: 50%;
    background: transparent;
    color: var(--bf-text);
    cursor: pointer;
    transition: border-color .2s, opacity .2s;
}

.bf-calc__step button:hover:not(:disabled) {
    border-color: var(--bf-text);
}

.bf-calc__step button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.bf-calc__step output {
    min-width: 44px;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ---------- right column: the result card ---------- */
.bf-calc__result {
    position: relative;
    border: 1px solid var(--bf-line-2);
    border-radius: 20px;
    padding: clamp(22px, 3vw, 36px);
    background: radial-gradient(90% 120% at 50% 0, rgba(255, 231, 184, .10), transparent 60%), var(--bf-surface-2);
    overflow: hidden;
}

.bf-calc__lbl {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--bf-muted);
}

.bf-calc__big {
    margin: 8px 0 4px;
    font-size: clamp(56px, 7vw, 96px);
    font-weight: 900;
    line-height: .9;
    font-variant-numeric: tabular-nums;
    color: var(--bf-text);
}

.bf-calc__big small {
    font-size: .32em;
    font-weight: 800;
    margin-left: 8px;
    color: var(--bf-muted);
}

.bf-calc__note {
    margin: 0 0 22px;
    font-size: 14px;
    color: var(--bf-muted);
}

.bf-calc__list {
    display: grid;
    gap: 10px;
    transition: opacity .2s;
}

.bf-calc__list--loading {
    opacity: .55;
}

.bf-calc__list--pulse .bf-calc__card {
    animation: bf-calc-pulse .6s var(--bf-calc-ease);
}

@keyframes bf-calc-pulse {
    from {
        opacity: .3;
        transform: translateY(8px);
    }
}

.bf-calc__card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 94px;
    padding: 10px;
    border: 1px solid var(--bf-line);
    border-radius: 12px;
    background: var(--bf-bg);
}

.bf-calc__img {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.bf-calc__img img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.bf-calc__body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.bf-calc__name {
    font-size: 14px;
    line-height: 1.3;
    min-height: 2.6em; /* two lines, also for a short name, so the rows share one stack */
    color: var(--bf-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bf-calc__name:hover {
    text-decoration: underline;
}

.bf-calc__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--bf-text);
}

.bf-calc__price s {
    font-size: 12px;
    font-weight: 400;
    color: var(--bf-muted);
}

/* "-X%" chip between the price and the struck regular price, like the anchor offer badge */
.bf-calc__off {
    background: var(--bf-red);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    padding: 4px 6px 3px;
    border-radius: 4px;
    letter-spacing: .02em;
    transform: translateY(-2px);
}

.bf-calc__pay {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    font-size: 12px;
    color: var(--bf-muted);
}

.bf-calc__pay b {
    font-weight: 700;
    color: var(--bf-text);
}

.bf-calc__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--bf-red);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 8px 28px -8px rgba(189, 40, 33, .7);
    transition: filter .2s;
}

.bf-calc__btn:hover {
    color: #fff;
    filter: brightness(1.12);
}

/* placeholder rows keep the card height while loading or when fewer models match */
.bf-calc__card--empty {
    border-style: dashed;
    background: transparent;
}

.bf-calc__ph {
    display: block;
    border-radius: 6px;
    background: var(--bf-surface-3);
    opacity: .6;
}

.bf-calc__ph--img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
}

.bf-calc__ph--line {
    height: 12px;
    width: 70%;
}

.bf-calc__ph--short {
    width: 40%;
}

.bf-calc__error {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--bf-red);
}

.bf-calc__pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--bf-muted);
    font-variant-numeric: tabular-nums;
}

.bf-calc__pager button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--bf-line-2);
    border-radius: 50%;
    background: transparent;
    color: var(--bf-text);
    cursor: pointer;
    transition: background-color .2s, color .2s, opacity .2s;
}

.bf-calc__pager button:hover:not(:disabled) {
    background: var(--bf-text);
    color: #050505;
}

.bf-calc__pager button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
    .bf-calc__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 639px) {
    .bf-calc__card {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .bf-calc__img,
    .bf-calc__img img,
    .bf-calc__ph--img {
        width: 56px;
        height: 56px;
    }

    .bf-calc__btn {
        grid-column: 1 / -1;
        min-height: 40px;
    }

    .bf-calc__seg button {
        padding: 0 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bf-calc__list--pulse .bf-calc__card {
        animation: none;
    }
}
