/* Global Chat launcher — header button + agent modal overlay. */

/* Header button (sits in the persistent app header alongside ⌘K / bell). */
.header-chat-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border: 1px solid var(--apple-blue); border-radius: 8px;
    background: var(--apple-blue); color: #fff; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; white-space: nowrap;
}
.header-chat-btn:hover { filter: brightness(1.06); }
.header-chat-btn svg { display: block; }

/* Modal overlay */
.agent-modal-overlay {
    position: fixed; inset: 0; z-index: 10001;
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .5); backdrop-filter: blur(4px); padding: 24px;
}
body.agent-modal-open { overflow: hidden; }

.agent-modal {
    display: flex; flex-direction: column;
    width: min(720px, 100%); height: min(80vh, 760px); max-height: 100%;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .4); overflow: hidden;
}
.agent-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.agent-modal-title { font-weight: 700; font-size: 15px; color: var(--text); }
.agent-modal-close {
    width: 32px; height: 32px; border: none; background: transparent; color: var(--text-secondary);
    font-size: 22px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.agent-modal-close:hover { background: var(--bg-input); color: var(--text); }
.agent-modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.agent-modal-loading { padding: 32px; text-align: center; color: var(--text-secondary); }
.agent-modal-loading[data-error="1"] { color: var(--danger, #ff453a); }

/* The agent plugin fills the modal body; its own header is redundant here. */
#agentModal .ag-header { display: none; }
#agentModal .ag-main { padding: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#agentModal .ag-chat-card { height: 100%; min-height: 0; border: none; border-radius: 0; box-shadow: none; }

/* Mobile / narrow split-screen: full-screen sheet. */
@media (max-width: 640px) {
    .agent-modal-overlay { padding: 0; }
    .agent-modal { width: 100%; height: 100%; max-height: 100%; border: none; border-radius: 0; }
    .header-chat-btn span { display: none; } /* icon-only when space is tight */
    .header-chat-btn { padding: 6px 8px; }
}
