/* ==========================================================
   RR Output Heating Calculator — Stylesheet v1.0.7
   Author: Matei Georgian Alex
   ========================================================== */

:root {
    --rr-primary:       #800020;   /* Burgundy */
    --rr-primary-dark:  #5e0018;
    --rr-primary-light: #f3e1e5;   /* soft burgundy tint */
    --rr-accent:        #D9B382;   /* Gold */
    --rr-accent-dark:   #c39a63;
    --rr-secondary:     #F5F5F5;
    --rr-dark:          #1A1A1A;   /* dark surfaces / text */
    --rr-dark-2:        #333333;   /* Dark Grey */
    --rr-bg:            #F9F9F9;   /* Background alt */
    --rr-card-bg:       #FFFFFF;   /* Background light */
    --rr-border:        #e6e2dc;   /* warm light border */
    --rr-text:          #1A1A1A;
    --rr-text-muted:    #6b6b6b;
    --rr-success:       #2e7d32;
    --rr-error:         #c0392b;   /* functional alert red */
    --rr-radius:        10px;
    --rr-shadow:        0 2px 16px rgba(26,26,26,0.07);
    --rr-tr:            all 0.22s ease;
    --rr-font-head:     "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --rr-font-body:     "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.rr-btu-wrap {
    font-family: var(--rr-font-body);
    max-width: min(1080px, 92vw);
    margin: 0 auto;
    color: var(--rr-text);
    line-height: 1.55;
}

/* ── Header ──────────────────────────────────────────────── */
.rr-btu-header   { text-align: center; margin-bottom: 32px; }
.rr-btu-title    {
    font-family: var(--rr-font-head);
    font-size: 2.6rem; font-weight: 600; letter-spacing: 0.01em;
    color: var(--rr-dark); margin: 0 0 8px;
}
.rr-btu-subtitle { font-size: 0.97rem; color: var(--rr-text-muted); margin: 0; }

/* ── Form card ───────────────────────────────────────────── */
.rr-btu-form {
    background: var(--rr-card-bg);
    border-radius: var(--rr-radius);
    box-shadow: var(--rr-shadow);
    padding: 32px;
    border: 1px solid var(--rr-border);
}

.rr-btu-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rr-border);
}
.rr-btu-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.rr-btu-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--rr-dark);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.rr-btu-step {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--rr-primary);
    color: #fff;
    font-size: 0.75rem; font-weight: 700;
    display: inline-flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Dimension inputs ────────────────────────────────────── */
.rr-btu-fields-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
@media (max-width: 560px) { .rr-btu-fields-row { grid-template-columns: 1fr; } }

.rr-btu-field label {
    display: block; font-size: 0.78rem; font-weight: 600;
    color: var(--rr-text-muted); margin-bottom: 5px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.rr-btu-field input[type="number"] {
    width: 100%; padding: 11px 13px;
    border: 2px solid var(--rr-border);
    border-radius: 7px; font-size: 1rem;
    font-family: var(--rr-font-body);
    background: var(--rr-bg); box-sizing: border-box;
    transition: var(--rr-tr);
}
.rr-btu-field input[type="number"]:focus {
    border-color: var(--rr-primary); outline: none;
    background: #fff; box-shadow: 0 0 0 3px rgba(128,0,32,0.10);
}
.rr-btu-area-preview {
    margin-top: 10px; display: flex; gap: 18px;
    font-size: 0.85rem; color: var(--rr-text-muted);
    background: var(--rr-bg); padding: 9px 13px; border-radius: 6px;
}
.rr-btu-area-preview strong { color: var(--rr-primary); font-weight: 700; }

/* ── Radio cards ─────────────────────────────────────────── */
.rr-btu-radio-group { display: flex; flex-wrap: wrap; gap: 9px; }

.rr-btu-radio-card {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 5px; padding: 12px 16px;
    border: 2px solid var(--rr-border); border-radius: 9px;
    cursor: pointer; transition: var(--rr-tr);
    background: var(--rr-card-bg); min-width: 100px;
    text-align: center; user-select: none;
}
.rr-btu-radio-card:hover { border-color: var(--rr-primary); background: var(--rr-primary-light); }
.rr-btu-radio-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.rr-btu-radio-card.is-selected,
.rr-btu-radio-card:has(input:checked) {
    border-color: var(--rr-primary); background: var(--rr-primary-light);
    box-shadow: 0 0 0 3px rgba(128,0,32,0.12);
}
.rr-btu-radio-label { font-size: 0.82rem; font-weight: 500; color: var(--rr-dark); line-height: 1.3; }
.rr-btu-radio-card.rr-btu-small { min-width: 75px; padding: 9px 12px; }

.rr-btu-radio-icon { font-size: 1.5rem; line-height: 1; }
.rr-icon-living::before   { content: "🛋️"; }
.rr-icon-bedroom::before  { content: "🛏️"; }
.rr-icon-bathroom::before { content: "🚿"; }
.rr-icon-kitchen::before  { content: "🍳"; }
.rr-icon-hallway::before  { content: "🚪"; }
.rr-icon-office::before   { content: "💼"; }
.rr-icon-basement::before { content: "🏚️"; }

/* ── Select ──────────────────────────────────────────────── */
.rr-btu-select-group select {
    width: 100%; padding: 11px 38px 11px 13px;
    border: 2px solid var(--rr-border); border-radius: 7px;
    font-size: 0.97rem; font-family: var(--rr-font-body);
    background: var(--rr-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23800020' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 13px center;
    appearance: none; cursor: pointer; transition: var(--rr-tr);
    color: var(--rr-text);
}
.rr-btu-select-group select:focus {
    border-color: var(--rr-primary); outline: none;
    background-color: #fff; box-shadow: 0 0 0 3px rgba(128,0,32,0.10);
}

/* ── Submit ──────────────────────────────────────────────── */
.rr-btu-submit-wrap { padding-top: 8px; }

.rr-btu-btn {
    display: inline-flex; align-items: center;
    justify-content: center; gap: 8px;
    padding: 13px 28px; border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    font-family: var(--rr-font-body);
    transition: var(--rr-tr); text-decoration: none; line-height: 1;
}
.rr-btu-btn-primary {
    background: var(--rr-primary); color: #fff;
    width: 100%; font-size: 1.05rem; padding: 15px;
    letter-spacing: 0.02em;
}
.rr-btu-btn-primary:hover { background: var(--rr-primary-dark); box-shadow: 0 5px 18px rgba(128,0,32,0.28); }
.rr-btu-btn-primary:disabled { opacity: 0.65; cursor: not-allowed; box-shadow: none; }

.rr-btu-btn-secondary {
    background: var(--rr-bg); color: var(--rr-dark);
    border: 2px solid var(--rr-border); padding: 11px 22px; font-size: 0.9rem;
}
.rr-btu-btn-secondary:hover { border-color: var(--rr-primary); color: var(--rr-primary); }

.rr-btu-btn-spinner {
    width: 17px; height: 17px;
    border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
    border-radius: 50%; animation: rr-spin 0.7s linear infinite;
}
@keyframes rr-spin { to { transform: rotate(360deg); } }

/* ── Results ─────────────────────────────────────────────── */
.rr-btu-results { margin-top: 24px; animation: rr-fadeIn 0.35s ease; }
@keyframes rr-fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

.rr-btu-result-box {
    background: var(--rr-dark); border-radius: var(--rr-radius);
    padding: 24px 28px; margin-bottom: 28px; color: #fff;
    border-top: 3px solid var(--rr-accent);
}
.rr-btu-result-inner {
    display: grid; grid-template-columns: 1fr 1px 1fr 1px 1fr; margin-bottom: 14px;
}
@media (max-width: 560px) {
    .rr-btu-result-inner { grid-template-columns: 1fr; }
    .rr-btu-result-divider { display: none; }
}
.rr-btu-result-col { display:flex; flex-direction:column; align-items:center; text-align:center; padding: 10px 16px; }
.rr-btu-result-divider { background: rgba(255,255,255,0.15); width:1px; margin: 8px 0; }
.rr-btu-result-label { font-size: 0.75rem; text-transform:uppercase; letter-spacing:0.06em; opacity:0.65; margin-bottom:6px; }
.rr-btu-result-value {
    font-family: var(--rr-font-head);
    font-size: 2.6rem; font-weight: 600; line-height: 1;
    color: var(--rr-accent);
}
.rr-btu-result-unit  { font-size: 0.82rem; opacity:0.55; margin-top:4px; }
.rr-btu-result-note  { font-size:0.75rem; opacity:0.5; margin:0; text-align:center; font-style:italic; }

/* ── Section headings ────────────────────────────────────── */
.rr-btu-products-wrap    { margin-bottom: 28px; }
.rr-btu-products-title   {
    font-family: var(--rr-font-head);
    font-size: 1.75rem; font-weight: 600; color: var(--rr-dark); margin: 0 0 4px;
}
.rr-btu-products-subtitle { font-size: 0.88rem; color: var(--rr-text-muted); margin: 0 0 18px; }

/* ── TABLE ───────────────────────────────────────────────── */
.rr-btu-table-wrap {
    overflow-x: auto;
    border-radius: var(--rr-radius);
    border: 1px solid var(--rr-border);
    box-shadow: var(--rr-shadow);
    width: 85%;          /* 85% of the container */
    margin: 0 auto;      /* centred */
}

table.rr-btu-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--rr-card-bg);
    font-size: 0.92rem;
}
table.rr-btu-table thead th {
    background: var(--rr-dark); color: #fff; font-weight: 600;
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 13px 14px; text-align: left; white-space: nowrap;
}
table.rr-btu-table thead th:first-child { border-radius: 9px 0 0 0; }
table.rr-btu-table thead th:last-child  { border-radius: 0 9px 0 0; }
table.rr-btu-table tbody tr { border-bottom: 1px solid var(--rr-border); transition: background 0.15s; }
table.rr-btu-table tbody tr:last-child { border-bottom: none; }
table.rr-btu-table tbody tr:hover { background: var(--rr-bg); }
table.rr-btu-table td { padding: 12px 14px; vertical-align: middle; color: var(--rr-text); }

.rr-btu-td-img { width: 70px; text-align: center; }
.rr-btu-td-img a { display: block; }
.rr-btu-td-img img {
    width: 60px; height: 60px; object-fit: contain;
    border-radius: 6px; border: 1px solid var(--rr-border);
    background: #fff; padding: 3px; transition: var(--rr-tr);
}
.rr-btu-td-img img:hover { border-color: var(--rr-primary); }
.rr-btu-td-sku { font-family: monospace; font-size: 0.83rem; color: var(--rr-text-muted); white-space: nowrap; }
.rr-btu-td-num    { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rr-btu-td-output { text-align: right; white-space: nowrap; font-weight: 700; color: var(--rr-primary); }
.rr-btu-td-cart   { text-align: center; white-space: nowrap; }
.rr-th-r { text-align: right !important; }
.rr-th-c { text-align: center !important; }

/* ── Add to cart buttons ─────────────────────────────────── */
.rr-btu-atc-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 14px; background: var(--rr-primary);
    color: #fff !important; border: none; border-radius: 6px;
    font-size: 0.82rem; font-weight: 600; cursor: pointer;
    font-family: var(--rr-font-body);
    text-decoration: none !important; transition: var(--rr-tr); line-height: 1;
    white-space: nowrap;
}
.rr-btu-atc-btn:hover    { background: var(--rr-primary-dark); box-shadow: 0 3px 10px rgba(128,0,32,0.25); }
.rr-btu-atc-btn.rr-adding { opacity: 0.75; pointer-events: none; }
.rr-btu-atc-btn.rr-added  { background: var(--rr-success); pointer-events: none; }

/* Smaller variant used inside group rows */
.rr-btu-atc-sm { padding: 6px 10px; font-size: 0.76rem; }

/* ── Match badges ────────────────────────────────────────── */
.rr-btu-match-badge {
    display: inline-block; margin-left: 6px; padding: 2px 7px;
    border-radius: 20px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.03em; vertical-align: middle;
}
.rr-btu-match-perfect   { background: var(--rr-primary); color: #fff; }
.rr-btu-match-excellent { background: var(--rr-accent);  color: var(--rr-dark); }
.rr-btu-match-good      { background: var(--rr-secondary); color: var(--rr-dark-2); }

/* ── No products ─────────────────────────────────────────── */
.rr-btu-no-products {
    text-align: center; padding: 36px 20px;
    background: var(--rr-bg); border-radius: var(--rr-radius);
    border: 2px dashed var(--rr-border); color: var(--rr-text-muted);
}
.rr-btu-no-products p { margin: 0; font-size: 0.95rem; }

/* ── Recalculate ─────────────────────────────────────────── */
.rr-btu-recalculate-wrap { text-align: center; margin-top: 24px; }

/* ── Validation ──────────────────────────────────────────── */
.rr-btu-error { color: var(--rr-error); font-size: 0.78rem; display: block; margin-top: 4px; }
.rr-btu-global-error {
    background: #fde8e8; border: 1px solid var(--rr-error); color: #96281b;
    padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 0.88rem;
}

/* ════════════════════════════════════════════════════════════
   GROUP SUGGESTIONS — unified table, groups separated by rows
   ════════════════════════════════════════════════════════════ */
.rr-btu-groups-wrap {
    margin-top: 32px;
}
.rr-btu-groups-wrap .rr-btu-products-title::before { content: "⚡ "; }

/* Group header row — coloured band labelling each combination */
.rr-grp-header-row td.rr-grp-header-cell {
    background: var(--rr-primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 8px 14px;
}

/* Radiator rows inside a group */
.rr-grp-rad-row td {
    border-left: 3px solid transparent;
    background: #faf7f3;
}
.rr-grp-rad-row:hover td { background: #f6efe8; }

/* Last radiator row in a group has a stronger bottom border */
.rr-grp-last td {
    border-bottom: 2px solid var(--rr-border) !important;
}

/* "+" badge shown inline in the Output cell for non-last rows */
.rr-grp-plus-inline {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--rr-primary-light);
    color: var(--rr-primary);
    font-size: 0.8rem;
    font-weight: 800;
    vertical-align: middle;
}

/* Total / summary row for each group */
.rr-grp-total-row td {
    background: var(--rr-primary-light);
    border-bottom: 3px solid var(--rr-border);
    padding-top: 10px;
    padding-bottom: 10px;
}
.rr-grp-sum-cell {
    font-size: 1rem;
}
.rr-grp-sum-label {
    font-size: 0.72rem;
    color: var(--rr-text-muted);
    font-weight: 400;
    margin-left: 4px;
}

/* Spacer row between groups */
.rr-grp-spacer td {
    height: 12px;
    background: var(--rr-bg);
    border: none !important;
}

/* "Add all" button — dark variant with gold edge */
.rr-btu-grp-atc {
    background: var(--rr-dark);
    box-shadow: inset 0 0 0 1px var(--rr-accent);
}
.rr-btu-grp-atc:hover {
    background: var(--rr-dark-2);
    box-shadow: inset 0 0 0 1px var(--rr-accent), 0 3px 10px rgba(26,26,26,0.3);
}

/* Smaller "Add" button used per-radiator row */
.rr-btu-atc-sm { padding: 6px 10px; font-size: 0.76rem; }

/* ── Responsive tweaks ───────────────────────────────────── */
@media (max-width: 640px) {
    .rr-btu-wrap       { max-width: 100%; }
    .rr-btu-table-wrap { width: 100%; }
    .rr-btu-title      { font-size: 2.1rem; }
}
