/* ==========================================================================
   Reflections GCC - Interactive AI Chatbot Widget Styling
   ========================================================================== */

/* Chatbot Floating Trigger Button */
.chatbot-trigger {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--bg-surface, #131927);
    border: 2px solid var(--accent-green, #00e699);
    color: var(--accent-green, #00e699);
    box-shadow: 0 8px 32px rgba(0, 230, 153, 0.25), 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.9);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.3s ease,
                box-shadow 0.3s ease;
}

.chatbot-trigger.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chatbot-trigger:hover {
    transform: scale(1.08) translateY(-2px);
    background: var(--accent-green, #00e699);
    color: #0b0f19;
    box-shadow: 0 12px 36px rgba(0, 230, 153, 0.45);
}

.chatbot-trigger svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.chatbot-trigger:hover svg {
    transform: rotate(10deg);
}

.chatbot-trigger .badge-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #00e699;
    border: 2px solid #0b0f19;
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(0, 230, 153, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 230, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 230, 153, 0); }
}

/* Chatbot Modal Container */
.chatbot-modal {
    position: fixed;
    bottom: 9.5rem;
    right: 2rem;
    width: 390px;
    max-width: calc(100vw - 2.5rem);
    height: 580px;
    max-height: calc(100vh - 8rem);
    background: rgba(15, 22, 36, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 230, 153, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

.chatbot-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    padding: 1.2rem 1.4rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chatbot-avatar-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(0, 230, 153, 0.12);
    border: 1px solid rgba(0, 230, 153, 0.3);
    color: var(--accent-green, #00e699);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary, #ffffff);
    margin: 0;
    line-height: 1.2;
}

.chatbot-subtitle {
    font-size: 0.78rem;
    color: var(--accent-green, #00e699);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.chatbot-subtitle .status-dot {
    width: 6px;
    height: 6px;
    background: #00e699;
    border-radius: 50%;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-action-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.chatbot-action-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

/* Chat History / Body */
.chatbot-body {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.chatbot-body::-webkit-scrollbar {
    width: 4px;
}
.chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Messages */
.chat-msg {
    display: flex;
    gap: 0.65rem;
    max-width: 88%;
    animation: msgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

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

.msg-bubble {
    padding: 0.85rem 1.1rem;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.chat-msg.bot .msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #ffffff);
    border-top-left-radius: 4px;
}

.chat-msg.user .msg-bubble {
    background: var(--accent-green, #00e699);
    color: #0b0f19;
    font-weight: 500;
    border-top-right-radius: 4px;
}

/* Typing indicator */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border-top-left-radius: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Quick Options / Chips */
.chat-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.chat-chip-btn {
    background: rgba(0, 230, 153, 0.08);
    border: 1px solid rgba(0, 230, 153, 0.25);
    color: var(--accent-green, #00e699);
    padding: 0.45rem 0.85rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-chip-btn:hover {
    background: var(--accent-green, #00e699);
    color: #0b0f19;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 230, 153, 0.25);
}

/* Contact Lead Form Box inside Chat */
.chat-lead-card {
    background: rgba(20, 28, 45, 0.95);
    border: 1px solid rgba(0, 230, 153, 0.3);
    border-radius: 14px;
    padding: 1.1rem;
    margin-top: 0.6rem;
    width: 100%;
}

.chat-lead-card h4 {
    font-size: 0.95rem;
    color: var(--accent-green, #00e699);
    margin-bottom: 0.4rem;
}

.chat-lead-card p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.85rem;
    line-height: 1.4;
}

.chat-lead-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-lead-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-lead-input:focus {
    border-color: var(--accent-green, #00e699);
}

.chat-lead-submit {
    background: var(--accent-green, #00e699);
    color: #0b0f19;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    margin-top: 0.25rem;
}

.chat-lead-submit:hover {
    background: #00ffaa;
    transform: translateY(-1px);
}

/* Contact Info Highlight Box */
.chat-contact-box {
    background: rgba(0, 230, 153, 0.08);
    border: 1px dashed rgba(0, 230, 153, 0.4);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-contact-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: #ffffff;
}

.chat-contact-item svg {
    color: var(--accent-green, #00e699);
    flex-shrink: 0;
}

.chat-contact-item a {
    color: var(--accent-green, #00e699);
    text-decoration: none;
    font-weight: 600;
}

.chat-contact-item a:hover {
    text-decoration: underline;
}

/* Input Bar */
.chatbot-footer {
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chatbot-input-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 0.65rem 1.1rem;
    color: #ffffff;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input:focus {
    border-color: var(--accent-green, #00e699);
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-green, #00e699);
    color: #0b0f19;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    background: #00ffaa;
}

/* Light Theme Overrides */
[data-theme="light"] .chatbot-modal {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .chatbot-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chatbot-title {
    color: #111827;
}

[data-theme="light"] .chat-msg.bot .msg-bubble {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}

[data-theme="light"] .chatbot-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
    color: #111827;
}

/* RTL Support */
html[dir="rtl"] .chatbot-modal {
    right: auto;
    left: 2rem;
}

html[dir="rtl"] .chatbot-trigger {
    right: auto;
    left: 2rem;
}

@media (max-width: 768px) {
    .chatbot-trigger {
        bottom: 4.8rem;
        right: 1.5rem;
        width: 48px;
        height: 48px;
    }
    html[dir="rtl"] .chatbot-trigger {
        right: auto;
        left: 1.5rem;
    }
    .chatbot-modal {
        bottom: 8.5rem;
        right: 1.25rem;
        max-width: calc(100vw - 2.5rem);
    }
    html[dir="rtl"] .chatbot-modal {
        right: auto;
        left: 1.25rem;
    }
}
