/* Live chat widget — compact docked panel */
.lc-widget {
    position: fixed;
    right: 88px;
    bottom: calc(16px + var(--lc-pwa-clearance, 0px) + env(safe-area-inset-bottom, 0px));
    z-index: 9200;
    width: 288px;
    max-width: calc(100vw - 100px);
    pointer-events: none;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
}

.lc-widget:not([hidden]) {
    pointer-events: auto;
}

.lc-widget__panel {
    display: flex;
    flex-direction: column;
    height: 360px;
    max-height: min(360px, calc(100vh - 80px));
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.48);
    background: #121221;
}

.lc-widget__head {
    flex-shrink: 0;
    background: #1c1c2b;
    color: #fff;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.lc-widget__agent {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.lc-widget__avatar-box {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.lc-widget__avatar {
    width: 32px;
    height: 32px;
    border-radius: 5px;
    object-fit: cover;
    display: block;
    background: #2f6fed;
}

.lc-widget__online {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ecf6d;
    border: 1.5px solid #1c1c2b;
}

.lc-widget__agent-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.lc-widget__agent-name {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lc-widget__agent-role {
    margin-top: 1px;
    font-size: 10px;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lc-widget__head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.lc-widget__win-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    width: 22px;
    height: 22px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.lc-widget__win-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.lc-widget__brand-mark {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lc-widget__brand-favicon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.lc-widget__brand-fallback {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: linear-gradient(135deg, #2f6fed, #1d4ed8);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lc-widget__powered-favicon {
    width: 11px;
    height: 11px;
    object-fit: contain;
    display: block;
    border-radius: 2px;
}

.lc-widget__transcript {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #121221;
    padding: 10px 10px 6px;
    scroll-behavior: smooth;
}

.lc-widget__transcript::-webkit-scrollbar {
    width: 4px;
}

.lc-widget__transcript::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.lc-msg {
    margin-bottom: 10px;
}

.lc-msg__meta {
    font-size: 10px;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.38);
    margin-bottom: 2px;
}

.lc-msg__text {
    font-size: 12px;
    line-height: 1.4;
    color: #5897e0;
    word-break: break-word;
}

.lc-msg--user .lc-msg__meta,
.lc-msg--user .lc-msg__text {
    text-align: right;
}

.lc-msg--user .lc-msg__text {
    color: #d0d6e0;
}

.lc-msg--system .lc-msg__text {
    color: rgba(255, 255, 255, 0.42);
    font-size: 11px;
}

.lc-widget__bottom {
    flex-shrink: 0;
    background: #fff;
    border-radius: 0 0 10px 10px;
}

.lc-widget__compose {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px 5px;
}

.lc-widget__field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.lc-widget__input {
    flex: 1;
    min-width: 0;
    border: none;
    resize: none;
    outline: none;
    font: inherit;
    font-size: 12px;
    line-height: 1.35;
    max-height: 56px;
    padding: 4px 0;
    color: #111;
    background: transparent;
}

.lc-widget__input::placeholder {
    color: #a8adb5;
    font-size: 11px;
}

.lc-widget__send {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #eceef1;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
}

.lc-widget__send:hover:not(:disabled) {
    background: #e2e5ea;
}

.lc-widget__send:disabled {
    opacity: 0.55;
    cursor: default;
}

.lc-widget__powered {
    text-align: center;
    font-size: 9px;
    line-height: 1;
    color: #a0a5ad;
    padding: 0 8px 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.lc-widget__powered-brand {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #7a8088;
    font-weight: 600;
    font-size: 9px;
}

.lc-widget.is-minimized .lc-widget__panel {
    display: none;
}

.lc-widget.is-minimized:not([hidden]) {
    pointer-events: auto;
}

/* Landing: chat stacks above PWA install chip */
body.landing-body:has(.eo-auth-content) .lc-widget {
    z-index: 50;
}

body.landing-body:has(#pwa-install-banner.is-visible) .lc-widget:not([hidden]) {
    --lc-pwa-clearance: 58px;
}

#dash-rnav-chat.is-active {
    color: #7eb8ff;
    background: rgba(126, 184, 255, 0.14);
}

@media (max-width: 900px) {
    .lc-widget {
        right: 12px;
        bottom: calc(12px + var(--lc-pwa-clearance, 0px) + env(safe-area-inset-bottom, 0px));
        width: min(320px, calc(100% - 24px));
        max-width: calc(100% - 24px);
    }

    .lc-widget__panel {
        height: min(360px, calc(100dvh - 96px - var(--lc-pwa-clearance, 0px)));
        max-height: min(360px, calc(100dvh - 96px - var(--lc-pwa-clearance, 0px)));
    }
}

@media (max-width: 768px) {
    body.landing-body .lc-widget:not([hidden]) {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }

    body.landing-body .lc-widget__panel {
        height: min(440px, calc(100dvh - 76px - var(--lc-pwa-clearance, 0px)));
        max-height: min(440px, calc(100dvh - 76px - var(--lc-pwa-clearance, 0px)));
        border-radius: 14px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    }
}
