/* assets/css/siera-chat.css */
/* Gemini-inspired floating chat UI for SIERA */

#siera-chat-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Floating Chat Trigger Button */
#siera-chat-toggle-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #6D3CF6; /* SIERA Purple */
    color: #ffffff;
    font-size: 26px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    padding: 0;
}

#siera-chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.7);
}

/* Chat Window Container (Gemini-style) */
#siera-chat-window {
    position: absolute;
    bottom: 70px; /* sit above the trigger button */
    right: 0;
    width: 350px;
    max-width: 90vw;
    height: 450px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Start hidden (closed) */
    transform: translateY(100px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.4, 1.2),
                opacity 0.3s ease,
                visibility 0.3s ease;
}

/* Visible (open) state */
#siera-chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
#siera-chat-header {
    padding: 14px 16px;
    background-color: #6D3CF6; /* SIERA Purple */
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.05rem;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

#siera-chat-header .siera-title {
    margin: 0;
}

/* Chat Body / Messages Area */
#siera-chat-body {
    flex-grow: 1;
    padding: 10px 12px;
    overflow-y: auto;
    background-color: #f9fafb; /* light gray */
}

/* Message Bubbles (Gemini-style) */
.siera-message {
    margin-bottom: 12px;
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 0.95rem;
    animation: sieraFadeIn 0.3s ease-out;
}

/* User message – right aligned, blue bubble */
.siera-user-msg {
    background-color: #3b82f6; /* Tailwind blue-500 */
    color: #ffffff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    border-top-right-radius: 18px;
}

/* Bot message – left aligned, light gray bubble */
.siera-bot-msg {
    background-color: #e5e7eb; /* Tailwind gray-200 */
    color: #1f2937; /* Tailwind gray-800 */
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-top-left-radius: 18px;
}

/* Typing indicator */
.siera-typing-msg {
    background-color: #e0f2fe; /* light blue */
    color: #0369a1;
    font-style: italic;
}

/* Error message bubble */
.siera-error-msg {
    background-color: #fee2e2; /* light red */
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Sources bubble */
.siera-source-msg {
    background-color: #fef3c7; /* amber-100 */
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Animation for new messages */
@keyframes sieraFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Footer / Input area */
#siera-chat-footer {
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    background-color: #ffffff;
}

#siera-chat-input {
    flex-grow: 1;
    padding: 10px 14px;
    border-radius: 25px;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    outline: none;
    margin-right: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

#siera-chat-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

#siera-chat-send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #10b981;
    color: #ffffff;
    font-size: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, transform 0.1s ease;
    padding: 0;
}

#siera-chat-send-btn:hover {
    background-color: #059669;
    transform: scale(1.05);
}

#siera-chat-send-btn:active {
    transform: scale(0.95);
}

/* Sources list styling (from original widget, lightly refined) */
.siera-sources {
    margin-top: 8px;
    font-size: 11px;
}

.siera-sources h6 {
    margin: 0 0 4px 0;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
}

.siera-sources ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.siera-sources li {
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.siera-sources a {
    color: #2563eb;
    text-decoration: none;
}

.siera-sources a:hover {
    text-decoration: underline;
}

/* Responsive: slightly larger on mobile */
@media (max-width: 600px) {
    #siera-chat-window {
        width: calc(100vw - 48px);
        height: 70vh;
    }
}

/* Inline toggle button that appears in the LearnPress lesson header/content */
.siera-inline-toggle {
    margin-bottom: 12px;
    display: flex;
    justify-content: flex-end;
}

.siera-inline-toggle #siera-inline-toggle-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #10b981;
    background-color: #ecfdf5; /* very light green */
    color: #065f46;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.siera-inline-toggle #siera-inline-toggle-btn::before {
    content: '💬';
    font-size: 1rem;
}

.siera-inline-toggle #siera-inline-toggle-btn:hover {
    background-color: #d1fae5;
    color: #047857;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

