/* AI Chatbot Widget Styles */

/* Reset Elementor / WordPress global button interference */
button.ai-chatbot-fab,
button.ai-chatbot-send,
button.ai-chatbot-close,
button.ai-chat-contact-submit {
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    outline: inherit;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    text-decoration: none;
    transition: none;
    line-height: normal;
}

.ai-chatbot-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #333;
}

/* Inline Mode */
.ai-chatbot-inline {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

/* Floating / Popup Mode */
div.ai-chatbot-container .ai-chatbot-fab {
    position: fixed;
    bottom: var(--fab-y, 24px);
    right: var(--fab-x, 24px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ai-chatbot-primary, #25b366);
    color: var(--ai-chatbot-primary-text, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 99999;
    transition: transform 0.2s;
}

.ai-chatbot-fab:hover {
    transform: scale(1.1);
}

.ai-chatbot-fab-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Pulse Ripple - Multiple Overlapping Waves */
.ai-chatbot-fab-ripple {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: var(--ripple-color, var(--ai-chatbot-primary, #25b366));
    pointer-events: none;
    animation: aiChatRipple var(--ripple-speed, 1.5s) ease-out infinite;
}

@keyframes aiChatRipple {
    0%   { transform: scale(0.95); opacity: var(--ripple-opacity, 0.35); }
    100% { transform: scale(var(--ripple-radius, 2.5)); opacity: 0; }
}

/* Icon Shake */
.ai-chatbot-fab-icon-shake {
    animation: aiChatShake var(--ripple-speed, 1.5s) ease-in-out infinite;
}

@keyframes aiChatShake {
    0%, 100% { transform: translateY(0); }
    12% { transform: translateY(-2px); }
    22% { transform: translateY(0); }
    32% { transform: translateY(2px); }
    42% { transform: translateY(0); }
}

/* FAB Hint Tooltip */
.ai-chatbot-fab-hint {
    position: absolute;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.ai-chatbot-fab-hint span {
    display: block;
    background: var(--hint-bg, #333);
    color: var(--hint-text, #fff);
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 8px;
    line-height: 1.3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ai-chatbot-fab-hint::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

.ai-chatbot-fab-hint-right {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    margin-left: 14px;
}

.ai-chatbot-fab-hint-right::after {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: var(--hint-bg, #333);
}

.ai-chatbot-fab-hint-left {
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    margin-right: 14px;
}

.ai-chatbot-fab-hint-left::after {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: var(--hint-bg, #333);
}

.ai-chatbot-fab-hint-top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 14px;
}

.ai-chatbot-fab-hint-top::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--hint-bg, #333);
}

.ai-chatbot-fab-hint-bottom {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 14px;
}

.ai-chatbot-fab-hint-bottom::after {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--hint-bg, #333);
}

.ai-chatbot-popup {
    position: fixed;
    bottom: calc(var(--fab-y, 24px) + 66px);
    right: var(--fab-x, 24px);
    width: 380px;
    height: 560px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
}

/* Header */
.ai-chatbot-header {
    background: var(--ai-chatbot-popup, #25b366);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

.ai-chatbot-title {
    font-size: 16px;
    font-weight: 600;
}

.ai-chatbot-subtitle {
    font-size: 12px;
    opacity: 0.85;
}

div.ai-chatbot-container .ai-chatbot-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
div.ai-chatbot-container .ai-chatbot-close:hover {
    background: none !important;
    color: #fff;
}

/* Messages Area */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

/* Message Bubbles */
.ai-chatbot-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

.ai-chatbot-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chatbot-bot {
    align-self: flex-start;
}

.ai-chatbot-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-chatbot-user .ai-chatbot-bubble {
    background: var(--ai-chatbot-popup, #25b366);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-chatbot-bot .ai-chatbot-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.ai-chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Typing Indicator */
.ai-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-items: center;
}

.ai-chatbot-typing .dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: aiChatBounce 1.4s infinite ease-in-out both;
}

.ai-chatbot-typing .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-chatbot-typing .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiChatBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.ai-chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.ai-chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    overflow: hidden;
    line-height: 1.4;
}

.ai-chatbot-input:focus {
    border-color: #ddd;
}

div.ai-chatbot-container .ai-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--ai-chatbot-button, #25b366);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

div.ai-chatbot-container .ai-chatbot-send:hover {
    background: var(--ai-chatbot-button-hover, #1e8a50);
}

/* Error State */
.ai-chat-error {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Contact Form */
.ai-chat-contact-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chat-contact-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

div.ai-chatbot-container .ai-chat-contact-submit {
    padding: 8px 16px;
    background: var(--ai-chatbot-button, #25b366);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chatbot-popup {
        width: calc(100vw - 32px);
        height: calc(100dvh - 120px);
        bottom: calc(var(--fab-y, 24px) + 66px);
        right: var(--fab-x, 24px);
        left: auto;
        top: auto;
    }
}

/* Scrollbar */
.ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
