/* Loan Atlas Referral — Popup */

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.lar-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lar-overlay-in 0.18s ease;
}

@keyframes lar-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Modal card ──────────────────────────────────────────────────────────── */
.lar-popup-modal {
    position: relative;
    background: #fff;
    border-radius: var(--lar-radius, 8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    max-width: 520px;
    width: calc(100% - 32px);
    padding: 2rem 2rem 1.75rem;
    font-family: var(--lar-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    animation: lar-modal-in 0.2s ease;
}

@keyframes lar-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Close button ────────────────────────────────────────────────────────── */
.lar-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.9rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--lar-muted, #6b7280);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.lar-popup-close:hover,
.lar-popup-close:focus {
    color: #111;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}

/* ── Popup title ─────────────────────────────────────────────────────────── */
.lar-popup-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
    padding-right: 1.5rem; /* room for close btn */
}

/* ── Popup content ───────────────────────────────────────────────────────── */
.lar-popup-content {
    color: #374151;
    font-size: 0.9375rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.lar-popup-content p:last-child {
    margin-bottom: 0;
}

/* ── CTA button ──────────────────────────────────────────────────────────── */
.lar-popup-cta {
    display: inline-block;
    margin-top: 0.25rem;
    background: var(--lar-primary, #1a56db);
    color: #fff !important;
    text-decoration: none;
    padding: 0.65rem 1.4rem;
    border-radius: var(--lar-radius, 8px);
    font-size: 0.9375rem;
    font-weight: 600;
    transition: background 0.15s;
}

.lar-popup-cta:hover,
.lar-popup-cta:focus {
    background: var(--lar-primary-dk, #1342b0);
    color: #fff !important;
    outline: none;
}

/* ── Login notice ────────────────────────────────────────────────────────── */
.lar-popup-login-notice {
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--lar-muted, #6b7280);
}

.lar-popup-login-notice a {
    color: var(--lar-primary, #1a56db);
    text-decoration: underline;
}

/* ── Trigger button ──────────────────────────────────────────────────────── */
.lar-popup-trigger.lar-btn,
.lar-popup-wrap .lar-popup-trigger {
    background-color: var(--lar-popup-trigger-bg, #1a56db);
    color: #fff;
    cursor: pointer;
}

.lar-popup-wrap .lar-popup-trigger:hover {
    background-color: var(--lar-popup-trigger-hover, #1342b0);
}

/* ── Position variants ───────────────────────────────────────────────────── */

/* Left side panel */
.lar-popup-overlay[data-position="left"] {
    justify-content: flex-start;
    align-items: stretch;
}

.lar-popup-overlay[data-position="left"] .lar-popup-modal {
    max-width: 420px;
    width: calc(100% - 32px);
    height: 100%;
    border-radius: 0 var(--lar-radius, 8px) var(--lar-radius, 8px) 0;
    animation: lar-modal-in-left 0.25s ease;
    overflow-y: auto;
}

@keyframes lar-modal-in-left {
    from {
        opacity: 0;
        transform: translateX(-32px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Right side panel */
.lar-popup-overlay[data-position="right"] {
    justify-content: flex-end;
    align-items: stretch;
}

.lar-popup-overlay[data-position="right"] .lar-popup-modal {
    max-width: 420px;
    width: calc(100% - 32px);
    height: 100%;
    border-radius: var(--lar-radius, 8px) 0 0 var(--lar-radius, 8px);
    animation: lar-modal-in-right 0.25s ease;
    overflow-y: auto;
}

@keyframes lar-modal-in-right {
    from {
        opacity: 0;
        transform: translateX(32px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
    .lar-popup-modal {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .lar-popup-title {
        font-size: 1.1rem;
    }
}

/* ── Floating Widget (Hotjar-style side tab + expand panel) ──────────────── */
.lar-floating-widget {
    position: fixed;
    top: var(--lar-fw-offset, 200px);
    z-index: 99998;
    display: flex;
    align-items: flex-start;
}

.lar-floating-widget--left {
    left: 0;
    flex-direction: row;
}

.lar-floating-widget--right {
    right: 0;
    flex-direction: row-reverse;
}

/* ── Tab (the vertical side label) ─────────────────────────────────────── */
.lar-fw-tab {
    flex-shrink: 0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 16px 10px;
    background-color: var(--lar-popup-trigger-bg, #1a56db);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--lar-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    letter-spacing: 0.02em;
    transition: background-color 0.15s;
    line-height: 1.2;
}

/* Left side: text reads bottom-to-top */
.lar-floating-widget--left .lar-fw-tab {
    transform: rotate(180deg);
    border-radius: 0 var(--lar-radius, 8px) var(--lar-radius, 8px) 0;
}

/* Right side: text reads top-to-bottom (natural vertical-rl direction) */
.lar-floating-widget--right .lar-fw-tab {
    border-radius: var(--lar-radius, 8px) 0 0 var(--lar-radius, 8px);
}

.lar-fw-tab:hover,
.lar-fw-tab:focus {
    background-color: var(--lar-popup-trigger-hover, #1342b0);
    outline: none;
}

/* ── Expand panel ───────────────────────────────────────────────────────── */
.lar-fw-panel {
    width: 0;
    max-height: calc(100vh - var(--lar-fw-offset, 200px) - 20px);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    transition: width 0.3s ease;
    font-family: var(--lar-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.lar-floating-widget--left .lar-fw-panel {
    border-radius: 0 var(--lar-radius, 8px) var(--lar-radius, 8px) 0;
}

.lar-floating-widget--right .lar-fw-panel {
    border-radius: var(--lar-radius, 8px) 0 0 var(--lar-radius, 8px);
}

.lar-floating-widget.is-open .lar-fw-panel {
    width: 320px;
    overflow-y: auto;
}

/* ── Panel inner content ────────────────────────────────────────────────── */
.lar-fw-panel-inner {
    position: relative;
    padding: 1.5rem 1.5rem 1.25rem;
    min-width: 320px; /* prevents text wrapping during the slide animation */
}

/* ── Panel close button ─────────────────────────────────────────────────── */
.lar-fw-close {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--lar-muted, #6b7280);
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.lar-fw-close:hover,
.lar-fw-close:focus {
    color: #111;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}

/* ── Responsive (floating widget) ──────────────────────────────────────── */
@media (max-width: 540px) {
    .lar-floating-widget.is-open .lar-fw-panel {
        width: calc(100vw - 44px); /* full width minus tab */
    }

    .lar-fw-panel-inner {
        min-width: 0;
    }
}
