.ra-chatbot-toggle {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 1201;
    width: 56px;
    height: 56px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    display: grid;
    place-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ra-chatbot-toggle:hover {
    transform: translateY(-1px);
    border-color: #fecaca;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

.ra-chatbot-toggle img {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
}

.ra-chatbot-panel {
    position: fixed;
    right: 14px;
    bottom: 64px;
    z-index: 1202;
    width: min(380px, calc(100vw - 28px));
    height: min(72vh, 640px);
    max-height: 72vh;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
}

.ra-chatbot-panel[hidden] {
    display: none;
}

.ra-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    padding: 16px 16px 14px;
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(10px);
}

.ra-chatbot-title-wrap {
    display: grid;
    gap: 3px;
}

.ra-chatbot-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ef4444;
}

.ra-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.2;
    color: #111827;
}

.ra-chatbot-close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    display: grid;
    place-items: center;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.ra-chatbot-close:hover {
    transform: scale(1.03);
    background: #fef2f2;
    border-color: #fecaca;
    color: #ef4444;
}

.ra-chatbot-body {
    min-height: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
}

.ra-chatbot-messages {
    padding: 16px;
    padding-bottom: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    scroll-padding-bottom: 88px;
}

.ra-chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
    animation: raChatSlideIn 0.22s ease-out both;
}

.ra-chat-msg.bot {
    align-self: flex-start;
}

.ra-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ra-chat-bubble {
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ra-chat-msg.bot .ra-chat-bubble {
    background: #f3f4f6;
    color: #1f2937;
    border-top-left-radius: 6px;
}

.ra-chat-msg.user .ra-chat-bubble {
    background: #fef2f2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
    border-top-right-radius: 6px;
}

.ra-chat-avatar,
.ra-chat-user-mark {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ra-chat-avatar {
    background: #fff;
    color: #ef4444;
    border: 1px solid #fecaca;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.ra-chat-user-mark {
    background: #fff5f5;
    color: #b91c1c;
    border: 1px solid #f5c2c7;
}

.ra-chatbot-typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 14px;
    color: #6b7280;
    font-size: 12px;
}

.ra-chatbot-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #ef4444;
    opacity: 0.35;
    animation: raChatPulse 1.1s infinite ease-in-out;
}

.ra-chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ra-chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

.ra-chatbot-typing-label {
    margin-left: 4px;
}

.ra-chatbot-footer {
    padding: 0 16px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.ra-chatbot-buttons {
    padding-top: 16px;
}

.ra-chatbot-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.ra-chatbot-button {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #111827;
    border-radius: 16px;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    text-align: left;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ra-chatbot-button:hover {
    background: #fff7f7;
    border-color: #fca5a5;
    color: #991b1b;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.ra-chatbot-button[data-tone="blue"] {
    background: #f8fbff;
    border-color: #dbeafe;
}

.ra-chatbot-button[data-tone="orange"] {
    background: #fffaf3;
    border-color: #fed7aa;
}

.ra-chatbot-button[data-tone="violet"] {
    background: #fbf8ff;
    border-color: #e9d5ff;
}

.ra-chatbot-button[data-tone="red"] {
    background: #fff7f7;
    border-color: #fecaca;
}

.ra-chatbot-button[data-tone="brown"] {
    background: #fcfbf8;
    border-color: #e7d5c0;
}

.ra-chatbot-button[data-tone="amber"] {
    background: #fffbf0;
    border-color: #fde68a;
}

.ra-chatbot-button[data-tone="slate"] {
    background: #ffffff;
    border-color: #e5e7eb;
}

.ra-chatbot-button[data-tone="blue"]:hover,
.ra-chatbot-button[data-tone="orange"]:hover,
.ra-chatbot-button[data-tone="violet"]:hover,
.ra-chatbot-button[data-tone="red"]:hover,
.ra-chatbot-button[data-tone="brown"]:hover,
.ra-chatbot-button[data-tone="amber"]:hover,
.ra-chatbot-button[data-tone="slate"]:hover {
    background: #fff7f7;
}

.ra-chatbot-button:active {
    transform: translateY(0);
}

.ra-chatbot-button.is-selected {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.12);
}

.ra-chatbot-button-icon {
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
}

.ra-chatbot-button-label {
    line-height: 1.2;
}

.ra-chatbot-nav {
    padding-top: 12px;
}

.ra-chatbot-nav-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ra-chatbot-back-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.ra-chatbot-back-btn:hover {
    background: #fff7f7;
    border-color: #fca5a5;
    color: #991b1b;
    transform: translateY(-1px);
}

.ra-chatbot-back-main-btn {
    border-color: #ef4444;
    color: #b91c1c;
    background: #fff5f5;
    font-weight: 700;
}

.ra-chatbot-form {
    display: none;
}

@media (max-width: 560px) {
    .ra-chatbot-panel {
        right: 8px;
        bottom: 58px;
        width: min(100vw - 16px, 390px);
        height: min(78vh, 640px);
        max-height: 78vh;
    }

    .ra-chatbot-toggle {
        right: 8px;
        bottom: 8px;
    }

    .ra-chatbot-buttons-grid {
        grid-template-columns: 1fr;
    }
}

.ra-chatbot-button .ra-chatbot-button-label,
.ra-chatbot-back-btn,
.ra-chat-bubble,
.ra-chatbot-header,
.ra-chatbot-eyebrow {
    font-family: inherit;
}

@keyframes raChatSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes raChatPulse {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }

    40% {
        transform: translateY(-2px);
        opacity: 1;
    }
}
