/* ============================================================================
   Guru chat export — the per-answer download button (js/features/chat-export.js),
   its Word / PDF format menu, and the toolbar's Export icon.
   Theme-aware throughout: every colour is a theme variable or a color-mix of one.
   ============================================================================ */

.chat-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* An answer with no stored message id (still streaming, or never saved) has nothing
   to export yet. The id lands on the node with the stream's "done" frame. */
.message:not([data-message-id]) .chat-export-btn {
    display: none;
}

.chat-export-btn:hover,
.chat-export-btn[aria-expanded="true"] {
    background: color-mix(in srgb, var(--text-color) 10%, transparent);
    color: var(--text-color);
}

.chat-export-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.chat-export-btn.is-busy,
#export-action-btn.is-busy {
    opacity: 0.55;
    cursor: progress;
}

.chat-export-btn.is-error,
#export-action-btn.is-error {
    color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 14%, transparent);
}

/* Toolbar icon: the toolbar's other buttons use an icon span + text span. */
#export-action-btn .toolbar-btn-icon svg {
    display: block;
}

/* ---- Format menu ---------------------------------------------------------- */

.chat-export-menu {
    position: fixed;
    z-index: 10050;
    min-width: 220px;
    max-width: calc(100vw - 16px);
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--text-color) 18%, transparent);
}

.chat-export-menu-title {
    padding: 4px 8px 6px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-secondary);
}

.chat-export-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-color);
    font: inherit;
    font-size: 0.9em;
    text-align: left;
    cursor: pointer;
}

.chat-export-menu-item svg {
    flex: 0 0 auto;
    color: var(--text-secondary);
}

.chat-export-menu-item:hover,
.chat-export-menu-item:focus-visible {
    background: var(--bg-hover, color-mix(in srgb, var(--text-color) 8%, transparent));
    outline: none;
}

.chat-export-menu-item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent-color);
}
