/* TechnisoftHRMS AI Support Agent - Premium UI */

#ai-agent-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: var(--font-main);
}

#ai-agent-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e40af, #2563eb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    font-size: 24px;
}

#ai-agent-bubble:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 30px rgba(37, 99, 235, 0.5);
}

#ai-agent-bubble.active {
    transform: scale(0.8) rotate(45deg);
    opacity: 0;
    pointer-events: none;
}

#ai-chat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

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

/* Header */
.ai-chat-header {
    padding: 18px 24px;
    background: linear-gradient(to right, #1e40af, #3b82f6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.ai-chat-header .status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.ai-chat-header .close-btn {
    cursor: pointer;
    opacity: 0.8;
    transition: 0.2s;
}

.ai-chat-header .close-btn:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Chat Body */
#ai-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(248, 250, 252, 0.5);
}

.dark-mode #ai-chat-body {
    background: rgba(15, 23, 42, 0.3);
}

/* Messages */
.chat-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    animation: fadeInSlide 0.3s ease forwards;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-ai {
    align-self: flex-start;
    background: var(--bg-input);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border);
}

.msg-user {
    align-self: flex-end;
    background: #1e40af;
    color: white;
    border-bottom-right-radius: 2px;
}

/* Typing Indicator */
.typing-indicator {
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: 14px;
    display: flex;
    gap: 4px;
    align-self: flex-start;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Input Area */
.ai-chat-input-area {
    padding: 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}

#ai-chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
}

#ai-chat-input:focus {
    border-color: #2563eb;
}

.ai-send-btn {
    width: 42px;
    height: 42px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.ai-send-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

/* Markdown Support */
.msg-ai p { margin: 8px 0; }
.msg-ai p:first-child { margin-top: 0; }
.msg-ai p:last-child { margin-bottom: 0; }
.msg-ai code { 
    background: rgba(0,0,0,0.05); 
    padding: 2px 4px; 
    border-radius: 4px; 
    font-family: monospace; 
}
.msg-ai ul { padding-left: 20px; margin: 8px 0; }
