/* Agent panel: draggable, collapsible, resizable */
.agent-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 520px;
    height: 560px;
    min-width: 280px;
    max-width: 90vw;
    min-height: 320px;
    max-height: 85vh;
    background: rgba(22, 29, 46, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 25;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.agent-panel-resize {
    position: absolute;
    z-index: 1;
    background: transparent;
}
.agent-panel-resize-n { top: 0; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
.agent-panel-resize-s { bottom: 0; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
.agent-panel-resize-e { top: 12px; right: 0; width: 8px; bottom: 12px; cursor: e-resize; }
.agent-panel-resize-w { top: 12px; left: 0; width: 8px; bottom: 12px; cursor: w-resize; }
.agent-panel-resize-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: ne-resize; }
.agent-panel-resize-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nw-resize; }
.agent-panel-resize-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; }
.agent-panel-resize-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: sw-resize; }
.agent-panel.collapsed .agent-panel-resize { display: none; }
.agent-panel.collapsed {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    border-radius: 10px;
    padding: 0;
}
.agent-panel.collapsed .agent-panel-body { display: none; }
.agent-panel.collapsed .agent-panel-header {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.agent-panel.collapsed .agent-panel-header:hover { background: rgba(51, 65, 85, 0.3); }
.agent-panel.collapsed .agent-panel-title { display: none; }
.agent-panel.collapsed .agent-panel-actions { width: 100%; height: 100%; }
.agent-panel.collapsed .agent-panel-clear { display: none; }
.agent-panel.collapsed .agent-panel-toggle {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    font-size: 24px;
    font-weight: 300;
    color: var(--text-muted);
}
.agent-panel.collapsed .agent-panel-toggle:hover { color: var(--text); }
.agent-panel-header {
    padding: 12px 14px;
    background: rgba(22, 29, 46, 0.6);
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}
.agent-panel-title { font-size: 14px; font-weight: 600; color: var(--text); }
.agent-panel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.agent-panel-toggle,
.agent-panel-clear {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    border-radius: 5px;
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(51, 65, 85, 0.6);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.agent-panel-clear {
    width: auto;
    min-width: 44px;
    padding: 0 8px;
    font-size: 11px;
}
.agent-panel-toggle:hover,
.agent-panel-clear:hover {
    background: rgba(51, 65, 85, 0.6);
    border-color: var(--border);
    color: var(--text);
}
.agent-panel-body {
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(22, 29, 46, 0.5);
    color: var(--text);
    font-size: 13px;
}
#agentMessages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
}
.agent-msg {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    line-height: 1.5;
}
.agent-msg-bot {
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(51, 65, 85, 0.5);
    color: var(--text);
}
.agent-msg-bot strong { color: #f1f5f9; font-weight: 700; }
.agent-msg-bot a { color: #7dd3fc; text-decoration: underline; text-underline-offset: 2px; }
.agent-msg-bot a:hover { color: #bae6fd; }
.agent-msg-bot h1, .agent-msg-bot h2, .agent-msg-bot h3 { margin: 12px 0 8px; font-size: 1em; font-weight: 600; }
.agent-msg-bot p { margin: 0 0 8px; }
.agent-msg-bot p:last-child { margin-bottom: 0; }
.agent-msg-bot ul, .agent-msg-bot ol { margin: 8px 0; padding-left: 20px; }
.agent-msg-bot code { background: rgba(51, 65, 85, 0.5); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.agent-msg-bot pre { background: rgba(51, 65, 85, 0.5); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; font-size: 12px; }
.agent-msg-bot pre code { background: none; padding: 0; }
.agent-msg-user {
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.25);
    margin-left: 24px;
}
.agent-msg-loading {
    color: var(--text-muted);
    font-style: italic;
}
.agent-input-wrap {
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    background: rgba(22, 29, 46, 0.6);
    display: flex;
    gap: 8px;
    align-items: center;
}
.agent-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.8);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}
.agent-input::placeholder { color: var(--text-hint); }
.agent-input:focus {
    outline: none;
    border-color: var(--accent);
}
.agent-send {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: var(--bg);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.agent-send:hover { opacity: 0.9; }
.agent-send:disabled { opacity: 0.5; cursor: not-allowed; }
