/* WP RAG AI Chatbot - Floating Chat Widget */

:root {
    --wraic-primary: #6366f1;
    --wraic-primary-hover: #4f46e5;
    --wraic-bg: #ffffff;
    --wraic-bg-secondary: #f8fafc;
    --wraic-text: #1e293b;
    --wraic-text-muted: #64748b;
    --wraic-border: #e2e8f0;
    --wraic-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --wraic-radius: 16px;
}

/* Chat Toggle Button */
.wraic-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wraic-primary), var(--wraic-primary-hover));
    border: none;
    cursor: pointer;
    box-shadow: var(--wraic-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 9998;
    padding: 0;
}

.wraic-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 14px 50px rgba(99, 102, 241, 0.4);
}

.wraic-toggle svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

/* Chat Container */
.wraic-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 140px);
    background: var(--wraic-bg);
    border-radius: var(--wraic-radius);
    box-shadow: var(--wraic-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: wraic-slide-up 0.3s ease;
}

.wraic-container.wraic-open {
    display: flex;
}

@keyframes wraic-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Header */
.wraic-header {
	padding: 15px;
    background: linear-gradient(135deg, var(--wraic-primary), var(--wraic-primary-hover));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wraic-header-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wraic-header-title svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.wraic-close {
    padding: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.wraic-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.wraic-close svg {
    width: 16px;
    height: 16px;
    fill: #ffffff;
}

/* Messages Area */
.wraic-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--wraic-bg-secondary);
}

.wraic-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    animation: wraic-fade-in 0.3s ease;
}

@keyframes wraic-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.wraic-message-user {
    align-self: flex-end;
    background: var(--wraic-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.wraic-message-assistant {
    align-self: flex-start;
    background: var(--wraic-bg);
    color: var(--wraic-text);
    border: 1px solid var(--wraic-border);
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.wraic-typing {
    display: flex;
    gap: 4px;
    padding: 16px;
    align-self: flex-start;
}

.wraic-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--wraic-text-muted);
    border-radius: 50%;
    animation: wraic-bounce 1.4s infinite ease-in-out both;
}

.wraic-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.wraic-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes wraic-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area */
.wraic-input-area {
    padding: 16px;
    background: var(--wraic-bg);
    border-top: 1px solid var(--wraic-border);
    display: flex;
    gap: 12px;
}

.wraic-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--wraic-border);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.wraic-input:focus {
    border-color: var(--wraic-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.wraic-input::placeholder {
    color: var(--wraic-text-muted);
}

.wraic-send {
    padding: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--wraic-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.wraic-send:hover:not(:disabled) {
    background: var(--wraic-primary-hover);
    transform: scale(1.05);
}

.wraic-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wraic-send svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

/* Scrollbar */
.wraic-messages::-webkit-scrollbar {
    width: 6px;
}

.wraic-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wraic-messages::-webkit-scrollbar-thumb {
    background: var(--wraic-border);
    border-radius: 3px;
}

.wraic-messages::-webkit-scrollbar-thumb:hover {
    background: var(--wraic-text-muted);
}

/* Welcome Message */
.wraic-welcome {
    text-align: center;
    padding: 20px;
    color: var(--wraic-text-muted);
    font-size: 14px;
}

.wraic-welcome-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--wraic-primary), var(--wraic-primary-hover));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wraic-welcome-icon svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .wraic-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .wraic-toggle {
        bottom: 16px;
        right: 16px;
    }
}