/* AI Chat Widget Styles - Premium & Modern */
:root {
    --ai-primary: #1DBF73;
    --ai-primary-hover: #19a463;
    --ai-bg-dark: #1e1e1e;
    --ai-text-white: #ffffff;
    --ai-text-muted: #b0b0b0;
}

#ai-chat-widget-wrapper {
    position: fixed;
    bottom: 30px;
    /* Position (left/right) is handled by inline style in component */
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Floating Toggle Button */
.ai-chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--ai-primary);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(29, 191, 115, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ai-chat-toggle-btn:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--ai-primary-hover);
    box-shadow: 0 15px 30px rgba(29, 191, 115, 0.6);
}

.ai-notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #FF4B55;
    border: 2px solid white;
    border-radius: 50%;
}

/* Chat Container */
#ai-chat-container {
    position: absolute;
    bottom: 80px;
    /* Container aligns with the wrapper's edge */
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid #ddd;
}

#ai-chat-widget-wrapper[style*="right"] #ai-chat-container {
    right: 0;
    transform-origin: bottom right;
}

#ai-chat-widget-wrapper[style*="left"] #ai-chat-container {
    left: 0;
    transform-origin: bottom left;
}

#ai-chat-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ai-chat-messages-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-container-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

/* Header */
.ai-chat-header {
    background: var(--ai-bg-dark);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--ai-primary);
}

.ai-status {
    font-size: 11px;
    color: var(--ai-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--ai-primary);
    border-radius: 50%;
}

.ai-chat-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.ai-chat-close-btn:hover {
    color: white;
}

/* Messages Body */
.ai-chat-messages-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    padding-bottom: 10px;
}

.ai-chat-messages-body::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-messages-body::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}

.ai-message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.ai-message.assistant {
    align-self: flex-start;
}

.ai-message.user {
    align-self: flex-end;
}

.ai-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-message-label {
    font-size: 10px;
    font-weight: bold;
    color: #888;
    margin-bottom: 2px;
    text-transform: uppercase;
    margin-left: 5px;
}

.assistant .ai-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.user .ai-message-content {
    background: var(--ai-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 5px 0;
}

.ai-typing span {
    width: 6px;
    height: 6px;
    background: #bdbdbd;
    border-radius: 50%;
    animation: ai-typing 1.4s infinite ease-in-out both;
}

.ai-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes ai-typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Footer */
.ai-chat-footer {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #eee;
}

.ai-input-wrapper {
    display: flex;
    align-items: flex-end;
    background: #f1f3f4;
    border-radius: 24px;
    padding: 8px 16px;
    gap: 10px;
}

#ai-chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 8px 0;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    color: #333;
}

.ai-send-btn {
    background: var(--ai-primary);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.ai-send-btn:hover:not(:disabled) {
    background: var(--ai-primary-hover);
    transform: scale(1.1);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-footer-note {
    text-align: center;
    font-size: 9px;
    color: #999;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #ai-chat-container {
        width: calc(100vw - 40px);
        height: 80vh;
        bottom: 70px;
        right: -10px;
    }

    #ai-chat-widget-wrapper {
        bottom: 20px;
        right: 20px;
    }
}