/* NeuroRAG Agent Chatbot Widget Styles */
#neurorag-bot-widget {
    position: fixed;
    z-index: 50;    
    isolation: isolate;
    --chatbot-horizontal-offset: 24px;
    --chatbot-top-offset: 24px;
    --chatbot-launcher-offset-bottom: 24px;
    --chatbot-avoid-offset-bottom: 0px;
    --chatbot-safe-area-bottom: 0px;
    --chatbot-launcher-size: 60px;
    --chatbot-launcher-gap: 18px;
    --chatbot-active-bottom-offset: calc(var(--chatbot-launcher-offset-bottom) + var(--chatbot-avoid-offset-bottom) + var(--chatbot-safe-area-bottom));
    --chatbot-container-offset: calc(var(--chatbot-launcher-size) + var(--chatbot-launcher-gap));
    --chatbot-primary: #10b981;
    --chatbot-primary-bg: #FFEBA1;
    --chatbot-secundary: #FFD000;
    --chatbot-bg: #FFFBEA;
    --chatbot-text: #74450F;
    --chatbot-accent: #3b82f6;
    --chatbot-gradient: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-accent) 100%);
    --chatbot-user-chat: #E8E8E8;
    --chatbot-surface: #ffffff;
    --chatbot-surface-muted: #f7f8fa;
    --chatbot-bot-bubble: #ffffff;
    --chatbot-bot-text: #333333;
    --chatbot-border: #e5e7eb;
    --chatbot-input-bg: #ffffff;
    --chatbot-input-text: #111827;
    --chatbot-width: 380px;
    --chatbot-height: 600px;
    --chatbot-radius: 18px;
    --chatbot-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --chatbot-bot-name-color: #ffffff;
    --chatbot-user-text: #ffffff;
    --chatbot-send-arrow-color: #ffffff;
    --chatbot-new-chat-color: #ffffff;
    --chatbot-new-chat-border-color: rgba(255, 255, 255, 0.35);
    --chatbot-new-chat-border-hover-color: rgba(255, 255, 255, 0.6);
    --chatbot-close-button-color: #ffffff;
    font-family: var(--chatbot-font);
    transition: bottom 0.25s ease, left 0.25s ease, right 0.25s ease, top 0.25s ease;
}

/* ── Position variants ───────────────────────────────────────────────────── */
.neurorag-bot-pos-bottom-right { bottom: var(--chatbot-active-bottom-offset); right: var(--chatbot-horizontal-offset); left: auto; top: auto; }
.neurorag-bot-pos-bottom-left  { bottom: var(--chatbot-active-bottom-offset); left: var(--chatbot-horizontal-offset); right: auto; top: auto; }
.neurorag-bot-pos-top-right    { top: var(--chatbot-top-offset); right: var(--chatbot-horizontal-offset); bottom: auto; left: auto; }
.neurorag-bot-pos-top-left     { top: var(--chatbot-top-offset); left: var(--chatbot-horizontal-offset); bottom: auto; right: auto; }

body.admin-bar .neurorag-bot-pos-top-right,
body.admin-bar .neurorag-bot-pos-top-left { top: 56px; }

body.admin-bar .neurorag-bot-pos-top-right #neurorag-bot-container,
body.admin-bar .neurorag-bot-pos-top-left  #neurorag-bot-container {
    max-height: calc(100dvh - 56px - var(--chatbot-container-offset) - 24px);
}

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

/* ── Launcher button ─────────────────────────────────────────────────────── */
#neurorag-bot-button {
    width: var(--chatbot-launcher-size);
    height: var(--chatbot-launcher-size);
    border-radius: 50%;
    background: var(--chatbot-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.25s ease,
                background 0.25s ease,
                filter 0.25s ease;
    overflow: visible;
    position: relative;
    font-size: 22px;
    z-index: 2;
    padding: 0;
}

/* Pulse ring animation */
#neurorag-bot-button::before,
#neurorag-bot-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--chatbot-launcher-size);
    height: var(--chatbot-launcher-size);
    border-radius: 50%;
    background: var(--chatbot-primary);
    opacity: 0;
    transform: translate(-50%, -50%) scale(1);
    animation: pulseRing 2.5s ease-out infinite;
    z-index: -1;
    pointer-events: none;
}
#neurorag-bot-button::after {
    animation-delay: 1.25s;
}
@keyframes pulseRing {
    0%   { transform: translate(-50%, -50%) scale(1);    opacity: 0.55; }
    100% { transform: translate(-50%, -50%) scale(1.75); opacity: 0; }
}

/* Remove button gradient background and pulse rings when it displays a custom image */
#neurorag-bot-button:has(img) {
    background: transparent;
    box-shadow: none;
    border: 3px solid var(--chatbot-secundary);
}
#neurorag-bot-button:has(img)::before,
#neurorag-bot-button:has(img)::after {
    animation: none;
    opacity: 0;
    display: none;
}

/* Hover espectacular */
#neurorag-bot-button:hover {
    transform: scale(1.12) translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    
    
}

/* Estado abierto — ícono X */
#neurorag-bot-button.neurorag-bot-button--open {
    background: rgba(30, 30, 30, 0.72);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--chatbot-secundary);
}
#neurorag-bot-button.neurorag-bot-button--open:hover {
    transform: scale(1.08) translateY(-2px);

}
#neurorag-bot-button.neurorag-bot-button--open::before,
#neurorag-bot-button.neurorag-bot-button--open::after {
    animation: none;
    opacity: 0;
}

/* Animación de entrada del ícono X */
.neurorag-close-icon { display: block; }

@keyframes closeIconSpin {
    from { transform: rotate(-90deg) scale(0.4); opacity: 0; }
    to   { transform: rotate(0deg)  scale(1);   opacity: 1; }
}
#neurorag-bot-button.neurorag-bot-button--open .neurorag-close-icon {
    animation: closeIconSpin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Efecto ripple al hacer click */
.neurorag-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: rippleExpand 0.6s linear forwards;
    pointer-events: none;
}
@keyframes rippleExpand {
    to { transform: scale(4); opacity: 0; }
}

#neurorag-bot-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    pointer-events: none;
    clip-path: circle(50%);
}

/* ── Chat container ──────────────────────────────────────────────────────── */
#neurorag-bot-container {
    position: absolute;
    width: var(--chatbot-width);
    height: min(var(--chatbot-height), calc(100dvh - var(--chatbot-active-bottom-offset) - var(--chatbot-container-offset) - 8px));
    max-width: calc(100vw - (var(--chatbot-horizontal-offset) * 2));
    background: var(--chatbot-surface);
    border-radius: var(--chatbot-radius);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.18),
        0 8px 24px rgba(0, 0, 0, 0.10),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: widgetOpen 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

@keyframes widgetOpen {
    from { opacity: 0; transform: scale(0.9) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.neurorag-bot-pos-bottom-right #neurorag-bot-container,
.neurorag-bot-pos-bottom-left  #neurorag-bot-container {
    bottom: var(--chatbot-container-offset);
    max-height: calc(100dvh - var(--chatbot-active-bottom-offset) - var(--chatbot-container-offset) - 8px);
}
.neurorag-bot-pos-bottom-right #neurorag-bot-container { right: 0; }
.neurorag-bot-pos-bottom-left  #neurorag-bot-container { left: 0; }
.neurorag-bot-pos-top-right #neurorag-bot-container,
.neurorag-bot-pos-top-left  #neurorag-bot-container {
    top: var(--chatbot-container-offset);
    max-height: calc(100dvh - var(--chatbot-top-offset) - var(--chatbot-container-offset) - 24px);
}
.neurorag-bot-pos-top-right #neurorag-bot-container { right: 0; }
.neurorag-bot-pos-top-left  #neurorag-bot-container { left: 0; }

.neurorag-bot-pos-top-right #neurorag-bot-container,
.neurorag-bot-pos-top-left  #neurorag-bot-container {
    animation: widgetOpenTop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes widgetOpenTop {
    from { opacity: 0; transform: scale(0.9) translateY(-16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Animación de cierre */
@keyframes widgetClose {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(0.92) translateY(14px); }
}
@keyframes widgetCloseTop {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(0.92) translateY(-14px); }
}
.neurorag-bot-container--closing {
    animation: widgetClose 0.22s cubic-bezier(0.4, 0, 0.6, 1) forwards !important;
    pointer-events: none;
}
.neurorag-bot-pos-top-right .neurorag-bot-container--closing,
.neurorag-bot-pos-top-left  .neurorag-bot-container--closing {
    animation: widgetCloseTop 0.22s cubic-bezier(0.4, 0, 0.6, 1) forwards !important;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
#neurorag-bot-header {
    background: var(--chatbot-gradient);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

#neurorag-bot-header::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: headerShimmer 7s ease-in-out infinite;
    pointer-events: none;
}
@keyframes headerShimmer {
    0%   { left: -100%; }
    30%  { left: 120%; }
    100% { left: 120%; }
}

.neurorag-bot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.neurorag-bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;

    img{
         width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    }
}

.neurorag-bot-header-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#neurorag-bot-title {
    font-family: "BebasNeue";
    font-weight: 900;
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--chatbot-bot-name-color);
}

.neurorag-bot-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--chatbot-online-color, inherit);
}

.neurorag-bot-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chatbot-online-color, #4ade80);
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
    animation: statusPulse 2.2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35); }
    50%       { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); }
}

#neurorag-bot-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

#neurorag-bot-new {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--chatbot-new-chat-border-color, rgba(255, 255, 255, 0.35));
    color: var(--chatbot-new-chat-color, #ffffff);
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 6px 12px;
    border-radius: 999px;
    transition: background 0.2s, border-color 0.2s;
}

#neurorag-bot-new:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: var(--chatbot-new-chat-border-hover-color, rgba(255, 255, 255, 0.6));
}

#neurorag-bot-close {
    background: none;
    border: none;
    color: var(--chatbot-close-button-color, #ffffff);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#neurorag-bot-close:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

#neurorag-bot-close:focus,
#neurorag-bot-close:focus-visible {
    outline: none;
}

/* ── Messages area ───────────────────────────────────────────────────────── */
#neurorag-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    background: var(--chatbot-surface-muted);
    scroll-behavior: smooth;
}

/* Custom scrollbar */
#neurorag-bot-messages::-webkit-scrollbar { width: 4px; }
#neurorag-bot-messages::-webkit-scrollbar-track { background: transparent; }
#neurorag-bot-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
#neurorag-bot-messages::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Message bubbles ─────────────────────────────────────────────────────── */
.neurorag-bot-message {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    animation: messageIn 0.25s ease-out;
    animation-fill-mode: forwards;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.neurorag-bot-message.user {
    align-items: flex-end;
}

.neurorag-bot-message-content {
    max-width: 78%;
    padding: 11px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.5;
    font-size: 14px;
}

.neurorag-bot-message.bot .neurorag-bot-message-content {
    background: var(--chatbot-bot-bubble);
    color: var(--chatbot-bot-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.neurorag-bot-message-content h2,
.neurorag-bot-message-content h3,
.neurorag-bot-message-content h4 {
    margin: 10px 0 4px;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.3;
}

.neurorag-bot-message-content h2 strong,
.neurorag-bot-message-content h3 strong,
.neurorag-bot-message-content h4 strong {
    font-weight: inherit;
}

.neurorag-bot-message-content p {
    margin: 0 0 10px;
}

.neurorag-bot-message-content p:last-child {
    margin-bottom: 0;
}

.neurorag-bot-message-content ul,
.neurorag-bot-message-content ol {
    margin: 8px 0 10px 20px;
    padding: 0;
}

.neurorag-bot-message-content li ul,
.neurorag-bot-message-content li ol {
    margin: 4px 0 4px 16px;
}

.neurorag-bot-message-content li {
    margin: 0 0 6px;
    line-height: 1.45;
}

.neurorag-bot-message-content li:last-child {
    margin-bottom: 0;
}

.neurorag-bot-message-content a,
.neurorag-bot-message-content a:visited {
    color: #D19A00;
    text-decoration: underline;
    text-decoration-color: #D19A00;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    font-weight: 400;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.neurorag-bot-message-content a:hover {
    color: #74450F;
    text-decoration: underline;
    text-decoration-color: #74450F;
}

.neurorag-bot-message.user .neurorag-bot-message-content a {
    color: inherit;
}

.neurorag-bot-message.user .neurorag-bot-message-content {
    background: var(--chatbot-user-chat);
    color: var(--chatbot-user-text);
    border-bottom-right-radius: 4px;
}

/* ── Typing indicator ────────────────────────────────────────────────────── */
.neurorag-bot-typing {
    display: flex;
    gap: 5px;
    padding: 13px 16px;
    background: var(--chatbot-bot-bubble);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.neurorag-bot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    animation: typing 1.4s infinite ease-in-out;
}

.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);   background: var(--chatbot-border); opacity: 0.6; }
    30%            { transform: translateY(-8px); background: var(--chatbot-primary); opacity: 1; }
}

/* ── Suggestions area ────────────────────────────────────────────────────── */
#neurorag-bot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 16px 4px;
    background: var(--chatbot-surface);
    border-top: 1px solid var(--chatbot-border);
}

#neurorag-bot-suggestions:empty {
    display: none;
}

.neurorag-suggestion-chip {
    background: var(--chatbot-bg); 
    color: #000000;
    border: 1.5px solid var(--chatbot-primary-bg);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    line-height: 1.3;
    text-align: left;
    animation: chipSlideUp 0.3s ease-out;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

@keyframes chipSlideUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.neurorag-suggestion-chip:hover,
.neurorag-suggestion-chip:focus-visible {
    background: var(--chatbot-secundary);
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--chatbot-primary-rgb, 16, 185, 129), 0.32);
    border-color: transparent;
}

/* ── Input area ──────────────────────────────────────────────────────────── */
#neurorag-bot-input-area {
    display: flex;
    padding: 12px 14px;
    background: var(--chatbot-surface);
    border-top: 1px solid var(--chatbot-border);
    gap: 8px;
    align-items: flex-end;
}

#neurorag-bot-input {
    flex: 1;
    border: 1.5px solid #C4C4C4;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--chatbot-input-bg);
    color: var(--chatbot-input-text);
    min-height: 42px;
    max-height: 120px;
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    font-family: inherit;
    display: block;
}

#neurorag-bot-input:focus {
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 3px rgba(var(--chatbot-primary-rgb, 16, 185, 129), 0.14),
                0 2px 8px rgba(0, 0, 0, 0.06);
}

#neurorag-bot-send {
    background: var(--chatbot-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    min-width: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s, transform 0.15s;
    padding: 0;
    flex-shrink: 0;
}

#neurorag-bot-send svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: var(--chatbot-send-arrow-color);
    pointer-events: none;
}

#neurorag-bot-send:hover:not(:disabled) {
    opacity: 1;
    transform: scale(1.1) rotate(-12deg);
    box-shadow: 0 4px 14px rgba(var(--chatbot-primary-rgb, 16, 185, 129), 0.4);
}

#neurorag-bot-send:active:not(:disabled) {
    transform: scale(0.96) rotate(-12deg);
}

#neurorag-bot-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* ── Source chips ────────────────────────────────────────────────────────── */
.neurorag-source-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--chatbot-border);
}

.neurorag-source-label {
    font-size: 11px;
    color: #000000;
    flex-shrink: 0;
}

.neurorag-source-chip { 
    display: inline-flex;
    align-items: center;
    background: var(--chatbot-bg);
    border: 1px solid var(--chatbot-primary-bg);
    border-radius: 999px;
    padding: 3px 10px;
    color: #000000;
    font-size: 11px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.neurorag-source-chip:hover,
.neurorag-source-chip:focus-visible {
    background: var(--chatbot-secundary);
    color: #000000;
    text-decoration: none;
    transform: translateY(-1px);
    border-color: transparent;
}

/* ── Fallback notice (shown when AI provider is unavailable) ─────────────── */
.neurorag-fallback-notice {
    font-size: 10px;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 2px 7px;
    margin-top: 6px;
    display: inline-block;
}

/* ── Message timestamps ──────────────────────────────────────────────────── */
.neurorag-msg-time {
    font-size: 10px;
    opacity: 0.45;
    display: block;
    margin-top: 3px;
    line-height: 1;
}
.neurorag-bot-message.user .neurorag-msg-time { text-align: right; }
.neurorag-bot-message.bot  .neurorag-msg-time { text-align: left; padding-left: 2px; }

/* ── Inactivity / session-expired styles ─────────────────────────────────── */
.neurorag-msg-expired .neurorag-msg-expired-content {
    background: #f3f4f6;
    color: #6b7280;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    padding: 10px 14px;
}
.neurorag-bot-status.neurorag-status-expired {
    color: #FF4C32 !important;
}
.neurorag-bot-status.neurorag-status-expired::before {
    background: #FF4C32 !important;
    box-shadow: 0 0 0 2px rgba(255, 76, 50, 0.3);
    animation: statusPulseExpired 2.2s ease-in-out infinite;
}
@keyframes statusPulseExpired {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 76, 50, 0.3); }
    50%       { box-shadow: 0 0 0 5px rgba(255, 76, 50, 0); }
    
}

/* ── Dark theme ──────────────────────────────────────────────────────────── */
.neurorag-theme-dark,
#neurorag-bot-widget[data-theme="dark"] {
    --chatbot-surface: #1f2937;
    --chatbot-surface-muted: #111827;
    --chatbot-bot-bubble: #374151;
    --chatbot-bot-text: #f9fafb;
    --chatbot-border: #374151;
    --chatbot-input-bg: #374151;
    --chatbot-input-text: #f9fafb;
}

.neurorag-theme-dark #neurorag-bot-container,
#neurorag-bot-widget[data-theme="dark"] #neurorag-bot-container {
    background: #1f2937;
    color: #f9fafb;
}

.neurorag-theme-dark #neurorag-bot-messages,
#neurorag-bot-widget[data-theme="dark"] #neurorag-bot-messages {
    background: var(--chatbot-surface-muted);
}

.neurorag-theme-dark .neurorag-bot-message.bot .neurorag-bot-message-content,
#neurorag-bot-widget[data-theme="dark"] .neurorag-bot-message.bot .neurorag-bot-message-content {
    background: var(--chatbot-bot-bubble);
    color: var(--chatbot-bot-text);
}

.neurorag-theme-dark .neurorag-bot-typing,
#neurorag-bot-widget[data-theme="dark"] .neurorag-bot-typing {
    background: var(--chatbot-bot-bubble);
}

.neurorag-theme-dark #neurorag-bot-input-area,
#neurorag-bot-widget[data-theme="dark"] #neurorag-bot-input-area {
    background: var(--chatbot-surface);
    border-top-color: var(--chatbot-border);
}

.neurorag-theme-dark #neurorag-bot-input,
#neurorag-bot-widget[data-theme="dark"] #neurorag-bot-input {
    background: var(--chatbot-input-bg);
    border-color: var(--chatbot-border);
    color: var(--chatbot-input-text);
}

.neurorag-theme-dark #neurorag-bot-suggestions,
#neurorag-bot-widget[data-theme="dark"] #neurorag-bot-suggestions {
    background: var(--chatbot-surface);
    border-top-color: var(--chatbot-border);
}

.neurorag-theme-dark .neurorag-source-chip,
#neurorag-bot-widget[data-theme="dark"] .neurorag-source-chip {
    background: var(--chatbot-surface);
    border-color: var(--chatbot-border);
}

/* Estado abierto del botón en dark */
.neurorag-theme-dark #neurorag-bot-button.neurorag-bot-button--open,
#neurorag-bot-widget[data-theme="dark"] #neurorag-bot-button.neurorag-bot-button--open {
    background: rgba(255, 255, 255, 0.12);
}

/* Timestamps en dark */
.neurorag-theme-dark .neurorag-msg-time,
#neurorag-bot-widget[data-theme="dark"] .neurorag-msg-time {
    color: var(--chatbot-bot-text);
    opacity: 0.4;
}

/* ── Screen-reader only utility ──────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Focus visible (WCAG 2.1 AA) ────────────────────────────────────────── */
#neurorag-bot-widget :focus-visible {
    outline-offset: 2px;
}

/* ── Reduced motion (WCAG 2.1) ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #neurorag-bot-container,
    #neurorag-bot-button,
    #neurorag-bot-button::before,
    #neurorag-bot-button::after,
    .neurorag-bot-message,
    .neurorag-suggestion-chip,
    .neurorag-source-chip,
    #neurorag-bot-send,
    #neurorag-bot-header::after,
    .neurorag-bot-status::before,
    .neurorag-bot-container--closing,
    .neurorag-close-icon,
    .neurorag-ripple,
    #neurorag-bot-close {
        animation: none !important;
        transition: none !important;
    }
    .neurorag-bot-typing span { animation: none !important; opacity: 1 !important; }
}

/* ── Tablet (481–768px) ───────────────────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
    #neurorag-bot-widget {
        --chatbot-horizontal-offset: 20px;
        --chatbot-launcher-offset-bottom: 24px;
        --chatbot-launcher-gap: 16px;
    }

    #neurorag-bot-container {
        width: min(420px, calc(100vw - (var(--chatbot-horizontal-offset) * 2)));
        height: min(var(--chatbot-height), calc(100dvh - var(--chatbot-active-bottom-offset) - var(--chatbot-container-offset) - 16px));
        border-radius: 16px;
    }
}

/* Disable pulse ring on mobile/tablet — prevents overlap with other page elements */
@media (max-width: 768px) {
    #neurorag-bot-button::before,
    #neurorag-bot-button::after {
        animation: none;
        opacity: 0;
    }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #neurorag-bot-widget {
        --chatbot-horizontal-offset: 16px;
        --chatbot-launcher-offset-bottom: 24px;
        --chatbot-launcher-gap: 16px;
    }

    #neurorag-bot-container {
        width: calc(100vw - (var(--chatbot-horizontal-offset) * 2));
        height: min(var(--chatbot-height), calc(100dvh - var(--chatbot-active-bottom-offset) - var(--chatbot-container-offset) - 16px));
        border-radius: 16px;
    }

    #neurorag-bot-new,
    #neurorag-bot-close { min-height: 40px; min-width: 40px; }

    .neurorag-suggestion-chip { min-height: 40px; padding: 8px 16px; }
}

/* ── iOS safe-area (notch / home bar) ────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #neurorag-bot-widget { --chatbot-safe-area-bottom: env(safe-area-inset-bottom); }

    @media (max-width: 480px) {
        #neurorag-bot-input-area {
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }
    }
}

/* ── Short viewports (≤ 728px height) ────────────────────────────────────── */
@media (min-height: 728px ) {
    #neurorag-bot-widget {
        --chatbot-height: 500px;
    }
}

/* ── Large screens (≥ 1920px) ────────────────────────────────────────────── */
@media (min-width: 1920px) {
    #neurorag-bot-widget {
        --chatbot-height: 660px;
    }
}

@media (min-width: 2560px) {
    #neurorag-bot-widget {
        --chatbot-height: 750px;
    }
}
