#ai-assistant-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: var(--bs-font-sans-serif, system-ui, sans-serif);
}

.ai-pos-right { right: 20px; }
.ai-pos-left { left: 20px; }

.ai-glassmorphism {
    background: rgba(var(--bs-body-bg-rgb, 255, 255, 255), 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-primary-rgb, 0, 123, 255), 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

html[data-theme="dark"] .ai-glassmorphism {
    background: rgba(var(--bs-body-bg-rgb, 30, 30, 30), 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

#ai-trigger-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: var(--bs-primary, #0d6efd);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#ai-trigger-btn:hover { transform: scale(1.1); }

#ai-chat-window {
    position: absolute;
    bottom: 80px;
    width: 350px;
    height: 500px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform-origin: bottom right;
}

.ai-pos-left #ai-chat-window { transform-origin: bottom left; }

.ai-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.ai-header {
    background: var(--bs-primary, #0d6efd);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.ai-header-info { display: flex; align-items: center; gap: 10px; }

#ai-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

#ai-chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-bot {
    align-self: flex-start;
    background: rgba(var(--bs-secondary-bg-rgb, 240, 240, 240), 0.8);
    border-bottom-left-radius: 2px;
}

.ai-user {
    align-self: flex-end;
    background: var(--bs-primary, #0d6efd);
    color: white;
    border-bottom-right-radius: 2px;
}

.ai-input-area {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

#ai-chat-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    background: transparent;
    color: inherit;
    outline: none;
}

#ai-send-btn {
    background: var(--bs-primary, #0d6efd);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-wa-btn {
    display: block;
    background: #25D366;
    color: white !important;
    text-align: center;
    padding: 10px;
    text-decoration: none;
    font-weight: bold;
}

@media (max-width: 400px) {
    #ai-chat-window {
        width: calc(100vw - 40px);
        right: -20px;
    }
}