/**
 * WSF Live Chat — storefront widget.
 */

.wsf-live-chat-root {
    --wsf-lc-launcher-bg: #1d2327;
    --wsf-lc-launcher-icon: #fff;
    --wsf-lc-header-bg: #1d2327;
    --wsf-lc-header-text: #fff;
    --wsf-lc-panel-bg: #fff;
    --wsf-lc-panel-text: #1d2327;
    --wsf-lc-visitor-bg: #2271b1;
    --wsf-lc-visitor-text: #fff;
    --wsf-lc-agent-bg: #f0f0f1;
    --wsf-lc-agent-text: #1d2327;
    --wsf-lc-accent: #2271b1;
    --wsf-lc-accent-text: #fff;
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.wsf-live-chat-root--right {
    right: 20px;
    left: auto;
}

.wsf-live-chat-root--left {
    left: 20px;
    right: auto;
}

.wsf-lc-launcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 999px;
    background: var(--wsf-lc-launcher-bg);
    color: var(--wsf-lc-launcher-icon);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    font-weight: 600;
    position: relative;
}

.wsf-lc-launcher__icon {
    font-size: 16px;
    line-height: 1;
}

.wsf-live-chat-root--launcher-round .wsf-lc-launcher {
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
}

.wsf-live-chat-root--launcher-round .wsf-lc-launcher__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wsf-live-chat-root--launcher-round .wsf-lc-launcher__icon {
    font-size: 22px;
}

.wsf-live-chat-root--launcher-round .wsf-lc-panel {
    bottom: 72px;
}

.wsf-live-chat-root--launcher-bubble .wsf-lc-launcher {
    border-radius: 18px;
    padding: 12px 16px 14px;
}

.wsf-live-chat-root--launcher-bubble .wsf-lc-launcher::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 9px solid var(--wsf-lc-launcher-bg);
    filter: drop-shadow(0 2px 2px rgba(15, 23, 42, 0.12));
}

.wsf-live-chat-root--launcher-bubble.wsf-live-chat-root--right .wsf-lc-launcher::after {
    right: 18px;
    left: auto;
}

.wsf-live-chat-root--launcher-bubble.wsf-live-chat-root--left .wsf-lc-launcher::after {
    left: 18px;
    right: auto;
}

.wsf-live-chat-root--launcher-bubble .wsf-lc-panel {
    bottom: 70px;
}

.wsf-lc-panel {
    position: absolute;
    bottom: 58px;
    width: min(360px, calc(100vw - 32px));
    height: min(480px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: var(--wsf-lc-panel-bg);
    color: var(--wsf-lc-panel-text);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.wsf-lc-panel[hidden] {
    display: none !important;
}

.wsf-live-chat-root--right .wsf-lc-panel {
    right: 0;
}

.wsf-live-chat-root--left .wsf-lc-panel {
    left: 0;
}

.wsf-lc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: var(--wsf-lc-header-bg);
    color: var(--wsf-lc-header-text);
}

.wsf-lc-header__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.wsf-lc-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff;
}

.wsf-lc-header__title {
    font-size: 14px;
}

.wsf-lc-header__close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.85;
}

.wsf-lc-messages {
    flex: 1 1 auto;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--wsf-lc-panel-bg);
    scrollbar-gutter: stable;
}

.wsf-lc-msg {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wsf-lc-msg--visitor {
    align-self: flex-end;
    align-items: flex-end;
}

.wsf-lc-msg--agent,
.wsf-lc-msg--system {
    align-self: flex-start;
    align-items: flex-start;
}

.wsf-lc-msg__who {
    font-size: 11px;
    opacity: 0.7;
}

.wsf-lc-msg__bubble {
    padding: 8px 11px;
    border-radius: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.wsf-live-chat-root--bubbles-rounded .wsf-lc-msg--visitor .wsf-lc-msg__bubble {
    background: var(--wsf-lc-visitor-bg);
    color: var(--wsf-lc-visitor-text);
    border-radius: 16px;
    border-bottom-right-radius: 4px;
}

.wsf-live-chat-root--bubbles-rounded .wsf-lc-msg--agent .wsf-lc-msg__bubble {
    background: var(--wsf-lc-agent-bg);
    color: var(--wsf-lc-agent-text);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.wsf-live-chat-root--bubbles-rectangle .wsf-lc-msg--visitor .wsf-lc-msg__bubble {
    background: var(--wsf-lc-visitor-bg);
    color: var(--wsf-lc-visitor-text);
    border-radius: 4px;
}

.wsf-live-chat-root--bubbles-rectangle .wsf-lc-msg--agent .wsf-lc-msg__bubble {
    background: var(--wsf-lc-agent-bg);
    color: var(--wsf-lc-agent-text);
    border-radius: 4px;
}

.wsf-lc-msg--visitor .wsf-lc-msg__bubble {
    background: var(--wsf-lc-visitor-bg);
    color: var(--wsf-lc-visitor-text);
}

.wsf-lc-msg--agent .wsf-lc-msg__bubble {
    background: var(--wsf-lc-agent-bg);
    color: var(--wsf-lc-agent-text);
}

.wsf-lc-msg--system .wsf-lc-msg__bubble {
    background: transparent;
    color: var(--wsf-lc-panel-text);
    opacity: 0.8;
    font-size: 13px;
    padding: 4px 0;
}

.wsf-lc-composer {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--wsf-lc-panel-bg);
}

.wsf-lc-composer__input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    font: inherit;
    outline: none;
    box-shadow: none;
}

.wsf-lc-composer__input:focus,
.wsf-lc-composer__input:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: #c3c4c7 !important;
}

.wsf-lc-composer__send {
    flex: 0 0 auto;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--wsf-lc-accent);
    color: var(--wsf-lc-accent-text);
    font-weight: 600;
    cursor: pointer;
}

.wsf-lc-proactive {
    position: absolute;
    bottom: calc(100% + 10px);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: max-content;
    max-width: min(280px, calc(100vw - 48px));
    margin: 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: var(--wsf-lc-panel-bg);
    color: var(--wsf-lc-panel-text);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    text-align: left;
    cursor: pointer;
    font: inherit;
    z-index: 2;
}

.wsf-lc-proactive[hidden] {
    display: none !important;
}

.wsf-live-chat-root--right .wsf-lc-proactive {
    right: 0;
    left: auto;
}

.wsf-live-chat-root--left .wsf-lc-proactive {
    left: 0;
    right: auto;
}

.wsf-lc-proactive__text {
    flex: 1 1 auto;
    font-size: 13px;
    line-height: 1.35;
}

.wsf-lc-proactive__close {
    flex: 0 0 auto;
    opacity: 0.6;
    font-size: 16px;
    line-height: 1;
}

.wsf-lc-prechat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    overflow: auto;
}

.wsf-lc-prechat[hidden] {
    display: none !important;
}

.wsf-lc-prechat__hint {
    margin: 0;
    font-size: 13px;
    opacity: 0.85;
}

.wsf-lc-prechat__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
}

.wsf-lc-prechat__field input {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    font: inherit;
    font-weight: 400;
}

.wsf-lc-prechat__start {
    margin: 4px 0 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: var(--wsf-lc-accent);
    color: var(--wsf-lc-accent-text);
    font-weight: 600;
    cursor: pointer;
}

.wsf-lc-prechat__error {
    margin: 0;
    color: #8a2424;
    font-size: 12px;
}

.wsf-lc-preview-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    padding: 8px 14px;
    background: #1d2327;
    color: #fff;
    font: 600 13px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wsf-lc-preview-bar--warn {
    background: #8a2424;
}

body.admin-bar .wsf-lc-preview-bar {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .wsf-lc-preview-bar {
        top: 46px;
    }
}
