/* ─────────────────────────────────────────────────────────────────────────
   residence_history.css
   Styles for the residence history form field (auto-repeating address
   blocks) — the address-side twin of employment_history.css. Loaded lazily
   by class.forms.php only when a residence_history field is present.
───────────────────────────────────────────────────────────────────────── */

/* ── Alignment guard ─────────────────────────────────────────────────────── */
/* Dealer themes and page-builder sections sometimes center text on the
   container holding the form; the widget pins itself back to the left so
   labels stay beside their inputs. */
.gbuc-res-wrap,
.gbuc-res-label,
.gbuc-res-intro {
    text-align: left;
}
.gbuc-res-label {
    display: block;
}

/* ── Honest required stars ──────────────────────────────────────────────── */
/* Stars are always in the markup but shown only when the widget is required
   or an optional widget has been engaged (any data entered) — the exact
   moments validation enforces those fields. */
.gbuc-res-wrap .gbuc-res-star {
    display: none;
}
.gbuc-res-wrap.gbuc-res-required .gbuc-res-star,
.gbuc-res-wrap.gbuc-res-engaged .gbuc-res-star {
    display: inline;
}

/* ── Address block card ──────────────────────────────────────────────────── */
.gbuc-res-block {
    position: relative;
    padding: 0.85rem 1rem 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: 4px solid #0d6efd;
    border-radius: 0.5rem;
    animation: gbuc-res-fade-in 0.25s ease;
}
.gbuc-res-block + .gbuc-res-block {
    border-left-color: #6c9bd8;
}

@keyframes gbuc-res-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Block header row ────────────────────────────────────────────────────── */
.gbuc-res-block-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.gbuc-res-block-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: #212529;
    min-width: 0;
}
.gbuc-res-block-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #0a58ca;
    background: #f0f6ff;
    border: 1px solid #cde0ff;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    white-space: nowrap;
}
.gbuc-res-remove {
    margin-left: auto;
    background: none;
    border: none;
    padding: 0.15rem 0.35rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    border-radius: 0.25rem;
    flex-shrink: 0;
}
.gbuc-res-remove:hover {
    color: #dc3545;
    background: #f8f9fa;
}

/* ── Coverage status ─────────────────────────────────────────────────────── */
.gbuc-res-status {
    margin-bottom: 0.5rem;
}
.gbuc-res-progress {
    height: 6px;
    background: #e9ecef;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}
.gbuc-res-progress-bar {
    height: 100%;
    width: 0;
    background: #f59e0b;
    border-radius: 999px;
    transition: width 0.25s ease, background 0.25s ease;
}
.gbuc-res-status-text {
    color: #6c757d;
}
.gbuc-res-status.gbuc-res-covered .gbuc-res-progress-bar {
    background: #16a34a;
}
.gbuc-res-status.gbuc-res-covered .gbuc-res-status-text {
    color: #16a34a;
}

/* ── Opt-out checkbox ────────────────────────────────────────────────────── */
.gbuc-res-optout {
    padding-top: 0.1rem;
    margin-bottom: 0.25rem;
}

/* ── Inline field errors (live red warnings) ────────────────────────────── */
.gbuc-res-field-error {
    color: #dc3545;
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: 0.2rem;
}
.gbuc-res-block .form-control.is-invalid,
.gbuc-res-block .form-select.is-invalid {
    border-color: #dc3545;
}
