/* QueryStream Chatbot Styles */
:root {
    --cream: #f8f6f0;
    --cream-dark: #f0ede5;
    --dark-text: #1a1a1a;
    --medium-text: #4a4a4a;
    --light-text: #6a6a6a;
    --royal-blue: #2563eb;
    --royal-green: #059669;
    --accent: #3b82f6;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Chatbot Widget */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.4);
}

.chatbot-toggle svg {
    color: white;
    transition: all 0.3s ease;
}

.chatbot-toggle.active .icon-chat {
    opacity: 0;
    transform: rotate(180deg);
}

.chatbot-toggle.active .icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

.icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-180deg);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Chatbot Container */
.chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.chatbot-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.chatbot-status {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    color: white;
}

.message.user .message-avatar {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--dark-text);
}

.message-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    backdrop-filter: blur(10px);
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    color: white;
    border: none;
}

.message-time {
    font-size: 0.7rem;
    color: var(--light-text);
    margin-top: 0.25rem;
    text-align: right;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--medium-text);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
}

.chat-input-wrapper {
    position: relative;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    outline: none;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--royal-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

.chat-input::placeholder {
    color: var(--light-text);
}

.send-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button svg {
    color: white;
}

/* Disclaimer */
.chat-disclaimer {
    font-size: 0.7rem;
    color: var(--light-text);
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.chat-disclaimer a {
    color: var(--royal-blue);
    text-decoration: none;
}

.chat-disclaimer a:hover {
    text-decoration: underline;
}

/* Idle Warning */
.idle-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--glass-shadow);
    display: none;
    z-index: 10;
}

.idle-warning.show {
    display: block;
    animation: slideIn 0.3s ease;
}

.idle-warning h4 {
    color: var(--dark-text);
    margin-bottom: 0.5rem;
}

.idle-warning p {
    color: var(--medium-text);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.idle-warning button {
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.idle-warning button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--medium-text);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        position: fixed; /* FIX: Position relative to viewport */
        width: auto; /* Allow left/right to determine width */
        height: auto; /* Allow top/bottom to determine height */
        bottom: 90px; /* Space for the toggle button */
        top: 20px;
        left: 20px;
        right: 20px;
    }
}

/* Welcome Message Styling */
.welcome-message {
    background: linear-gradient(135deg, var(--royal-blue) 0%, var(--royal-green) 100%);
    color: white;
    border: none;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 16px;
}

.welcome-message h4 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.welcome-message p {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.5;
}

/* Quick Buttons */
.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.quick-button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--dark-text);
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.quick-button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}