/* =====================================================================================
   Performanta masinilor: Top putere / Top 0–100 (.bh-perf), randurile din cardurile de profil
   (.bh-perf-stat), butonul „Compară" injectat (.bh-cmp-tog), bara de jos (.bh-cmp-bar) si
   fereastra de comparare (.bh-cmp-modal, montata pe <body>). Culorile din tema liquid glass
   (bh-glass.css) cu fallback-uri pentru aspectul clasic. Fara animatii care lasa transform.
   ===================================================================================== */

.bh-perf, .bh-cmp-bar, .bh-cmp-modal, .bh-cmp-tog {
    --pf-pane-a: var(--g-pane-a, rgba(255, 255, 255, .055));
    --pf-pane-b: var(--g-pane-b, rgba(255, 255, 255, .02));
    --pf-edge: var(--g-edge, rgba(255, 255, 255, .09));
    --pf-edge-2: var(--g-edge-2, rgba(255, 255, 255, .16));
    --pf-strong: var(--g-strong, #ffffff);
    --pf-text: var(--g-text, #e6ecea);
    --pf-text-2: var(--g-text-2, #c3cdc9);
    --pf-muted: var(--g-muted, #8f9d98);
    --pf-green: var(--g-green, #17c964);
    --pf-green-soft: var(--g-green-soft, rgba(23, 201, 100, .14));
    --pf-green-edge: var(--g-green-edge, rgba(23, 201, 100, .38));
    --pf-gold: var(--g-gold, #f3bd3e);
    --pf-red: var(--g-red, #ff5c6c);
    --pf-tint: var(--g-tint, rgba(255, 255, 255, .045));
    --pf-tint-2: var(--g-tint-2, rgba(255, 255, 255, .085));
    --pf-line: var(--g-line, rgba(255, 255, 255, .07));
    --pf-r: var(--g-r, 12px);
    --pf-r-lg: var(--g-r-lg, 16px);
    --pf-r-xl: var(--g-r-xl, 20px);
    --pf-hi: var(--g-hi, inset 0 1px 0 rgba(255, 255, 255, .08));
    --pf-shadow: var(--g-shadow, 0 10px 30px rgba(0, 0, 0, .28));
    --pf-float: var(--g-float, 0 24px 60px rgba(0, 0, 0, .45));
    --pf-font: var(--g-font, 'Manrope', system-ui, sans-serif);
    --pf-solid: #121816;
    --pf-silver: #c9d2d6;
    --pf-bronze: #d39563;
}
html.bh-glass[data-bh-theme="light"] .bh-perf,
html.bh-glass[data-bh-theme="light"] .bh-cmp-bar,
html.bh-glass[data-bh-theme="light"] .bh-cmp-modal,
html.bh-glass[data-bh-theme="light"] .bh-cmp-tog {
    --pf-solid: #f6faf8;
    --pf-silver: #7d8b92;
    --pf-bronze: #a8693a;
}

/* ---------- profil: randurile noi din .bhp-car-stats ---------- */
.bh-profile .bh-perf-stat dd small { font-weight: 600; color: var(--bp-muted, #8f9d98); font-size: 12px; }
.bh-profile .bh-perf-stat dd.is-none { font-weight: 600; color: var(--bp-muted, #8f9d98); font-style: italic; }

/* ---------- pagina de clasament ---------- */
.bh-perf { font-family: var(--pf-font); color: var(--pf-text); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bh-perf .card { height: auto; margin-bottom: 0; }
.bh-perf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.bh-perf-title { margin: 0; font-size: 24px; font-weight: 800; color: var(--pf-strong); letter-spacing: -.01em; }
.bh-perf-sub { margin: 4px 0 0; max-width: 62ch; font-size: 13.5px; color: var(--pf-text-2); }
.bh-perf-sub b { color: var(--pf-strong); }
.bh-perf-tabs { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--pf-tint); border: 1px solid var(--pf-edge); }
.bh-perf-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--pf-text-2); text-decoration: none; }
.bh-perf-tabs a:hover { color: var(--pf-strong); background: var(--pf-tint-2); }
.bh-perf-tabs a.is-on { background: var(--pf-green); color: var(--g-green-ink, #04130a); }

.bh-perf-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; border: 1px dashed var(--pf-edge-2); border-radius: var(--pf-r-lg); color: var(--pf-muted); text-align: center; }
.bh-perf-empty i { font-size: 30px; }
.bh-perf-empty p { margin: 0; font-weight: 600; color: var(--pf-text-2); }

/* podium: 2 - 1 - 3 pe desktop, 1 - 2 - 3 pe telefon */
.bh-perf-podium { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.bh-perf-pod {
    --medal: var(--pf-gold);
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
    padding: 18px 14px 16px; text-align: center; border-radius: var(--pf-r-xl);
    background: linear-gradient(180deg, color-mix(in srgb, var(--medal) 14%, transparent), var(--pf-pane-b) 70%);
    border: 1px solid color-mix(in srgb, var(--medal) 34%, var(--pf-edge));
    box-shadow: var(--pf-hi);
}
.bh-perf-pod.is-1 { order: 2; padding-top: 26px; padding-bottom: 22px; }
.bh-perf-pod.is-2 { order: 1; --medal: var(--pf-silver); }
.bh-perf-pod.is-3 { order: 3; --medal: var(--pf-bronze); }
.bh-perf-medal {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
    font-weight: 800; font-size: 16px; color: #111; background: var(--medal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--medal) 22%, transparent);
}
.bh-perf-pod-img { width: 100%; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.bh-perf-pod-img img { max-width: 92%; max-height: 100%; object-fit: contain; }
.bh-perf-pod.is-1 .bh-perf-pod-img img { max-width: 100%; }
.bh-perf-pod img.is-missing, .bh-perf-thumb img.is-missing { visibility: hidden; }
.bh-perf-pod-name { font-weight: 800; color: var(--pf-strong); font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.bh-perf-owner { font-size: 13px; font-weight: 600; color: var(--pf-green); text-decoration: none; overflow-wrap: anywhere; }
.bh-perf-owner:hover { text-decoration: underline; color: var(--pf-green); }
.bh-perf-pod-val { font-size: 13px; color: var(--pf-text-2); font-variant-numeric: tabular-nums; }
.bh-perf-pod-val b { font-size: 26px; font-weight: 800; color: var(--pf-strong); letter-spacing: -.02em; }
.bh-perf-pod-val small { display: block; color: var(--pf-muted); font-size: 12.5px; font-weight: 600; }
.bh-perf-pod .bh-perf-act { margin-top: 4px; justify-content: center; }

.bh-perf-sheet {
    display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; font-weight: 700;
    background: var(--pf-green-soft) !important; border: 1px solid var(--pf-green-edge) !important; color: var(--pf-strong) !important;
}
.bh-perf-sheet:hover { background: var(--pf-green) !important; color: var(--g-green-ink, #04130a) !important; }

/* lista */
.bh-perf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bh-perf-row {
    display: grid; grid-template-columns: 40px 96px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
    padding: 10px 6px; border-bottom: 1px solid var(--pf-line);
}
.bh-perf-row:last-child { border-bottom: 0; }
.bh-perf-rank { font-weight: 800; font-size: 15px; color: var(--pf-muted); text-align: center; font-variant-numeric: tabular-nums; }
.bh-perf-row.is-top .bh-perf-rank { color: var(--pf-gold); }
.bh-perf-thumb { height: 52px; display: flex; align-items: center; justify-content: center; }
.bh-perf-thumb img { max-width: 100%; max-height: 52px; object-fit: contain; }
.bh-perf-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bh-perf-name { font-weight: 700; color: var(--pf-strong); font-size: 14.5px; overflow-wrap: anywhere; }
.bh-perf-name small { font-weight: 600; color: var(--pf-muted); font-size: 11.5px; }
.bh-perf-val { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.bh-perf-val b { font-size: 16px; font-weight: 800; color: var(--pf-strong); white-space: nowrap; }
.bh-perf-val small { font-size: 12px; font-weight: 600; color: var(--pf-muted); white-space: nowrap; }
.bh-perf-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.bh-perf-pager { margin-top: 14px; display: flex; justify-content: center; }
.bh-perf-pager .pagination { flex-wrap: wrap; margin: 0; }
.bh-perf-note { margin: 12px 0 0; font-size: 13px; color: var(--pf-muted); }

@media (max-width: 767.98px) {
    .bh-perf-podium { grid-template-columns: 1fr; gap: 10px; }
    .bh-perf-pod { order: 0 !important; display: grid; grid-template-columns: 34px 96px minmax(0, 1fr); grid-template-areas: "m img name" "m img owner" "m img val" "act act act"; text-align: left; align-items: center; column-gap: 12px; row-gap: 2px; padding: 12px !important; }
    .bh-perf-medal { grid-area: m; }
    .bh-perf-pod-img { grid-area: img; aspect-ratio: auto; height: 56px; }
    .bh-perf-pod-name { grid-area: name; }
    .bh-perf-pod .bh-perf-owner { grid-area: owner; }
    .bh-perf-pod-val { grid-area: val; }
    .bh-perf-pod-val b { font-size: 20px; }
    .bh-perf-pod-val small { display: inline; margin-left: 6px; }
    .bh-perf-pod .bh-perf-act { grid-area: act; justify-content: flex-start; margin-top: 8px; }
}
@media (max-width: 575.98px) {
    .bh-perf-title { font-size: 20px; }
    .bh-perf-tabs { width: 100%; }
    .bh-perf-tabs a { flex: 1 1 0; justify-content: center; }
    .bh-perf-row { grid-template-columns: 28px 64px minmax(0, 1fr) auto; grid-template-areas: "r t w v" "r t a a"; gap: 4px 10px; padding: 10px 0; }
    .bh-perf-rank { grid-area: r; font-size: 14px; }
    .bh-perf-thumb { grid-area: t; height: 40px; }
    .bh-perf-thumb img { max-height: 40px; }
    .bh-perf-who { grid-area: w; }
    .bh-perf-val { grid-area: v; }
    .bh-perf-act { grid-area: a; justify-content: flex-start; }
    .bh-perf-act { flex-wrap: nowrap; }
    .bh-perf-act .bh-perf-sheet span { display: none; }
    .bh-perf-act .bh-perf-sheet { min-height: 31px; padding: 4px 10px; }
}

/* ---------- butonul „Compară" (injectat de bh-compare.js langa [data-vehicle-sheet]) ---------- */
.bh-cmp-tog {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 31px; padding: 4px 10px;
    border-radius: 10px; border: 1px solid var(--pf-edge-2); background: var(--pf-tint); color: var(--pf-text);
    font: 700 12.5px/1.2 var(--pf-font); cursor: pointer; vertical-align: middle; white-space: nowrap;
}
.bh-cmp-tog:hover { background: var(--pf-tint-2); color: var(--pf-strong); }
.bh-cmp-tog:focus-visible { outline: 2px solid var(--pf-green); outline-offset: 2px; }
.bh-cmp-tog .bh-cmp-box { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--pf-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1; color: transparent; }
.bh-cmp-tog[aria-pressed="true"] { border-color: var(--pf-green-edge); background: var(--pf-green-soft); color: var(--pf-strong); }
.bh-cmp-tog[aria-pressed="true"] .bh-cmp-box { background: var(--pf-green); border-color: var(--pf-green); color: #04130a; }
.bhp-car-actions .bh-cmp-tog { min-height: 34px; }

/* ---------- bara de jos ---------- */
body.bh-cmp-on { padding-bottom: 76px; }
.bh-cmp-bar {
    position: fixed; z-index: 1040; left: 50%; bottom: 16px; translate: -50% 0; max-width: calc(100vw - 32px);
    display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 999px;
    background: var(--pf-solid); border: 1px solid var(--pf-edge-2); box-shadow: var(--pf-float); color: var(--pf-text);
    font-family: var(--pf-font);
}
.bh-cmp-bar[hidden] { display: none; }
.bh-cmp-bar-txt { font-size: 13px; font-weight: 600; color: var(--pf-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bh-cmp-bar-txt b { color: var(--pf-strong); }
.bh-cmp-bar button { border: 0; cursor: pointer; font: 700 13px/1 var(--pf-font); border-radius: 999px; min-height: 36px; padding: 0 16px; white-space: nowrap; }
.bh-cmp-go { background: var(--pf-green); color: #04130a; }
.bh-cmp-go:disabled { opacity: .5; cursor: not-allowed; }
.bh-cmp-clear { background: var(--pf-tint-2); color: var(--pf-text); width: 36px; padding: 0 !important; }
.bh-cmp-bar button:focus-visible { outline: 2px solid var(--pf-green); outline-offset: 2px; }

/* ---------- fereastra ---------- */
.bh-cmp-modal { position: fixed; inset: 0; z-index: 1060; display: flex; align-items: center; justify-content: center; padding: 16px; font-family: var(--pf-font); }
.bh-cmp-modal[hidden] { display: none; }
.bh-cmp-back { position: absolute; inset: 0; background: rgba(4, 8, 7, .62); }
.bh-cmp-win {
    position: relative; width: min(980px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
    border-radius: var(--pf-r-xl); background: var(--pf-solid); border: 1px solid var(--pf-edge-2); box-shadow: var(--pf-float); color: var(--pf-text);
    overscroll-behavior: contain;
}
.bh-cmp-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--pf-solid); border-bottom: 1px solid var(--pf-line); }
.bh-cmp-top h4 { margin: 0; font-size: 17px; font-weight: 800; color: var(--pf-strong); }
.bh-cmp-x { border: 0; background: var(--pf-tint-2); color: var(--pf-text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; }
.bh-cmp-x:focus-visible { outline: 2px solid var(--pf-green); outline-offset: 2px; }
.bh-cmp-body { padding: 4px 16px 16px; }
.bh-cmp-msg { padding: 28px 8px; text-align: center; color: var(--pf-text-2); font-weight: 600; }

.bh-cmp-grid { --n: 2; display: grid; grid-template-columns: 150px repeat(var(--n), minmax(0, 1fr)); }
.bh-cmp-grid > div { padding: 9px 10px; border-bottom: 1px solid var(--pf-line); min-width: 0; font-variant-numeric: tabular-nums; }
.bh-cmp-lbl { font-size: 12.5px; font-weight: 700; color: var(--pf-muted); display: flex; align-items: center; }
.bh-cmp-v { font-size: 14px; font-weight: 700; color: var(--pf-strong); overflow-wrap: anywhere; border-radius: 8px; }
.bh-cmp-v small { display: block; font-size: 11.5px; font-weight: 600; color: var(--pf-muted); }
.bh-cmp-v.is-none { color: var(--pf-muted); font-weight: 600; font-style: italic; }
.bh-cmp-v.is-best { background: var(--pf-green-soft); box-shadow: inset 0 0 0 1px var(--pf-green-edge); color: var(--pf-strong); }
.bh-cmp-v.is-best::after { content: "cel mai bun"; display: block; font-size: 10.5px; font-weight: 700; color: var(--pf-green); font-style: normal; }
.bh-cmp-head { text-align: center; border-bottom: 0 !important; }
.bh-cmp-head img { width: 100%; max-height: 120px; object-fit: contain; display: block; margin: 0 auto 6px; }
.bh-cmp-head img.is-missing { visibility: hidden; }
.bh-cmp-name { font-weight: 800; color: var(--pf-strong); font-size: 14.5px; line-height: 1.25; }
.bh-cmp-head a { font-size: 12.5px; font-weight: 600; color: var(--pf-green); text-decoration: none; }
.bh-cmp-head a:hover { text-decoration: underline; }
.bh-cmp-head .bh-cmp-acts { display: flex; justify-content: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.bh-cmp-head .bh-cmp-acts button { border: 1px solid var(--pf-edge-2); background: var(--pf-tint); color: var(--pf-text); border-radius: 8px; font: 700 12px/1 var(--pf-font); padding: 7px 10px; cursor: pointer; }
.bh-cmp-head .bh-cmp-acts button:hover { background: var(--pf-tint-2); }
.bh-cmp-hidden { color: var(--pf-muted); font-weight: 600; font-size: 13px; padding: 30px 6px; }
.bh-cmp-foot { margin: 12px 0 0; font-size: 12px; color: var(--pf-muted); }

@media (max-width: 640px) {
    .bh-cmp-modal { padding: 0; align-items: flex-end; }
    .bh-cmp-win { max-height: 92vh; max-height: 92dvh; border-radius: var(--pf-r-xl) var(--pf-r-xl) 0 0; }
    .bh-cmp-body { padding: 4px 10px 14px; }
    /* eticheta pe un rand intreg, valorile dedesubt pe coloane */
    .bh-cmp-grid { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
    .bh-cmp-lbl { grid-column: 1 / -1; padding: 10px 4px 2px !important; border-bottom: 0 !important; }
    .bh-cmp-lbl.is-blank { display: none !important; }
    .bh-cmp-grid > div { padding: 6px 6px; }
    .bh-cmp-v { font-size: 13px; }
    .bh-cmp-head img { max-height: 70px; }
    .bh-cmp-name { font-size: 13px; }
    .bh-cmp-bar { bottom: 10px; }
}
@media (prefers-reduced-motion: no-preference) {
    .bh-cmp-win { animation: bh-cmp-in .18s ease-out backwards; }
    @keyframes bh-cmp-in { from { opacity: 0; translate: 0 10px; } }
}
