/* Lensiora Support Chat widget */
#lnsr-support-chat-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.lnsr-chat-launcher {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--lnsr-chat-launcher-bg, #f97316);
    color: var(--lnsr-chat-launcher-text, #fff);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.lnsr-chat-launcher:hover {
    transform: scale(1.06);
    background: var(--lnsr-chat-launcher-hover-bg, #ea580c);
}

.lnsr-chat-launcher-attention {
    animation: lnsr-chat-vibrate var(--lnsr-chat-vibrate-duration, 0.9s) ease-in-out 1;
}

@keyframes lnsr-chat-vibrate {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(calc(var(--lnsr-chat-vibrate-distance, 6px) * -1)) rotate(calc(var(--lnsr-chat-vibrate-rotation, 8deg) * -1)); }
    20% { transform: translateX(var(--lnsr-chat-vibrate-distance, 6px)) rotate(var(--lnsr-chat-vibrate-rotation, 8deg)); }
    30% { transform: translateX(calc(var(--lnsr-chat-vibrate-distance, 6px) * -1)) rotate(calc(var(--lnsr-chat-vibrate-rotation, 8deg) * -1)); }
    40% { transform: translateX(var(--lnsr-chat-vibrate-distance, 6px)) rotate(var(--lnsr-chat-vibrate-rotation, 8deg)); }
    52% { transform: translateX(calc(var(--lnsr-chat-vibrate-distance, 6px) * -0.67)) rotate(calc(var(--lnsr-chat-vibrate-rotation, 8deg) * -0.75)); }
    64% { transform: translateX(calc(var(--lnsr-chat-vibrate-distance, 6px) * 0.67)) rotate(calc(var(--lnsr-chat-vibrate-rotation, 8deg) * 0.75)); }
    76% { transform: translateX(calc(var(--lnsr-chat-vibrate-distance, 6px) * -0.33)) rotate(calc(var(--lnsr-chat-vibrate-rotation, 8deg) * -0.38)); }
    88% { transform: translateX(calc(var(--lnsr-chat-vibrate-distance, 6px) * 0.33)) rotate(calc(var(--lnsr-chat-vibrate-rotation, 8deg) * 0.38)); }
    96% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .lnsr-chat-launcher-attention {
        animation: none;
    }
}

.lnsr-chat-teaser {
    position: relative;
    max-width: 250px;
    margin-bottom: 10px;
    background: var(--lnsr-chat-teaser-bg, #1d4e89);
    color: var(--lnsr-chat-teaser-text, #fff);
    border: 1px solid var(--lnsr-chat-teaser-border, #163c6b);
    border-radius: 12px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    padding: 10px 28px 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
}

.lnsr-chat-teaser[hidden],
.lnsr-chat-launcher[hidden],
.lnsr-chat-panel[hidden] {
    display: none;
}

.lnsr-chat-teaser-close {
    position: absolute;
    top: 4px;
    right: 6px;
    border: 0;
    background: transparent;
    color: var(--lnsr-chat-teaser-close, rgba(255, 255, 255, 0.7));
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

.lnsr-chat-teaser-close:hover {
    color: var(--lnsr-chat-teaser-close-hover, #fff);
}

.lnsr-chat-panel {
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lnsr-chat-header {
    background: #1d4e89;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lnsr-chat-header-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.lnsr-chat-header-text strong {
    font-size: 15px;
}

.lnsr-chat-header-text span {
    font-size: 11px;
    opacity: 0.85;
}

.lnsr-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.lnsr-chat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}

.lnsr-chat-restart {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    opacity: 0.85;
}

.lnsr-chat-restart:hover {
    opacity: 1;
}

.lnsr-chat-restart-confirm {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    opacity: 1;
}

.lnsr-chat-guest {
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: transparent;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    opacity: 0.85;
    white-space: nowrap;
}

.lnsr-chat-guest:hover {
    opacity: 1;
}

.lnsr-chat-guest-on {
    background: #b7791f;
    border-color: #b7791f;
    opacity: 1;
}

.lnsr-chat-login-hint {
    max-width: 85%;
    margin: -2px 0 10px 4px;
    font-size: 11.5px;
    line-height: 1.4;
    text-align: left;
    color: #64748b;
}

.lnsr-chat-login-hint a {
    color: #1d4e89;
    font-weight: 600;
}

.lnsr-chat-testmode {
    background: #b7791f;
    color: #fff;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-align: center;
    padding: 3px 6px;
}

.lnsr-chat-ai-engine {
    background: #edf2f7;
    color: #2d3748;
    font-size: 10px;
    letter-spacing: 0.04em;
    text-align: center;
    padding: 3px 6px;
    text-transform: uppercase;
}

.lnsr-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f5f7fa;
}

.lnsr-chat-msg {
    max-width: 85%;
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: normal;
}

.lnsr-chat-msg-agent {
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    margin-right: auto;
}

.lnsr-chat-msg-user {
    background: #1d4e89;
    color: #fff;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.lnsr-chat-msg a {
    color: #1d4e89;
    text-decoration: underline;
}

.lnsr-chat-msg-user a {
    color: #cfe2ff;
}

.lnsr-chat-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border-radius: 50%;
    background: #94a3b8;
    animation: lnsr-chat-blink 1.2s infinite both;
}

.lnsr-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.lnsr-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes lnsr-chat-blink {
    0%, 80%, 100% { opacity: 0.25; }
    40% { opacity: 1; }
}

.lnsr-chat-form {
    display: flex;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.lnsr-chat-form textarea {
    flex: 1;
    border: 0;
    resize: none;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    min-height: 44px;
}

.lnsr-chat-form button {
    border: 0;
    background: transparent;
    color: #1d4e89;
    font-weight: 600;
    font-size: 14px;
    padding: 0 16px;
    cursor: pointer;
}

.lnsr-chat-form button:disabled {
    color: #94a3b8;
    cursor: default;
}

.lnsr-chat-privacy {
    font-size: 10px;
    color: #64748b;
    background: #fff;
    padding: 6px 12px 8px;
    text-align: center;
}

@media (max-width: 480px) {
    #lnsr-support-chat-root {
        right: 10px;
        bottom: 10px;
    }

    .lnsr-chat-panel {
        width: calc(100vw - 20px);
        height: 70vh;
    }
}
