:root {
    --landing-surface: #ffffff;
    --landing-surface-soft: #f8fbff;
    --landing-text: #213547;
    --landing-muted: #647789;
    --landing-border: rgba(35, 73, 101, 0.12);
    --landing-chat-bot-bg: #edf3f8;
    --landing-chat-bot-text: #2c3e50;
    --landing-input-bg: #ffffff;
    --landing-quick-reply-bg: #edf8ff;
    --landing-quick-reply-hover: #dff2ff;
    --landing-quick-reply-text: #0b79c8;
}

[data-bs-theme="dark"] {
    --landing-surface: #102331;
    --landing-surface-soft: #0b1b28;
    --landing-text: #dce8f0;
    --landing-muted: #9db1bf;
    --landing-border: rgba(157, 196, 220, 0.16);
    --landing-chat-bot-bg: #172c3a;
    --landing-chat-bot-text: #e1ebf2;
    --landing-input-bg: #0b1b28;
    --landing-quick-reply-bg: #12334a;
    --landing-quick-reply-hover: #17445f;
    --landing-quick-reply-text: #8bd5ff;
}

html.landing-chat-scroll-locked,
body.landing-chat-scroll-locked {
    overflow: hidden;
}

#landing-chat-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1050;
    display: none;
    width: min(100%, 340px);
    max-width: 340px;
    overflow: hidden;
    color: var(--landing-text);
    background: var(--landing-surface);
    border: 1px solid var(--landing-border);
    border-radius: 22px;
    box-shadow: 0 18px 40px rgba(20, 169, 255, 0.18), 0 12px 24px rgba(0, 0, 0, 0.12);
}

#landing-chat-widget.active { display: block; }

#landing-chat-widget .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    color: #fff;
    background: linear-gradient(135deg, #14a9ff 0%, #6fc5ff 100%);
}

#landing-chat-widget .chat-header .chat-title { margin: 0; font-size: 1rem; font-weight: 700; }
#landing-chat-widget .chat-header small { display: block; margin-top: 4px; color: rgba(255, 255, 255, .85); font-size: .82rem; }

#landing-chat-widget .chat-body {
    height: 320px;
    max-height: 320px;
    padding: 16px;
    overflow-y: auto;
    background: var(--landing-surface-soft);
    scrollbar-color: rgba(20, 169, 255, .55) transparent;
}

#landing-chat-widget .chat-message { display: flex; gap: 10px; margin-bottom: 14px; }
#landing-chat-widget .chat-message.user { flex-direction: row-reverse; text-align: right; }

#landing-chat-widget .chat-message .message-bubble {
    max-width: 80%;
    padding: 12px 14px;
    border-radius: 18px;
    font-size: .8rem;
    line-height: 1.5;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

#landing-chat-widget .chat-message.user .message-bubble { color: #fff; background: #14a9ff; border-bottom-right-radius: 4px; }
#landing-chat-widget .chat-message.bot .message-bubble { color: var(--landing-chat-bot-text); background: var(--landing-chat-bot-bg); border: 1px solid var(--landing-border); border-bottom-left-radius: 4px; }
#landing-chat-widget .chat-message-loading .message-bubble { display: flex; align-items: center; width: 138px; min-height: 34px; padding: 12px 14px; }
#landing-chat-widget .chat-message.user .message-loading { display: flex; flex-direction: row; justify-content: flex-start; }

#landing-chat-widget .chat-message-loading__bar {
    display: block;
    width: 72px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(0deg, #f5f5f5 0%, #c5c5c5 50%, #e7e7e7);
    transform: scaleX(0);
    transform-origin: left center;
    opacity: .35;
    transition: opacity .3s;
}

#landing-chat-widget .chat-message-loading__bar_1 { animation: landing-chat-reply-bar 2.5s ease-in-out 1s infinite; }
#landing-chat-widget .chat-message-loading__bar_2 { animation: landing-chat-reply-bar 2.5s ease-in-out 1.3s infinite; }
#landing-chat-widget .chat-message-loading__bar_3 { animation: landing-chat-reply-bar 2.5s ease-in-out .3s infinite; }

@keyframes landing-chat-reply-bar {
    0%, 100% { opacity: .35; transform: scaleX(0); }
    50% { opacity: .75; transform: scaleX(1); }
}

#landing-chat-widget .chat-message.bot .message-bubble a,
#landing-chat-widget .chat-message.bot .message-bubble a:hover,
#landing-chat-widget .chat-message.bot .message-bubble a:focus,
#landing-chat-widget .chat-message.bot .message-bubble a:visited { color: inherit; font-weight: 700; text-decoration: underline; }

#landing-chat-widget .landing-chat-quick-replies {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    padding: 8px 8px 4px 12px;
    overflow-y: hidden;
    overscroll-behavior: contain;
    background: var(--landing-surface);
    scrollbar-color: rgba(20, 169, 255, .5) transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

#landing-chat-widget .landing-chat-quick-replies.is-scrollable { overflow-y: auto; }
#landing-chat-widget .landing-chat-quick-replies::-webkit-scrollbar { width: 4px; }
#landing-chat-widget .landing-chat-quick-replies::-webkit-scrollbar-track { background: transparent; }
#landing-chat-widget .landing-chat-quick-replies::-webkit-scrollbar-thumb { background: rgba(20, 169, 255, .5); border-radius: 999px; }

#landing-chat-widget .landing-chat-quick-replies button {
    padding: 6px 10px;
    color: var(--landing-quick-reply-text);
    background: var(--landing-quick-reply-bg);
    border: 1px solid rgba(20, 169, 255, .28);
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: start;
    cursor: pointer;
    transition: all .2s ease;
}

#landing-chat-widget .landing-chat-quick-replies button:hover { background: var(--landing-quick-reply-hover); border-color: rgba(20, 169, 255, .5); transform: translateY(-1px); }

#landing-chat-widget .chat-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px 18px;
    background: var(--landing-surface);
    border-top: 1px solid var(--landing-border);
}

#landing-chat-widget .chat-input-wrapper { position: relative; display: inline-flex; flex: 1; align-items: center; }
#landing-chat-widget .chat-input-wrapper .chat-input { box-sizing: border-box; width: 100%; }
#landing-chat-widget .chat-input-wrapper .chat-loading { position: absolute; top: 50%; left: 18px; display: none; align-items: center; color: var(--landing-quick-reply-text); pointer-events: none; transform: translateY(-50%); }
#landing-chat-widget .chat-input { flex: 1; padding: 10px 14px; color: var(--landing-text); background: var(--landing-input-bg); border: 1px solid var(--landing-border); border-radius: 999px; outline: none; font-size: .7rem; }
#landing-chat-widget .chat-input::placeholder { color: var(--landing-muted); }
#landing-chat-widget .chat-input:focus { border-color: rgba(20, 169, 255, .72); box-shadow: 0 0 0 3px rgba(20, 169, 255, .13); }
#landing-chat-widget .chat-send { padding: 10px 18px; color: #fff; background: #14a9ff; border: 0; border-radius: 999px; font-size: .7rem; white-space: nowrap; cursor: pointer; }
#landing-chat-widget .chat-send:disabled,
#landing-chat-widget .landing-chat-quick-replies button:disabled { cursor: wait; opacity: .65; }

#landing-chat-button {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    overflow: visible;
    color: #fff;
    background: linear-gradient(135deg, #14a9ff 0%, #6fc5ff 100%);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 16px 32px rgba(0, 0, 0, .18);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
    animation: landingChatGlow 2.8s ease-in-out infinite;
}

#landing-chat-button::after { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 rgba(255, 176, 26, .4); content: ''; pointer-events: none; animation: landingChatRipple 2.2s ease-out infinite; }
#landing-chat-button:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(0, 0, 0, .22); }
#landing-chat-button i { font-size: 1.4rem; }

@keyframes landingChatGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 176, 26, .55), 0 18px 40px rgba(255, 192, 72, .28); transform: translateY(0); }
    50% { box-shadow: 0 0 32px 12px rgba(255, 176, 26, .48), 0 18px 40px rgba(255, 192, 72, .38); transform: translateY(-1px); }
}

@keyframes landingChatRipple {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 176, 26, .5); opacity: 1; }
    80% { transform: scale(1.8); box-shadow: 0 0 0 18px rgba(255, 176, 26, .2); opacity: .1; }
    100% { transform: scale(2.2); box-shadow: 0 0 0 24px rgba(255, 176, 26, 0); opacity: 0; }
}

[data-bs-theme="dark"] #landing-chat-button { box-shadow: 0 0 22px rgba(255, 180, 50, .7), 0 18px 40px rgba(255, 187, 51, .28); }
[data-bs-theme="dark"] #landing-chat-button:hover { box-shadow: 0 0 28px rgba(255, 180, 50, .85), 0 22px 44px rgba(255, 187, 51, .33); }

.loading-dots { display: inline-flex; align-items: center; gap: 6px; }
.loading-dots span { display: inline-block; width: 6px; height: 6px; background: var(--landing-quick-reply-text); border-radius: 999px; opacity: .75; animation: landingChatLoadingBounce 1s infinite ease-in-out; }
.loading-dots span:nth-child(2) { animation-delay: .12s; }
.loading-dots span:nth-child(3) { animation-delay: .24s; }

@keyframes landingChatLoadingBounce {
    0%, 100% { opacity: .6; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-6px); }
}

@media (max-width: 767.98px) {
    #landing-chat-widget { top: 0; right: 0; bottom: 0; left: 0; z-index: 1090; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
    #landing-chat-widget.active { display: flex; flex-direction: column; }
    #landing-chat-widget .chat-body { flex: 1 1 auto; min-height: 0; height: auto; max-height: none; }
    #landing-chat-button { right: 18px; bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    #landing-chat-button,
    #landing-chat-button::after,
    .loading-dots span,
    #landing-chat-widget .chat-message-loading__bar { animation: none; transition: none; }
}