/* =============================================================
   Sync Broker — Max Home Value Calculator
   BEM-prefixed (sb-mhc__) to avoid theme/Bootstrap collisions.
   ============================================================= */

.sb-mhc {
    --sb-mhc-primary: #000000;
    --sb-mhc-primary-dark: #1a1a1a;
    --sb-mhc-text: #2b2b2b;
    --sb-mhc-muted: #6b7280;
    --sb-mhc-border: #d8dde3;
    --sb-mhc-bg: #ffffff;
    --sb-mhc-bg-alt: #f5f7fa;
    --sb-mhc-error: #c0392b;
    --sb-mhc-radius: 8px;
    --sb-mhc-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.04);

    color: var(--sb-mhc-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.sb-mhc *,
.sb-mhc *::before,
.sb-mhc *::after {
    box-sizing: inherit;
}

/* ---------- Layout ---------- */

.sb-mhc__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

@media (min-width: 992px) {
    .sb-mhc__inner {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: start;
    }

    .sb-mhc__result-col {
        position: sticky;
        top: 16px;
    }
}

/* ---------- Form ---------- */

.sb-mhc__form-col {
    background: var(--sb-mhc-bg);
    border: 1px solid var(--sb-mhc-border);
    border-radius: var(--sb-mhc-radius);
    padding: 24px;
    box-shadow: var(--sb-mhc-shadow);
}

.sb-mhc__section {
    border: none;
    padding: 0;
    margin: 0 0 28px;
}

.sb-mhc__section:last-of-type {
    margin-bottom: 16px;
}

.sb-mhc__section-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    border-bottom: 2px solid #000;
    padding: 0 0 8px;
    margin: 0 0 16px;
    width: 100%;
}

.sb-mhc__required-note {
    font-size: 12px;
    color: var(--sb-mhc-muted);
    margin: -8px 0 16px;
}

.sb-mhc__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 14px;
}

@media (min-width: 576px) {
    .sb-mhc__row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.sb-mhc__field {
    display: flex;
    flex-direction: column;
}

.sb-mhc__field label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--sb-mhc-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sb-mhc__field input[type="text"],
.sb-mhc__field select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 15px;
    color: var(--sb-mhc-text);
    background: var(--sb-mhc-bg);
    border: 1px solid var(--sb-mhc-border);
    border-radius: 6px;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.sb-mhc__field select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%228%22%20viewBox%3D%220%200%2012%208%22%3E%3Cpath%20fill%3D%22%236b7280%22%20d%3D%22M6%208L0%200h12z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.sb-mhc__field input[type="text"]:focus,
.sb-mhc__field select:focus {
    outline: none;
    border-color: var(--sb-mhc-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

.sb-mhc__field.is-invalid input[type="text"],
.sb-mhc__field.is-invalid select {
    border-color: var(--sb-mhc-error);
}

.sb-mhc__field.is-invalid input[type="text"]:focus,
.sb-mhc__field.is-invalid select:focus {
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

.sb-mhc__error {
    font-size: 12px;
    color: var(--sb-mhc-error);
    min-height: 16px;
    margin-top: 4px;
}

.sb-mhc__error:empty {
    display: none;
}

/* Input + suffix combo (e.g. "$ par an", "%") */

.sb-mhc__input-suffix {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb-mhc__input-suffix input {
    flex: 1 1 auto;
    min-width: 0;
}

.sb-mhc__suffix {
    font-size: 13px;
    color: var(--sb-mhc-muted);
    white-space: nowrap;
}

/* Radio row for "limit monthly payments" */

.sb-mhc__radio-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.sb-mhc__radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

.sb-mhc__radio input {
    margin: 0;
    accent-color: var(--sb-mhc-primary);
}

.sb-mhc__limit-amount {
    flex: 1 1 140px;
    min-width: 140px;
}

.sb-mhc__limit-amount input:disabled {
    background: var(--sb-mhc-bg-alt);
    color: var(--sb-mhc-muted);
    cursor: not-allowed;
}

/* Help icon + tooltip */

.sb-mhc__help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--sb-mhc-bg-alt);
    color: var(--sb-mhc-muted);
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    user-select: none;
    position: relative;
    border: 1px solid var(--sb-mhc-border);
}

.sb-mhc__help:hover,
.sb-mhc__help:focus {
    background: var(--sb-mhc-primary);
    color: #fff;
    border-color: var(--sb-mhc-primary);
    outline: none;
}

.sb-mhc__help::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #2b2b2b;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 6px;
    width: 240px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    text-align: left;
    white-space: normal;
}

.sb-mhc__help:hover::after,
.sb-mhc__help:focus::after {
    opacity: 1;
}

/* ---------- Calculate button ---------- */

.sb-mhc__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.sb-mhc__calculate-btn {
    background: var(--sb-mhc-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}

.sb-mhc__calculate-btn:hover {
    background: var(--sb-mhc-primary-dark);
}

.sb-mhc__calculate-btn:active {
    transform: translateY(1px);
}

.sb-mhc__calculate-btn:disabled {
    background: #b0b8c0;
    cursor: not-allowed;
}

/* ---------- Result panel ---------- */

.sb-mhc__result-panel {
    background: var(--sb-mhc-bg);
    border: 1px solid var(--sb-mhc-border);
    border-radius: var(--sb-mhc-radius);
    padding: 24px;
    box-shadow: var(--sb-mhc-shadow);
}

.sb-mhc__result-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #000;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
}

.sb-mhc__result-empty {
    color: var(--sb-mhc-muted);
    font-size: 14px;
    text-align: center;
    padding: 24px 0;
}

.sb-mhc__result-headline {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.02));
    border-left: 3px solid var(--sb-mhc-primary);
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sb-mhc__result-headline .sb-mhc__result-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sb-mhc-primary-dark);
    font-weight: 600;
}

.sb-mhc__result-headline .sb-mhc__result-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--sb-mhc-text);
    line-height: 1.2;
}

.sb-mhc__result-secondary {
    padding: 10px 0;
    border-bottom: 1px solid var(--sb-mhc-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sb-mhc__result-secondary:last-of-type {
    border-bottom: none;
}

.sb-mhc__result-secondary .sb-mhc__result-label {
    font-size: 12px;
    color: var(--sb-mhc-muted);
}

.sb-mhc__result-secondary .sb-mhc__result-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--sb-mhc-text);
}

.sb-mhc__result-note {
    font-size: 11px;
    color: var(--sb-mhc-muted);
    margin-top: 2px;
    font-style: italic;
}

.sb-mhc__result-note:empty {
    display: none;
}

.sb-mhc__details-btn {
    background: none;
    border: none;
    color: var(--sb-mhc-primary);
    text-decoration: underline;
    font-size: 13px;
    cursor: pointer;
    padding: 12px 0 8px;
    text-align: left;
}

.sb-mhc__details-btn:hover {
    color: var(--sb-mhc-primary-dark);
}

.sb-mhc__chart-wrap {
    margin-top: 16px;
    position: relative;
    height: 220px;
}

.sb-mhc__result-warning {
    background: #fff4e6;
    border: 1px solid #f5a623;
    color: #7a4900;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 12px;
}

/* ---------- Modal ---------- */

.sb-mhc__modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sb-mhc__modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.sb-mhc__modal-dialog {
    position: relative;
    background: var(--sb-mhc-bg);
    border-radius: var(--sb-mhc-radius);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.sb-mhc__modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--sb-mhc-border);
}

.sb-mhc__modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--sb-mhc-text);
}

.sb-mhc__modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--sb-mhc-muted);
    padding: 0 4px;
}

.sb-mhc__modal-close:hover {
    color: var(--sb-mhc-text);
}

.sb-mhc__modal-body {
    overflow-y: auto;
    padding: 0;
}

.sb-mhc__schedule {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sb-mhc__schedule thead {
    position: sticky;
    top: 0;
    background: var(--sb-mhc-bg-alt);
    z-index: 1;
}

.sb-mhc__schedule th,
.sb-mhc__schedule td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--sb-mhc-border);
    white-space: nowrap;
}

.sb-mhc__schedule th:first-child,
.sb-mhc__schedule td:first-child,
.sb-mhc__schedule th:nth-child(2),
.sb-mhc__schedule td:nth-child(2) {
    text-align: left;
}

.sb-mhc__schedule th {
    font-weight: 600;
    color: var(--sb-mhc-text);
}

.sb-mhc__schedule tbody tr:nth-child(odd) {
    background: rgba(0, 0, 0, 0.015);
}
