/* =====================================================
   AI Chat Widget — Floating Button + Slide-out Panel
   ===================================================== */

/* Floating toggle button */
.cove-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cove-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.cove-chat-toggle:active {
    transform: scale(0.95);
}

/* Chat panel */
.cove-chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 9997;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideIn 0.2s ease-out;
}

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

/* Header */
.cove-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

/* Messages area */
.cove-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: calc(100vh - 300px);
}

/* Chat bubbles */
.cove-chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.cove-chat-bubble p { margin: 0 0 6px; }
.cove-chat-bubble p:last-child { margin-bottom: 0; }
.cove-chat-bubble ul, .cove-chat-bubble ol { margin: 4px 0; padding-left: 18px; }
.cove-chat-bubble li { margin-bottom: 2px; }
.cove-chat-bubble a { color: #3b82f6; text-decoration: underline; word-break: break-word; cursor: pointer; }
.cove-chat-bubble a:hover { color: #2563eb; }
.cove-chat-bubble .bi-box-arrow-up-right { vertical-align: baseline; }

.cove-chat-bubble.user {
    align-self: flex-end;
    background: #3b82f6;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cove-chat-bubble.assistant {
    align-self: flex-start;
    background: #f3f4f6;
    color: #374151;
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.cove-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #f3f4f6;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 60px;
}

.cove-chat-typing span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

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

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

/* Input area */
.cove-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.cove-chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.15s;
}

.cove-chat-input:focus {
    border-color: #3b82f6;
}

.cove-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.cove-chat-send:hover { background: #2563eb; }
.cove-chat-send:disabled { background: #d1d5db; cursor: not-allowed; }

/* Responsive */
@media (max-width: 480px) {
    .cove-chat-panel {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 88px;
        max-height: calc(100vh - 100px);
        border-radius: 12px;
    }
}
