/* public/css/ai-chat-ui.css */

/* AI Chat Overlay Styles */
#ai-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    background: rgba(30,30,40,0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 99999;
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    color: white;
}

#ai-chat-container.open {
    transform: translateY(0);
}

#ai-chat-container.top-left-aligned {
    top: 90px;
    left: 20px;
    bottom: auto;
    right: auto;
    transform: translateY(-150%);
}
#ai-chat-container.top-left-aligned.open {
    transform: translateY(0);
}

.ai-chat-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.ai-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

#ai-chat-history {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
}

.chat-message {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-message.user {
    align-self: flex-end;
    background: #2a5298;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    align-self: flex-start;
    background: rgba(255,255,255,0.1);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.ai-chat-input-area {
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 10px;
    align-items: center;
}

#ai-chat-input {
    flex-grow: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    outline: none;
}

#ai-chat-input:focus {
    border-color: #4a90e2;
}

.ai-action-btn {
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-action-btn:hover {
    background: #357abd;
}

.ai-action-btn.recording {
    background: #e24a4a;
    animation: pulse 1s infinite alternate;
}

/* Floating Action Button */
#ai-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 65px;
    height: 65px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 99998;
    color: white;
    font-size: 24px;
    border: none;
    transition: transform 0.2s, filter 0.2s;
}

#ai-fab img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#ai-fab:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.typing-indicator {
    padding: 10px 14px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #aaa;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Suggested Action Chips Container */
.ai-suggested-actions-container {
    display: flex;
    gap: 8px;
    padding: 10px 15px 0;
    align-items: flex-start;
}

.ai-suggested-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    flex-grow: 1;
    overflow: hidden;
}

.ai-suggested-actions.collapsed {
    max-height: 28px; /* Restricts to exactly one line of chips */
}

.ai-suggested-actions.expanded {
    max-height: none; /* Allows stretching to reveal wrapped chips */
}

/* Attachment & Modal Styles */
.chat-attachment-img {
    display: block;
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.2s;
}

.chat-attachment-img:hover {
    transform: scale(1.02);
}

#ai-image-modal {
    display: none;
    position: fixed;
    z-index: 100001; /* Higher than ai-chat-container */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#ai-image-modal img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    border: 2px solid #4a90e2;
    border-radius: 4px;
}

.ai-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* AI Thought/Reasoning Block */
.ai-thought-block {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-left: 3px solid #4a90e2;
    border-radius: 4px;
    color: #b0b0b0;
    font-size: 0.9em;
}

.ai-thought-block summary {
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    margin-bottom: 4px;
    outline: none;
}

.ai-thought-content {
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-style: italic;
}

.ai-message-content {
    white-space: pre-wrap;
}
