/* Chat Widget Styles */

:root {
    --chat-width: 380px;
    --chat-height: 500px;
    --chat-bg: #ffffff;
    --chat-header-bg: var(--color-primary, #0051A5);
    --chat-header-text: #ffffff;
    --chat-input-bg: #f8f9fa;
    --chat-border: #e5e7eb;
    --chat-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Floating Action Button */
.chat-widget-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--color-primary, #0051A5);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.chat-widget-fab:hover {
    transform: scale(1.05);
    background-color: #003d7a;
}

.chat-widget-fab svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

/* Chat Window */
.chat-widget-window {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: var(--chat-width);
    height: var(--chat-height);
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-widget-window.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* Header */
.chat-widget-header {
    background-color: var(--chat-header-bg);
    color: var(--chat-header-text);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-widget-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
}

.chat-widget-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-widget-close:hover {
    opacity: 1;
}

/* Messages Area */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.chat-message.assistant {
    background-color: white;
    align-self: flex-start;
    border: 1px solid var(--chat-border);
    border-bottom-left-radius: 2px;
}

.chat-message.user {
    background-color: var(--color-primary, #0051A5);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Input Area */
.chat-widget-input {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 0.5rem;
}

.chat-widget-input textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    resize: none;
    height: 44px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    background-color: var(--chat-input-bg);
}

.chat-widget-input textarea:focus {
    border-color: var(--color-primary, #0051A5);
    background-color: white;
}

.chat-widget-send {
    background-color: var(--color-secondary, #FFD700);
    color: var(--color-text, #333);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.chat-widget-send:hover {
    background-color: #e6c200;
    transform: scale(1.05);
}

.chat-widget-send:disabled {
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.chat-typing {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
    display: none;
}

.chat-typing.visible {
    display: block;
}

/* Citations */
.chat-citation {
    display: inline-block;
    background-color: rgba(0, 81, 165, 0.1);
    color: var(--color-primary, #0051A5);
    border-radius: 4px;
    padding: 0 4px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: help;
    margin: 0 2px;
    border: 1px solid rgba(0, 81, 165, 0.2);
}

.chat-citation:hover {
    background-color: rgba(0, 81, 165, 0.2);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-widget-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-widget-fab {
        bottom: 1rem;
        right: 1rem;
    }
}
