/**
 * Article Chatbot Styles
 * AIDB Article Chat Plugin - Floating Widget
 */

/* Widget Container - Fixed Position */
.aidb-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Floating Action Button */
.aidb-chat-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #1a1a1a;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.aidb-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.aidb-chat-fab:active {
    transform: scale(0.96);
}

.aidb-fab-icon {
    font-size: 24px;
    line-height: 1;
}

.aidb-fab-icon-close {
    font-size: 18px;
    font-style: normal;
}

/* Chat Window */
.aidb-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 340px;
    max-height: 480px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: aidb-slide-up 0.25s ease-out;
}

@keyframes aidb-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.aidb-chat-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

.aidb-chat-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #e8e8e8;
    letter-spacing: 0.3px;
}

.aidb-chat-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    transition: color 0.2s;
    line-height: 1;
}

.aidb-chat-close:hover {
    color: #fff;
}

/* Messages area */
.aidb-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #121212;
    min-height: 200px;
    max-height: 300px;
}

.aidb-chat-message {
    margin-bottom: 12px;
    display: flex;
}

.aidb-chat-message:last-child {
    margin-bottom: 0;
}

.aidb-chat-user {
    justify-content: flex-end;
}

.aidb-chat-assistant {
    justify-content: flex-start;
}

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

.aidb-chat-user .aidb-chat-bubble {
    background: #2d2d2d;
    color: #f0f0f0;
    border-bottom-right-radius: 4px;
}

.aidb-chat-assistant .aidb-chat-bubble {
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid #333;
    border-bottom-left-radius: 4px;
}

/* Thinking indicator */
.aidb-chat-thinking {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
}

.aidb-chat-thinking span {
    width: 6px;
    height: 6px;
    background: #555;
    border-radius: 50%;
    animation: aidb-thinking 1.4s infinite ease-in-out both;
}

.aidb-chat-thinking span:nth-child(1) {
    animation-delay: -0.32s;
}

.aidb-chat-thinking span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes aidb-thinking {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.aidb-chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    gap: 10px;
}

.aidb-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background: #0d0d0d;
    color: #e8e8e8;
    transition: border-color 0.2s;
}

.aidb-chat-input:focus {
    border-color: #555;
}

.aidb-chat-input::placeholder {
    color: #555;
}

.aidb-chat-send {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 6px;
    background: #2d2d2d;
    color: #e8e8e8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.aidb-chat-send:hover:not(:disabled) {
    background: #3d3d3d;
}

.aidb-chat-send:active:not(:disabled) {
    transform: scale(0.94);
}

.aidb-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.aidb-send-icon {
    font-size: 14px;
    margin-left: 1px;
}

/* Error message */
.aidb-chat-error {
    background: #2a1a1a !important;
    border-color: #4a2a2a !important;
    color: #e88 !important;
}

/* Premium Upsell Panel */
.aidb-chat-upsell {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 300px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: aidb-slide-up 0.25s ease-out;
}

.aidb-upsell-content {
    padding: 24px 20px;
    text-align: center;
    background: #121212;
}

.aidb-upsell-content p {
    margin: 0 0 20px 0;
    color: #d4d4d4;
    font-size: 14px;
    line-height: 1.6;
}

.aidb-upsell-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #2d2d2d;
    color: #f0f0f0;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, transform 0.15s;
}

.aidb-upsell-btn:hover {
    background: #3d3d3d;
    color: #fff;
    text-decoration: none;
}

.aidb-upsell-btn:active {
    transform: scale(0.96);
}

/* Scrollbar styling */
.aidb-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.aidb-chat-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.aidb-chat-messages::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.aidb-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aidb-chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .aidb-chat-fab {
        width: 52px;
        height: 52px;
    }

    .aidb-chat-window {
        width: calc(100vw - 32px);
        max-width: 340px;
        right: 0;
        bottom: 64px;
    }

    .aidb-chat-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
}
