/* ============================================================================
 * AgentChat Component Styles
 * Extracted from AgentChat.cshtml — shared by inline and popup modes
 * ============================================================================ */

/*
 * Inline-mode :has() selectors are in _LayoutShell.cshtml <style> block
 * because the bundler doesn't support :has() yet.
 */

/* --- Core component styles --- */

.agent-chat-header
{
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    padding: 0.75rem 1.5rem 0.25rem 1.5rem;
    gap: 1rem;
}

.agent-chat-conversation
{
    padding: 0.5rem 1.5rem 0 1.5rem;
    display: none;
}

.agent-chat-ask-box
{
    position: sticky;
    bottom: 0;
    width: 100%;
    z-index: 1020;
    background: linear-gradient(to top, #fff 90%, #f5f7fa 100%);
    padding: 12px;
    box-shadow: 0 -2px 16px 0 rgba(0,0,0,0.07);
    border-radius: 12px 12px 0 0;
    margin-top: 1.5em;
}

.agent-chat-container:not(.agent-chat-active) .agent-chat-ask-box
{
    border-radius: 12px;
    box-shadow: none;
}

.agent-chat-ask-box-actions
{
    display: flex;
    align-items: center;
}

.agent-chat-ask-box-actions .btn-default
{
    width: 34px;
    height: 34px;
    text-align: center;
    padding: 6px;
    line-height: 22px;
}

.agent-chat-ask-box-actions .agent-chat-send-btn
{
    width: 38px;
    height: 38px;
    text-align: center;
    padding: 6px;
}

.agent-chat-ask-box textarea
{
    resize: none;
    min-height: 34px;
    font-size: 14px;
    padding-top:7px;
}

.agent-chat-send-btn
{
    height: 100%;
}

@media (min-width: 768px)
{
    .agent-chat-send-btn
    {
        font-size: 1.25rem;
    }
}

.agent-chat-spacer
{
    flex: 1;
    min-height: 0;
}

.loader
{
    width: 30px;
    aspect-ratio: 4;
    background: radial-gradient(circle closest-side, #000 90%, transparent) 0/calc(100%/3) 100% space;
    clip-path: inset(0 100% 0 0);
    animation: l1 1s steps(4) infinite;
}

@keyframes l1
{
    to
    {
        clip-path: inset(0 -34% 0 0)
    }
}

.agent-chat-active .agent-chat-conversation
{
    display: block;
}

.agent-chat-ask-box
{
    border: none;
    background: #EEF5F5;
}

.agent-chat-ask-box textarea
{
    border: none;
    box-shadow: none;
    margin-bottom: 12px;
    border-radius: 16px;
}

.agent-chat-ask-box textarea.autogrow
{
    width: 100%;
    box-sizing: border-box;
    resize: none;
    overflow-y: hidden;
    transition: height 0.08s ease-out;
}

.agent-chat-ask-box textarea.form-control.autogrow.agent-chat-textarea-reset
{
    height: 34px !important;
    max-height: 34px !important;
    min-height: 34px !important;
    overflow-y: hidden !important;
    transition: none;
}

.agent-chat-active .agent-chat-ask-box
{
    margin-top: 0;
}

.agent-chat-active .agent-chat-buttons-noconvo
{
    display: none
}

.agent-conversation-info
{
    background: #fff;
    padding-top: 18px;
    margin-top: -18px;
    margin-bottom: 15px;
}

.agent-conversation-info .agent-conversation-bar
{
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom-right-radius: 6px;
    border-bottom-left-radius: 6px;
}

/* BS3 override: use default font-size instead of 0.875rem */
.agent-chat-bs3 .agent-conversation-info .agent-conversation-bar
{
    font-size: 100%;
}

.agent-question-block
{
    margin: 0 0 20px 0;
}

.agent-question-block .agent-question-question
{
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: 1rem;
    background-color: #e9ecef;
    margin-right: 8px;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

.agent-question-block .agent-question-question:before
{
    content: "";
    position: absolute;
    right: -16px;
    top: 10px;
    width: 0;
    height: 0;
    display: inline-block;
    border: 8px solid transparent;
    border-left-color: #e9ecef;
}

@media (min-width: 768px)
{
    .agent-question-block .agent-question-question
    {
        width: 75%;
        margin-left: auto;
    }
}

/* BS5 card-body styling for question blocks — scoped to BS5 pages only */
.agent-chat-container:not(.agent-chat-bs3) .agent-question-block .card-body
{
    border-radius: 4px;
    background: #e3f2fd;
    color: #1976d2;
}

.tool-nugget
{
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    background-color: #fafafa !important;
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem 0.5rem 0.25rem 0;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 18px;
    word-wrap: break-word;
    word-break: break-word;
}

.tool-throbber
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.2em;
    width: 1.2em;
    margin-left: 0.5rem;
    vertical-align: middle;
    border: 2px solid #2196f3;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    box-sizing: border-box;
}

@keyframes spin
{
    to
    {
        transform: rotate(360deg);
    }
}

.tool-final-icon
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.2em;
    width: 1.2em;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.tool-nugget .tool-params
{
    font-size: 0.8rem;
    opacity: 0.8;
    margin-left: 0.5rem;
}

.tool-nugget i
{
    margin-right: 0.25rem;
}

.tool-nugget-info
{
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    background-color: #fafafa !important;
    border-radius: 12px;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem 0.5rem 0.25rem 0;
    font-size: 0.875rem;
    line-height: 18px;
}

.tool-nugget-info i
{
    margin-right: 0.25rem;
}

.tool-nugget-info .tool-params
{
    font-size: 0.8rem;
    opacity: 0.8;
    margin-left: 0.5rem;
}

.tool-nugget-spaced
{
    margin-bottom: 0.5rem;
    display: inline-block;
}

.tool-nugget-line
{
    margin-bottom: 0.5rem;
}

.tool-nugget:hover
{
    background: #bbdefb;
}

.tool-modal .modal-body
{
    max-height: 60vh;
    overflow-y: auto;
}

.tool-detail-section
{
    margin-bottom: 1rem;
}

.tool-detail-section h6
{
    color: #1976d2;
    margin-bottom: 0.5rem;
}

.tool-detail-content
{
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.citation-badge
{
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    color: #333;
    border-radius: 999px;
    min-height: 2.4em;
    padding: 0.2em 1em;
    font-size: 0.8em;
    margin-right: 0.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
    gap: 0.5em;
}

.citation-badge-icon
{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    border-radius: 50%;
    background: #444c56;
    color: #fff;
    margin-right: 0.2em;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.citation-badge-icon i
{
    font-size: 0.7em;
    line-height: 1;
}

.citation-badge a
{
    color: #4b9cd3;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.citation-badge a:hover
{
    text-decoration: underline;
    color: #2176bd;
}

.agent-answer-actions
{
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.agent-answer-actions button,
.agent-answer-actions a
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.15s;
    border: solid 1px #aaa;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    background-color: #fff;
    text-decoration: none;
    font-size: 14px;
}

.agent-answer-actions button:hover,
.agent-answer-actions a:hover
{
    background: #f0f0f0;
    color: #333;
}

.agent-answer-actions button i,
.agent-answer-actions a i
{
    font-size: 0.8em;
}
