/* AI Chat Widget Styles */
:root {
    --ai-primary: #0065d8;
    --ai-secondary: #ff0083;
    --ai-bg: rgba(255, 255, 255, 0.95);
    --ai-text: #333;
    --ai-glass-border: rgba(255, 255, 255, 0.2);
}

.ai-widget-launcher {
    position: fixed;
    bottom: 100px;
    /* Above WhatsApp/Elfsight usually */
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 101, 216, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulse-glow 3s infinite;
}

.ai-widget-launcher:hover {
    transform: scale(1.1);
}

.ai-widget-launcher i {
    color: white;
    font-size: 28px;
}

.ai-chat-window {
    position: fixed;
    bottom: 170px;
    /* Above launcher */
    right: 20px;
    width: 350px;
    height: 500px;
    background: var(--ai-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--ai-glass-border);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
}

.ai-chat-window.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Header */
.ai-chat-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-primary);
    font-size: 20px;
}

.ai-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.ai-header-info span {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-status-dot {
    width: 8px;
    height: 8px;
    background: #00ff88;
    border-radius: 50%;
}

.ai-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.7;
}

.ai-close-btn:hover {
    opacity: 1;
}

/* Messages Area */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: message-pop 0.3s ease-out backwards;
}

.message.ai {
    background: #f0f2f5;
    color: var(--ai-text);
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}

.message.user {
    background: var(--ai-primary);
    /* Use solid color for better contrast */
    color: white;
    /* Ensure white text for readability */
    border-bottom-right-radius: 2px;
    align-self: flex-end;
}

.message.user::after {
    /* Small trick to ensure gradient effect works if we wanted it, but solid is safer for text contrast */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    border-bottom-right-radius: 2px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    z-index: -1;
    opacity: 0.9;
}


/* Input Area */
.ai-chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

.ai-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-option-btn {
    background: white;
    border: 1px solid var(--ai-primary);
    color: var(--ai-primary);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-option-btn:hover {
    background: var(--ai-primary);
    color: white;
}

.ai-input-wrapper {
    display: flex;
    gap: 10px;
}

.ai-input-wrapper input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.ai-send-btn {
    background: var(--ai-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.1);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 10px 15px;
    background: #f0f2f5;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    width: fit-content;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #90949c;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@keyframes message-pop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 101, 216, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(0, 101, 216, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 101, 216, 0);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .ai-widget-launcher {
        bottom: 90px;
        right: 20px;
    }
}