/**
 * Loan Calculator — Minimal CSS
 *
 * INTENTIONALLY UNSTYLED beyond the structural rules required for:
 *   1. The modal mode to function correctly (positioning, overlay, hidden state).
 *   2. The $ and % adornments to appear inside the relevant input wrappers.
 *
 * All visual styling — colors, typography, spacing, borders, layout — is left
 * to the site's designer.
 *
 * --------------------------------------------------------------------------
 * CLASS HOOK REFERENCE (for the designer)
 * --------------------------------------------------------------------------
 *
 * Wrappers:
 *   .sr-loan-calc                       Root wrapper for any instance.
 *   .sr-loan-calc--inline               Modifier: rendered inline on the page.
 *   .sr-loan-calc--modal                Modifier: rendered as a modal overlay.
 *   .sr-loan-calc.is-open               Applied to modal instance when visible.
 *
 *   .sr-loan-calc__open-btn             The trigger button for modal mode.
 *   .sr-loan-calc__backdrop             Modal backdrop (click to close).
 *   .sr-loan-calc__panel                Inner panel that holds the form.
 *   .sr-loan-calc__close-btn            Modal close button.
 *
 * Layout:
 *   .sr-loan-calc__header               Wraps the title.
 *   .sr-loan-calc__title                <h3> calculator heading.
 *   .sr-loan-calc__body                 Wraps fields + results.
 *   .sr-loan-calc__fields               Container for all input fields.
 *   .sr-loan-calc__results              Container for the three output values.
 *
 * Per-field:
 *   .sr-loan-calc__field                Each field wrapper.
 *   .sr-loan-calc__field--amount
 *   .sr-loan-calc__field--term
 *   .sr-loan-calc__field--rate
 *   .sr-loan-calc__field--balloon       (down payment field — class name retained
 *                                        from prior version for stylesheet stability)
 *   .sr-loan-calc__label                <label> element.
 *   .sr-loan-calc__input-wrap           Wraps the input.
 *   .sr-loan-calc__input-wrap--currency  Renders a leading "$" adornment.
 *   .sr-loan-calc__input-wrap--percent   Renders a trailing "%" adornment.
 *   .sr-loan-calc__input                 The input element itself.
 *
 * Per-result:
 *   .sr-loan-calc__result               Wrapper for one result row.
 *   .sr-loan-calc__result--payment
 *   .sr-loan-calc__result--interest
 *   .sr-loan-calc__result--total
 *   .sr-loan-calc__result-label         The label text.
 *   .sr-loan-calc__result-value         The dollar value (live-updated by JS).
 *
 * Body state:
 *   body.sr-loan-calc-modal-open        Applied to <body> when any modal is open.
 *
 * --------------------------------------------------------------------------
 */

/* ---- Structural: hidden state ---- */
.sr-loan-calc[hidden] {
    display: none !important;
}

/* ---- Structural: modal positioning ---- */
.sr-loan-calc--modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-loan-calc--modal .sr-loan-calc__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.sr-loan-calc--modal .sr-loan-calc__panel {
    position: relative;
    z-index: 1;
    max-height: 90vh;
    overflow-y: auto;
}

.sr-loan-calc--modal .sr-loan-calc__close-btn {
    position: absolute;
    top: 0;
    right: 0;
}

/* ---- Adornments: $ prefix on currency inputs, % suffix on rate ---- */
/*
 * These rules render the $ / % markers using ::before / ::after on the
 * input wrapper. They use absolute positioning so the marker overlays the
 * left/right edge of the input without entering the input's own value.
 *
 * The designer can override appearance (color, font, size, spacing) but
 * the structural positioning here keeps the adornments visible in any
 * styling pass.
 */
.sr-loan-calc__input-wrap--currency,
.sr-loan-calc__input-wrap--percent {
    position: relative;
    display: inline-block;
}

.sr-loan-calc__input-wrap--currency .sr-loan-calc__input {
    padding-left: 1.4em;
}

.sr-loan-calc__input-wrap--percent .sr-loan-calc__input {
    padding-right: 1.4em;
}

.sr-loan-calc__input-wrap--currency::before {
    content: "$";
    position: absolute;
    left: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    line-height: 1;
}

.sr-loan-calc__input-wrap--percent::after {
    content: "%";
    position: absolute;
    right: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    line-height: 1;
}

/* End of structural CSS. Everything below the line is the designer's territory. */
