/* Glassmorphism Variables */
:root {
    --wa-ai-primary: #25D366; /* WhatsApp Green */
    --wa-ai-secondary: #075E54; /* Darker Green */
    --wa-ai-glass-bg: rgba(255, 255, 255, 0.85); /* Glass Background */
    --wa-ai-glass-border: rgba(255, 255, 255, 0.5);
    --wa-ai-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --wa-ai-text: #333333;
    --wa-ai-bot-bg: #f0f0f0;
    --wa-ai-user-bg: #dcf8c6;
    --wa-ai-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Container */
#wa-ai-widget-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99999;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

/* Floating Button */
#wa-ai-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wa-ai-primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: var(--wa-ai-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#wa-ai-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.6);
}

.wa-icon {
    width: 32px;
    height: 32px;
}

/* Chat Box */
#wa-ai-chat-box {
    width: 350px; /* Modern default width */
    max-width: 90vw;
    height: 500px;
    max-height: 80vh;
    background: var(--wa-ai-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--wa-ai-glass-border);
    border-radius: 20px;
    box-shadow: var(--wa-ai-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: var(--wa-ai-transition);
    opacity: 1;
    transform: scale(1);
}

#wa-ai-chat-box.wa-ai-hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    height: 0; /* To prevent covering clicks when hidden efficiently */
}

/* Header */
.wa-ai-header {
    background: var(--wa-ai-secondary);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wa-ai-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wa-ai-name {
    font-weight: 600;
    font-size: 1rem;
}

.wa-ai-status {
    font-size: 0.75rem;
    opacity: 0.9;
}

#wa-ai-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: 0.2s;
}

#wa-ai-close:hover {
    opacity: 1;
}

/* Chat Body */
.wa-ai-body {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
}

/* Messages */
.wa-ai-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
    color: #333;
}
.wa-ai-message.bot {
    background: var(--wa-ai-bot-bg);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.wa-ai-message.user {
    background: var(--wa-ai-user-bg);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Options */
.wa-ai-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.wa-ai-option-btn {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 10px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
    color: var(--wa-ai-secondary);
    font-weight: 500;
}

.wa-ai-option-btn:hover {
    background: #f9f9f9;
    border-color: var(--wa-ai-primary);
    transform: translateX(4px);
}

.wa-ai-option-number {
    font-weight: bold;
    color: var(--wa-ai-primary);
    margin-right: 8px;
}

/* Footer */
.wa-ai-footer {
    padding: 8px;
    text-align: center;
    background: rgba(255,255,255,0.9);
    border-top: 1px solid rgba(0,0,0,0.05);
    font-size: 0.7rem;
    color: #888;
}

/* Animations */
@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes typing {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--wa-ai-bot-bg);
    border-radius: 12px;
    align-self: flex-start;
    width: fit-content;
    margin-bottom: 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Responsive */
@media (max-width: 480px) {
    #wa-ai-chat-box {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        bottom: 0;
        right: 0;
    }
}
