/* ========================================
   AI Chat Widget Styles
   ======================================== */

/* ---- Trigger Button ---- */
#ai-chat-widget .chat-trigger {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 9990;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: chatPulse 3s infinite;
}

#ai-chat-widget .chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(79, 70, 229, 0.6);
}

#ai-chat-widget .chat-trigger.hidden {
    display: none;
}

@keyframes chatPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(79, 70, 229, 0.7);
    }
}

/* ---- Chat Window ---- */
#ai-chat-widget .chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 9991;
    width: 380px;
    max-height: 560px;
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#ai-chat-widget .chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ---- Header ---- */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-header-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.chat-header-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

/* ---- Messages ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    max-height: 380px;
}

.chat-msg {
    display: flex;
    max-width: 85%;
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg .msg-content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg.bot .msg-content {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-bottom-left-radius: 4px;
}

.chat-msg.user .msg-content {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    color: white;
    border-bottom-right-radius: 4px;
}

/* ---- Typing Dots ---- */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ---- Input ---- */
.chat-input-area {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    color: white;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: rgba(79, 70, 229, 0.6);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#chat-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #4F46E5;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

#chat-send:hover {
    background: #6366F1;
}

#chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    #ai-chat-widget .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 16px;
        max-height: 80vh;
    }

    #ai-chat-widget .chat-trigger {
        right: 16px;
        bottom: 80px;
    }
}