/**
 * RSO AI Chatbot Styles
 *
 * Floating Bubble + Chat Window + Embedded Mode
 */

/* ── Floating Bubble ── */
.rso-chatbot-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rso-chatbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.rso-chatbot-bubble-icon {
    font-size: 28px;
    line-height: 1;
}

.rso-chatbot-bubble-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d63638;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Floating Window ── */
.rso-chatbot-floating {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.rso-chatbot-floating-window {
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: rsoChatbotSlideUp 0.3s ease;
}

@keyframes rsoChatbotSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Header ── */
.rso-chatbot-header {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.rso-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rso-chatbot-avatar {
    font-size: 28px;
    line-height: 1;
}

.rso-chatbot-header-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.rso-chatbot-header-info small {
    font-size: 11px;
    opacity: 0.85;
}

.rso-chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    line-height: 1;
}

.rso-chatbot-close:hover {
    opacity: 1;
}

/* ── Messages Area ── */
.rso-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f8fa;
}

.rso-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.rso-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ── Message Bubbles ── */
.rso-chatbot-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: rsoChatbotFadeIn 0.2s ease;
}

@keyframes rsoChatbotFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.rso-chatbot-msg-user {
    background: #0073aa;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.rso-chatbot-msg-bot {
    background: #fff;
    color: #1d2327;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.rso-chatbot-msg-error {
    background: #fef0f0;
    color: #d63638;
    align-self: center;
    font-size: 13px;
    text-align: center;
    border-radius: 8px;
}

/* ── Typing Indicator ── */
.rso-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.rso-chatbot-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: rsoChatbotTyping 1.4s infinite;
}

.rso-chatbot-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.rso-chatbot-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes rsoChatbotTyping {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* ── Input Area ── */
.rso-chatbot-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    gap: 8px;
    flex-shrink: 0;
}

.rso-chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.rso-chatbot-input:focus {
    border-color: #0073aa;
}

.rso-chatbot-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0073aa;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.rso-chatbot-send:hover {
    background: #005a87;
}

.rso-chatbot-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ── Lead Capture Form ── */
.rso-chatbot-lead-form {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #f0f6fc;
    flex-shrink: 0;
}

.rso-chatbot-lead-form-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rso-chatbot-lead-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin: 0;
}

.rso-chatbot-lead-form input {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.rso-chatbot-lead-form input:focus {
    border-color: #0073aa;
    outline: none;
}

.rso-chatbot-lead-submit {
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.rso-chatbot-lead-submit:hover {
    background: #005a87;
}

.rso-chatbot-lead-skip {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    padding: 4px;
}

.rso-chatbot-lead-skip:hover {
    color: #333;
}

/* ── Embedded Mode ── */
.rso-chatbot-embedded {
    border: 1px solid #ddd;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.rso-chatbot-embedded .rso-chatbot-messages {
    flex: 1;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .rso-chatbot-floating {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .rso-chatbot-floating-window {
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 80px);
        max-height: calc(100vh - 80px);
        border-radius: 16px 16px 0 0;
    }

    .rso-chatbot-bubble {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .rso-chatbot-bubble-icon {
        font-size: 24px;
    }
}
