/* Chatbot Widget */

:root {
    --chatbot-accent: #FF6B1E;
    --chatbot-accent-dark: #e95a0f;
    --chatbot-bg: #0f1115;
    --chatbot-surface: #171b22;
    --chatbot-surface-2: #1f2430;
    --chatbot-text: #f4f7fb;
    --chatbot-muted: #9aa4b2;
    --chatbot-border: rgba(255, 255, 255, 0.08);
    --chatbot-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.chatbot-widget {
    position: fixed;
    right: 18px;
    bottom: 94px;
    z-index: 9998;
    font-family: inherit;
}

.chatbot-widget,
.chatbot-widget * {
    box-sizing: border-box;
}

.chatbot-launcher {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-accent), #ff8a48);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chatbot-shadow);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.chatbot-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 52px rgba(255, 107, 30, 0.34);
}

.chatbot-launcher:focus-visible {
    outline: 3px solid rgba(255, 107, 30, 0.35);
    outline-offset: 4px;
}

.chatbot-launcher__icon {
    width: 28px;
    height: 28px;
    display: block;
}

.chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 82px;
    width: 340px;
    max-width: calc(100vw - 28px);
    height: min(520px, calc(100vh - 118px));
    background: rgba(15, 17, 21, 0.98);
    border: 1px solid var(--chatbot-border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(0.96);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chatbot-widget.is-open .chatbot-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 14px;
    background: linear-gradient(135deg, #121722, #1a202b);
    border-bottom: 1px solid var(--chatbot-border);
}

.chatbot-header__title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chatbot-header__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--chatbot-accent), #ff9b5f);
    color: #ffffff;
    flex: 0 0 auto;
    box-shadow: 0 10px 24px rgba(255, 107, 30, 0.26);
}

.chatbot-header__title {
    margin: 0;
    color: var(--chatbot-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.chatbot-header__status {
    margin: 3px 0 0;
    color: var(--chatbot-muted);
    font-size: 12px;
    line-height: 1.2;
}

.chatbot-header__actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.chatbot-icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--chatbot-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.chatbot-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.04);
}

.chatbot-icon-btn:focus-visible {
    outline: 2px solid rgba(255, 107, 30, 0.45);
    outline-offset: 2px;
}

.chatbot-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 14px 12px;
    background:
        radial-gradient(circle at top right, rgba(255, 107, 30, 0.08), transparent 30%),
        radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.04), transparent 30%),
        var(--chatbot-bg);
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.chatbot-row {
    display: flex;
    margin: 0 0 10px;
}

.chatbot-row--bot {
    justify-content: flex-start;
}

.chatbot-row--user {
    justify-content: flex-end;
}

.chatbot-bubble {
    max-width: 82%;
    padding: 11px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chatbot-bubble--bot {
    background: var(--chatbot-surface-2);
    color: var(--chatbot-text);
    border-top-left-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-bubble--user {
    background: linear-gradient(135deg, var(--chatbot-accent), #ff8b49);
    color: #ffffff;
    border-top-right-radius: 8px;
}

.chatbot-meta {
    margin-top: 5px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
}

.chatbot-row--user .chatbot-meta {
    color: rgba(255, 255, 255, 0.72);
    text-align: right;
}

.chatbot-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #cfd6df;
    animation: chatbot-bounce 1.2s infinite ease-in-out;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes chatbot-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
    40% { transform: translateY(-4px); opacity: 1; }
}

.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px 12px;
    background: var(--chatbot-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.chatbot-quick-reply {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--chatbot-text);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.chatbot-quick-reply:hover {
    transform: translateY(-1px);
    background: rgba(255, 107, 30, 0.12);
    border-color: rgba(255, 107, 30, 0.35);
}

.chatbot-quick-reply:focus-visible {
    outline: 2px solid rgba(255, 107, 30, 0.45);
    outline-offset: 2px;
}

.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 14px;
    background: linear-gradient(180deg, rgba(20, 24, 31, 0.98), rgba(15, 17, 21, 0.98));
    border-top: 1px solid var(--chatbot-border);
}

.chatbot-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--chatbot-text);
    border-radius: 999px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.2;
    outline: none;
}

.chatbot-input::placeholder {
    color: rgba(244, 247, 251, 0.42);
}

.chatbot-input:focus {
    border-color: rgba(255, 107, 30, 0.45);
    box-shadow: 0 0 0 3px rgba(255, 107, 30, 0.12);
}

.chatbot-send {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-accent), #ff8b49);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    box-shadow: 0 10px 18px rgba(255, 107, 30, 0.22);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.chatbot-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(255, 107, 30, 0.28);
}

.chatbot-send:focus-visible {
    outline: 2px solid rgba(255, 107, 30, 0.45);
    outline-offset: 2px;
}

.chatbot-empty {
    color: var(--chatbot-muted);
    font-size: 13px;
    line-height: 1.5;
    padding: 12px 0 4px;
    text-align: center;
}

.chatbot-widget.is-minimized .chatbot-panel {
    display: none;
}

@media (max-width: 575.98px) {
    .chatbot-widget {
        right: 12px;
        bottom: 82px;
    }

    .chatbot-launcher {
        width: 54px;
        height: 54px;
    }

    .chatbot-launcher__icon {
        width: 24px;
        height: 24px;
    }

    .chatbot-panel {
        right: 0;
        bottom: 72px;
        width: calc(100vw - 24px);
        height: min(540px, calc(100vh - 92px));
        border-radius: 20px;
    }

    .chatbot-bubble {
        max-width: 88%;
    }

    .chatbot-header {
        padding: 14px;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .chatbot-input-area {
        padding: 10px 12px 12px;
    }
}

@media (max-width: 1365.98px) and (min-width: 992px) {
    .chatbot-widget {
        right: 14px;
        bottom: 90px;
    }

    .chatbot-launcher {
        width: 58px;
        height: 58px;
    }

    .chatbot-launcher__icon {
        width: 26px;
        height: 26px;
    }

    .chatbot-panel {
        right: 0;
        bottom: 74px;
        width: min(330px, calc(100vw - 24px));
        height: min(500px, calc(100vh - 106px));
    }
}

@media (max-width: 991.98px) and (min-width: 576px) {
    .chatbot-widget {
        bottom: 90px;
    }

    .chatbot-launcher {
        width: 58px;
        height: 58px;
    }

    .chatbot-launcher__icon {
        width: 26px;
        height: 26px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chatbot-launcher,
    .chatbot-panel,
    .chatbot-icon-btn,
    .chatbot-quick-reply,
    .chatbot-send {
        transition: none;
    }

    .chatbot-typing span {
        animation: none;
    }
}
