/* AI Chatbot Widget Styles - Premium Version */
:root {
    --cb-primary: #14a484;
    --cb-primary-glow: rgba(20, 164, 132, 0.4);
    --cb-secondary: #003366;
    --cb-bg: rgba(255, 255, 255, 0.95);
    --cb-msg-ai: #ffffff;
    --cb-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    --cb-glass-bg: rgba(255, 255, 255, 0.85);
    --cb-accent: #00c8ff;
}

.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
}

/* Floating Bubble */
.chatbot-bubble {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--cb-primary), #00A86B);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px var(--cb-primary-glow);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.chatbot-bubble::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: rotate(45deg);
    animation: bubbleShine 3s infinite;
}

@keyframes bubbleShine {
    0% { transform: translate(-100%, -100%) rotate(45deg); }
    50% { transform: translate(100%, 100%) rotate(45deg); }
    100% { transform: translate(100%, 100%) rotate(45deg); }
}

.chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px var(--cb-primary-glow);
}

.chatbot-bubble svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 400px;
    max-width: 90vw;
    height: 600px;
    max-height: 80vh;
    background: var(--cb-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    transform-origin: bottom right;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: var(--cb-secondary);
    background: linear-gradient(135deg, var(--cb-secondary), #2a3d66);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff !important;
}

.chatbot-header h3, 
#chatbot-window .chatbot-header h3 {
    margin: 0 !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    letter-spacing: -0.02em !important;
}

.chatbot-close {
    cursor: pointer;
    font-size: 1.5rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    color: white !important;
}

.chatbot-close:hover {
    opacity: 1;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background-color: #fcfcfc;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease-out forwards;
}

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

.message-ai {
    align-self: flex-start;
    background-color: var(--cb-msg-ai);
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid #efefef;
}

.message-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--cb-primary), #0e8a6d);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(20, 164, 132, 0.2);
}

/* Typing Indicator (Dot Animation) */
.typing-indicator {
    padding: 10px 25px;
    display: none;
    align-items: center;
    gap: 5px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Input Area */
.chatbot-input-area {
    padding: 20px;
    background: white;
    display: flex;
    gap: 12px;
    align-items: center;
    border-top: 1px solid #f0f0f0;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    padding: 12px 20px;
    outline: none;
    font-size: 0.95rem;
    transition: all 0.3s;
    background: #fdfdfd;
}

.chatbot-input:focus {
    border-color: var(--cb-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(20, 164, 132, 0.1);
}

.chatbot-send {
    background: var(--cb-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(20, 164, 132, 0.2);
}

.chatbot-send:hover {
    transform: rotate(15deg) scale(1.05);
    background: #0e8a6d;
}

/* Sources */
.sources-list {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.sources-list strong {
    color: #34495e;
    display: block;
    margin-bottom: 5px;
}

.source-item {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f5f4;
    color: var(--cb-primary);
    text-decoration: none;
    border-radius: 6px;
    margin-right: 5px;
    margin-bottom: 5px;
    font-weight: 500;
    transition: all 0.2s;
}

.source-item:hover {
    background: var(--cb-primary);
    color: white;
}

/* Chatbot Branding */
.chatbot-branding {
    padding: 10px 15px;
    background: #f8f9fb;
    text-align: center;
    font-size: 0.75rem;
    color: #999;
    border-top: 1px solid #edf0f2;
    border-radius: 0 0 18px 18px;
}

.chatbot-branding a {
    color: var(--cb-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.chatbot-branding a:hover {
    color: var(--cb-secondary);
    text-decoration: underline;
}
