/* RAG WordPress Chatbot Styles */

.rag-wp-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.rag-wp-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0071a4 0%, #007fe5 100%);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 6px;
    bottom: 6px;
}

.rag-wp-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.rag-wp-chatbot-window {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.rag-wp-chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rag-wp-chatbot-header {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.rag-wp-chatbot-header h3 {
    margin: 0px !important;
    padding: 0px !important;
    font-size: 14px;
    font-weight: 600;
}

.rag-wp-chatbot-close {
    background: none;
    border: none;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.rag-wp-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.rag-wp-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

.rag-wp-chatbot-message {
    display: flex;
    gap: 12px;
    max-width: 98%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rag-wp-chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.rag-wp-chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.rag-wp-chatbot-message.assistant .rag-wp-chatbot-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.rag-wp-chatbot-message.user .rag-wp-chatbot-avatar {
    background: #e9ecef;
    color: #495057;
}

.rag-wp-chatbot-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
}

.rag-wp-chatbot-message.assistant .rag-wp-chatbot-bubble {
    background: white;
    color: #212529;
    border-bottom-left-radius: 4px;
}

.rag-wp-chatbot-message.user .rag-wp-chatbot-bubble {
    background: linear-gradient(135deg, #0071a4 0%, #007fe5 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.rag-wp-chatbot-sources {
    margin-top: 8px;
    padding-top: 8px;
    font-size: 12px;
    color: #6c757d;
}

.rag-wp-chatbot-source {
    display: block;
    margin-top: 4px;
    color: #667eea;
    text-decoration: none;
}

.rag-wp-chatbot-source:hover {
    text-decoration: underline;
}

/* Markdown formatting within messages */
.rag-wp-chatbot-bubble h1,
.rag-wp-chatbot-bubble h2,
.rag-wp-chatbot-bubble h3,
.rag-wp-chatbot-bubble h4 {
    margin: 12px 0 8px 0;
    line-height: 1.3;
    font-weight: 600;
}

.rag-wp-chatbot-bubble h1:first-child,
.rag-wp-chatbot-bubble h2:first-child,
.rag-wp-chatbot-bubble h3:first-child,
.rag-wp-chatbot-bubble h4:first-child {
    margin-top: 0;
}

.rag-wp-chatbot-bubble h1 {
    font-size: 1.5em;
}

.rag-wp-chatbot-bubble h2 {
    font-size: 1.3em;
}

.rag-wp-chatbot-bubble h3 {
    font-size: 1.15em;
}

.rag-wp-chatbot-bubble h4 {
    font-size: 1.05em;
}

.rag-wp-chatbot-bubble ul,
.rag-wp-chatbot-bubble ol {
    margin: 8px 0;
    padding-left: 24px;
}

.rag-wp-chatbot-bubble li {
    margin: 4px 0;
    line-height: 1.5;
}

.rag-wp-chatbot-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.rag-wp-chatbot-message.user .rag-wp-chatbot-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.rag-wp-chatbot-bubble blockquote {
    margin: 12px 0;
    padding: 8px 12px;
    border-left: 4px solid #667eea;
    background: rgba(102, 126, 234, 0.05);
    font-style: italic;
}

.rag-wp-chatbot-bubble hr {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #e9ecef;
}

.rag-wp-chatbot-bubble a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.rag-wp-chatbot-bubble a:hover {
    border-bottom-color: #667eea;
}

.rag-wp-chatbot-message.user .rag-wp-chatbot-bubble a {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.rag-wp-chatbot-message.user .rag-wp-chatbot-bubble a:hover {
    border-bottom-color: white;
}

.rag-wp-chatbot-bubble strong {
    font-weight: 600;
}

.rag-wp-chatbot-bubble em {
    font-style: italic;
}

.rag-wp-chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
}

.rag-wp-chatbot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.rag-wp-chatbot-input:focus {
    border-color: #667eea;
}

.rag-wp-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #aaa;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rag-wp-chatbot-send:hover:not(:disabled) {
    transform: scale(1.1);
}

.rag-wp-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rag-wp-chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.rag-wp-chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

.rag-wp-chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.rag-wp-chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .rag-wp-chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .rag-wp-chatbot {
        bottom: 10px;
        right: 10px;
    }
}

body:has(.akea-footer-back-to-top-button.akea-scrolled) .rag-wp-chatbot-toggle {
    bottom: 90px !important;
}