/* AI Chat Widget Styles */
#ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#ai-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary, #1a36a0);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

#ai-chat-toggle:hover {
    transform: scale(1.05);
}

#ai-chat-toggle svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

#ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

#ai-chat-window.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.ai-chat-header {
    background-color: var(--primary, #1a36a0);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-header-user .ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.ai-chat-header-user .ai-name {
    display: block;
    font-weight: bold;
    font-size: 16px;
    line-height: 1.2;
}

.ai-chat-header-user .ai-status {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.2;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.ai-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-message-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 5px;
}

.ai-message-wrapper.user {
    justify-content: flex-end;
}

.ai-message-wrapper.bot {
    justify-content: flex-start;
}

.ai-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.ai-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-message.bot {
    background: #e5e7eb;
    color: #1f2937;
    border-bottom-left-radius: 2px;
}

.ai-message.user {
    background: var(--primary, #1a36a0);
    color: white;
    border-bottom-right-radius: 2px;
}

.ai-chat-input-area {
    display: flex;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

#ai-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#ai-chat-input:focus {
    border-color: var(--primary, #1a36a0);
}

#ai-chat-send {
    background: none;
    border: none;
    color: var(--primary, #1a36a0);
    padding: 0 10px;
    cursor: pointer;
    font-weight: bold;
}

#ai-chat-send:disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.ai-typing {
    display: flex;
    gap: 4px;
    padding: 10px;
    align-items: center;
}

.ai-typing span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    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); }
}

@media (max-width: 400px) {
    #ai-chat-window {
        width: calc(100vw - 40px);
    }
}

.ai-message.bot a {
    color: var(--primary, #1a36a0);
    text-decoration: underline;
    font-weight: 500;
}

.ai-message.bot a:hover {
    text-decoration: none;
}

.ai-message.user a {
    color: #fff;
    text-decoration: underline;
    font-weight: 500;
}

.ai-message.user a:hover {
    color: #e5e7eb;
}

.ai-message.bot ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message.bot li {
    margin-bottom: 6px;
}
