.llm-panel-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color, #35418F);
    color: #fff;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    font-size: 22px;
    z-index: 1035;
    cursor: pointer;
}

    .llm-panel-toggle:hover {
        filter: brightness(1.1);
    }

    .llm-panel-toggle img {
        width: 28px;
        height: 28px;
    }

.llm-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 35vw;
    max-width: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1035;
    transform: translateX(100%);
    transition: transform .25s ease-in-out;
    display: flex;
    flex-direction: column;
}

    .llm-panel.open {
        transform: translateX(0);
    }

.llm-panel-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
    z-index: 1036;
}

    .llm-panel-resize-handle:hover {
        background: rgba(0, 0, 0, .08);
    }

body.llm-resizing {
    cursor: ew-resize;
    user-select: none;
}

.llm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #efefef;
}

.llm-panel-title {
    font: var(--baloo-bold, 600 16px/24px 'Baloo 2', cursive);
    color: #333;
}

.llm-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.llm-panel-close, .llm-panel-clear {
    cursor: pointer;
    color: #9a9a9a;
    font-size: 18px;
}

    .llm-panel-close:hover, .llm-panel-clear:hover {
        color: #555;
    }

.llm-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px;
}

.llm-topic-picker {
    display: flex;
    justify-content: flex-end;
    margin-top: -8px;
    margin-bottom: 12px;
}

.llm-topic-dropdown-toggle {
    width: 80%;
    max-width: 40vw;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
    background: transparent;
    border: none;
    color: #333;
    padding: 0;
    position: relative;
    top: 2px;
    font-size: 13px;
    cursor: pointer;
}

    .llm-panel-narrow .llm-topic-dropdown-toggle {
        width: 100%;
        max-width: 100%;
    }

    .llm-topic-dropdown-toggle::after {
        content: none !important;
    }

.llm-topic-dropdown-content {
    position: relative;
    display: flex;
    width: 50%;
    align-items: center;
    justify-content: center;
    padding: 8px 34px;
    border: 1px solid #eee;
    border-radius: 6px;
}

    .llm-panel-narrow .llm-topic-dropdown-content {
        width: 100%;
    }

#llmTopicDropdownLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

    .llm-topic-dropdown-toggle:hover .llm-topic-dropdown-content {
        background: rgba(53, 65, 143, 0.08);
    }

    .llm-topic-dropdown-toggle .fa-chevron-down {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 11px;
        transition: transform .15s ease;
    }

    .llm-topic-dropdown-toggle[aria-expanded="true"] .fa-chevron-down {
        transform: translateY(-50%) rotate(180deg);
    }

.llm-topic-dropdown-menu {
    width: 80%;
    max-width: 40vw;
    max-height: 220px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    padding: 6px 0;
}

/* call-header.css pone un fondo semitransparente (#ffffff70) global para ".dropdown-menu.show"
   pensado para otro menú. Mantenemos su grid de 2 columnas (nos viene bien), pero forzamos
   fondo/borde sólidos por id para que no se transparente el chat de debajo. */
#llmTopicDropdownMenu.show {
    background: #fff;
    border: 1px solid #eee;
    width: 80%;
    max-width: 40vw;
}

.llm-panel-narrow .llm-topic-dropdown-menu,
.llm-panel-narrow #llmTopicDropdownMenu.show {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
}

    .llm-topic-dropdown-menu .llm-topic-item {
        display: block;
        padding: 8px 14px;
        font-size: 13px;
        color: #333;
        cursor: pointer;
        border: 1px solid #eee;
        border-radius: 6px;
        text-align: center;
    }

        .llm-topic-dropdown-menu .llm-topic-item:hover {
            background: rgba(53, 65, 143, 0.08);
        }

        .llm-topic-dropdown-menu .llm-topic-item.selected {
            color: var(--primary-color, #35418F);
            font-weight: 600;
        }

.llm-chat-empty {
    color: #9a9a9a;
    font-size: 13px;
    margin-top: 16px;
}

.llm-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.llm-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 12px;
    scrollbar-width: thin;
}

    .llm-messages::-webkit-scrollbar {
        width: 6px;
    }

    .llm-messages::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }

        .llm-messages::-webkit-scrollbar-thumb:hover {
            background: #aaa;
        }

.llm-message-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: llmFadeIn .3s ease;
}

    .llm-message-row.user {
        justify-content: flex-end;
    }

@keyframes llmFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.llm-message-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    background: var(--primary-color, #35418F);
    overflow: hidden;
}

    .llm-message-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.llm-message-row.assistant .llm-message-icon img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.llm-message-row.user .llm-message-icon {
    background: #fff;
    border: 1px solid var(--primary-color, #35418F);
}

.llm-message-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.llm-message-row.user .llm-message-bubble {
    background: #fff;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    border-top-right-radius: 0;
    white-space: pre-wrap;
}

.llm-message-row.assistant .llm-message-bubble {
    background: #eef0f7;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    border-top-left-radius: 0;
}

    .llm-message-bubble p {
        margin: 0 0 8px;
    }

        .llm-message-bubble p:last-child {
            margin-bottom: 0;
        }

    .llm-message-bubble ul,
    .llm-message-bubble ol {
        margin: 0 0 8px;
        padding-left: 20px;
    }

    .llm-message-bubble ul {
        list-style: disc;
    }

    .llm-message-bubble ol {
        list-style: decimal;
    }

    .llm-message-bubble li {
        margin-bottom: 4px;
        list-style: inherit;
    }

.llm-typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    border-radius: 50%;
    background: var(--primary-color, #35418F);
    animation: llmTypingPulse 1.2s infinite ease-in-out;
}

    .llm-typing-indicator span:nth-child(2) {
        animation-delay: .2s;
    }

    .llm-typing-indicator span:nth-child(3) {
        animation-delay: .4s;
    }

@keyframes llmTypingPulse {
    0%, 60%, 100% {
        opacity: .3;
    }

    30% {
        opacity: 1;
    }
}

.llm-metrics-row {
    float: right;
    margin-left: 12px;
    margin-bottom: 6px;
}

.llm-score-circle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.llm-score-bg {
    stroke: #e5e7eb;
}

.llm-score-label {
    font-size: 10px;
    color: #888;
}

.llm-score-high .llm-score-fill {
    stroke: #22c55e;
}

.llm-score-high .llm-score-text {
    fill: #22c55e;
}

.llm-score-medium .llm-score-fill {
    stroke: #f59e0b;
}

.llm-score-medium .llm-score-text {
    fill: #f59e0b;
}

.llm-score-low .llm-score-fill {
    stroke: #ef4444;
}

.llm-score-low .llm-score-text {
    fill: #ef4444;
}

.llm-sources {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0,0,0,.08);
    font-size: 11px;
}

    .llm-sources a {
        display: flex;
        align-items: center;
        gap: 4px;
        color: var(--primary-color, #35418F);
        text-decoration: none;
    }

.llm-source-icon {
    width: 12px;
    height: 12px;
}

        .llm-sources a:hover {
            text-decoration: underline;
        }

.llm-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.llm-image-wrapper {
    text-align: center;
}

.llm-image-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.08);
    cursor: pointer;
}

.llm-image-caption {
    margin: 2px 0 0;
    font-size: 10px;
    color: #888;
}

#genericModal_info_body .llm-image-caption {
    text-align: center;
}

.llm-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.llm-chat-input {
    flex: 1;
    display: block;
    min-height: 20px;
    max-height: 100px;
    overflow-y: auto;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}

    .llm-chat-input:empty:before {
        content: attr(data-placeholder);
        color: #aaa;
    }

.llm-send-btn {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    transition: transform .15s ease;
}

    .llm-send-btn img {
        width: 26px;
        height: 26px;
        display: block;
    }

    .llm-send-btn:hover {
        transform: scale(1.1);
    }

@media (max-width: 768px) {
    .llm-panel {
        width: 100%;
    }
}
