/* AI Chat Widget Styling */
#ai-chat-widget {
    position: fixed;
    bottom: 112px; /* 32px (bottom) + 64px (WA height) + 16px (gap) */
    right: 32px;   /* Match Tailwind's right-8 */
    z-index: 1000;
    font-family: 'Inter', sans-serif;
}

#chat-bubble {
    width: 64px;  /* Match Tailwind's w-16 */
    height: 64px; /* Match Tailwind's h-16 */
    background: #0d9488;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(13, 148, 136, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chat-bubble:hover {
    transform: scale(1.1) rotate(5deg);
}

#chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    transform-origin: bottom right;
    transition: all 0.3s ease;
}

#chat-window.active {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

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

#chat-header {
    background: #0d9488;
    padding: 20px;
    color: white;
}

#message-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
}

.msg-bot {
    background: white;
    color: #374151;
    align-self: flex-start;
    border-radius: 15px 15px 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.msg-user {
    background: #0d9488;
    color: white;
    align-self: flex-end;
    border-radius: 15px 15px 0 15px;
}

#chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 10px;
}

#chat-input-area input {
    flex-grow: 1;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 15px;
    outline: none;
    font-size: 14px;
}

#chat-input-area input:focus {
    border-color: #0d9488;
}

#chat-input-area button {
    background: #0d9488;
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

/* Onboarding Tooltip */
#chat-hint {
    position: absolute;
    right: 75px;
    bottom: 10px;
    background: white;
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    font-size: 12px;
    color: #374151;
    width: 200px;
    display: none;
    z-index: 1001;
}

#chat-hint.visible {
    display: block;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Mobile Responsiveness */
@media (max-width: 500px) {
    #ai-chat-widget {
        bottom: 16px; /* Match Tailwind's bottom-4 */
        right: 16px;  /* Match Tailwind's right-4 */
        left: auto;
    }

    #chat-window {
        width: 90vw;
        height: 70vh;
        max-width: 400px;
        bottom: 80px;
        position: fixed;
        right: 16px;
        left: auto;
    }
}

/* Close Button Styling */
#chat-close {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    line-height: normal;
}

#chat-bubble.hidden {
    display: none;
}

#chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

#chat-bubble {
    position: relative; /* Ensure badge is relative to bubble */
}
