/* NeuroRAG Agent Chatbot Widget Styles */
#neurorag-bot-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Position variants */
.neurorag-bot-pos-bottom-right {
    bottom: 20px;
    right: 20px;
}

.neurorag-bot-pos-bottom-left {
    bottom: 20px;
    left: 20px;
}

.neurorag-bot-pos-top-right {
    top: 20px;
    right: 20px;
}

.neurorag-bot-pos-top-left {
    top: 20px;
    left: 20px;
}

/* Admin Bar Compatibility */
body.admin-bar .neurorag-bot-pos-top-right {
    top: 52px;
}

body.admin-bar .neurorag-bot-pos-top-left {
    top: 52px;
}

@media screen and (min-width: 783px) {
    body.admin-bar .neurorag-bot-pos-top-right {
        top: 52px;
    }

    body.admin-bar .neurorag-bot-pos-top-left {
        top: 52px;
    }
}

#neurorag-bot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

#neurorag-bot-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#neurorag-bot-container {
    position: absolute;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

/* Container positioning based on parent class */
.neurorag-bot-pos-bottom-right #neurorag-bot-container {
    bottom: 80px;
    right: 0;
}

.neurorag-bot-pos-bottom-left #neurorag-bot-container {
    bottom: 80px;
    left: 0;
}

.neurorag-bot-pos-top-right #neurorag-bot-container {
    top: 80px;
    right: 0;
}

.neurorag-bot-pos-top-left #neurorag-bot-container {
    top: 80px;
    left: 0;
}

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

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

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

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

.neurorag-bot-pos-top-right #neurorag-bot-container,
.neurorag-bot-pos-top-left #neurorag-bot-container {
    animation: slideInTop 0.3s ease-out;
}

#neurorag-bot-header {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

#neurorag-bot-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

#neurorag-bot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#neurorag-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f8fa;
}

.neurorag-bot-message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

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

.neurorag-bot-message.user {
    justify-content: flex-end;
}

.neurorag-bot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.neurorag-bot-message.bot .neurorag-bot-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.neurorag-bot-message.user .neurorag-bot-message-content {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.neurorag-bot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.neurorag-bot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: typing 1.4s infinite;
}

.neurorag-bot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.neurorag-bot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

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

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

#neurorag-bot-input-area {
    display: flex;
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    gap: 8px;
}

#neurorag-bot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#neurorag-bot-input:focus {
    border-color: #10b981;
}

#neurorag-bot-send {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.2s;
    padding: 0;
    /* 👈 This is crucial! */
    flex-shrink: 0;
}

#neurorag-bot-send svg {
    display: block;
    width: 18px;
    height: 18px;
    stroke: white;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
    /* Prevents click issues */
}

#neurorag-bot-send:hover {
    opacity: 0.9;
    background-color: #005a87;
}

#neurorag-bot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar styling */
#neurorag-bot-messages::-webkit-scrollbar {
    width: 6px;
}

#neurorag-bot-messages::-webkit-scrollbar-track {
    background: transparent;
}

#neurorag-bot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

#neurorag-bot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    #neurorag-bot-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
    }
}