/* SO_AI_SUPPORT v1 — Help & Issue Assistant drawer styles (sixorbit_web).
 *
 * grep marker: SO_AI_SUPPORT v1
 *
 * Scoped to #soSupportDrawer / .so-support-*; everything else is the framework
 * drawer. Colours come from SO design tokens, so light and dark both work.
 *
 * The drawer has two shapes: the narrow panel (one column, with the chat list
 * overlaying it) and full screen (a row — the chat list a permanent column
 * beside the conversation). The framework flips .so-drawer-expanded; the
 * layout for both lives under "layout" below. */

#soSupportDrawer .so-support-mark { color: var(--so-accent-primary, #2563eb); font-size: 22px; }

/* ---- body: centred welcome, or a scrolling conversation ----------------- */
#soSupportDrawer .so-support-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
/* Idle: centre the welcome + composer group vertically, like the AI assistant. */
#soSupportDrawer:not(.so-support-chatting) .so-support-body { justify-content: center; }
.so-support-welcome {
    width: 100%;
    padding: 24px 8px;
}
/* Text/chips stay a readable centred column; the composer below is full width. */
.so-support-welcome-top {
    max-width: 460px;
    margin: 0 auto;
    text-align: center;
}
.so-support-welcome-composer { margin-top: 22px; }
.so-support-welcome-mark {
    font-size: 44px;
    color: var(--so-accent-primary, #2563eb);
    background: var(--so-primary-bg-subtle, #eff6ff);
    border-radius: 50%;
    padding: 12px;
    line-height: 1;
}
.so-support-welcome-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--so-text-heading, #111827);
    margin-top: 14px;
}
.so-support-welcome-sub {
    font-size: 13.5px;
    color: var(--so-text-muted, #6b7280);
    margin-top: 6px;
    line-height: 2;
}
/* Keyword chips inside the welcome sentence — soft, theme-aware; the three
   report types are colour-coded so the line doubles as a small legend. */
.so-support-kw {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--so-primary-bg-subtle, #eff6ff);
    color: var(--so-primary-text-emphasis, #1d4ed8);
}
.so-support-kw-brand  { background: var(--so-primary-bg-subtle, #eff6ff); color: var(--so-accent-primary, #2563eb); }
.so-support-kw-bug    { background: var(--so-danger-bg-subtle, #fef2f2);  color: var(--so-danger-text-emphasis, #b91c1c); }
.so-support-kw-change { background: #fff7ed; color: #b45309; }
.so-support-kw-feature{ background: #ecfdf5; color: #047857; }
:root[data-theme="dark"] .so-support-kw-change { background: rgba(180, 83, 9, .18); color: #fbbf24; }
:root[data-theme="dark"] .so-support-kw-feature { background: rgba(4, 120, 87, .20); color: #34d399; }
.so-support-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}
.so-support-chip {
    appearance: none;
    border: 1px solid var(--so-border-color, #e5e7eb);
    background: var(--so-card-bg, #fff);
    color: var(--so-text-primary, #111827);
    font-size: 12.5px;
    padding: 7px 13px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.so-support-chip:hover {
    border-color: var(--so-accent-primary, #2563eb);
    background: var(--so-primary-bg-subtle, #eff6ff);
    color: var(--so-primary-text-emphasis, #1d4ed8);
}

/* ---- conversation ------------------------------------------------------- */
.so-support-msgs { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.so-support-row { display: flex; }
.so-support-row-user { justify-content: flex-end; }
.so-support-row-ai { justify-content: flex-start; }
.so-support-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
}
.so-support-row-user .so-support-bubble {
    background: var(--so-accent-primary, #2563eb);   /* solid blue, so white text is readable */
    color: #fff;
    border-bottom-right-radius: 4px;
}
.so-support-row-ai .so-support-bubble {
    background: var(--so-bg-secondary, #f3f4f6);
    color: var(--so-text-primary, #111827);
    border-bottom-left-radius: 4px;
}
.so-support-bubble .so-support-ul { margin: 4px 0 0; padding-left: 18px; }
.so-support-bubble .so-support-ul li { margin: 2px 0; }
/* A markdown heading in a short answer is emphasis, not an outline: it is
   drawn as a bold line with a little air above it, never as a page title. */
.so-support-bubble .so-support-head { font-weight: 600; margin-top: 8px; }
.so-support-bubble .so-support-head:first-child { margin-top: 0; }
/* Inline code: a setting name or a column, kept legible inside the sentence. */
.so-support-bubble code {
    font-size: 0.92em;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--so-bg-subtle, rgba(0, 0, 0, 0.05));
}
.so-support-needinfo { border-left: 3px solid var(--so-accent-primary, #2563eb); padding-left: 8px; }
.so-support-err { color: var(--so-danger-text-emphasis, var(--so-danger, #b91c1c)); }

/* message attachments — clickable image thumbs + file links (AI-Planning style) */
.so-support-msg-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.so-support-att.is-img {
    padding: 0; border: 0; background: none; cursor: pointer;
    border-radius: 8px; overflow: hidden; line-height: 0;
}
.so-support-att.is-img img {
    width: 110px; height: 110px; object-fit: cover; display: block;
    border-radius: 8px; transition: transform .12s;
}
.so-support-att.is-img:hover img { transform: scale(1.03); }
/* non-image file link — sits on the user's (blue) bubble, so light-on-translucent */
.so-support-att.is-doc {
    display: inline-flex; align-items: center; gap: 6px;
    max-width: 220px; font-size: 12.5px; text-decoration: none;
    color: #fff; background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 8px; padding: 6px 10px;
}
.so-support-att.is-doc:hover { background: rgba(255,255,255,.3); }
.so-support-att.is-doc .material-symbols-rounded { font-size: 17px; }
.so-support-att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* image attachment in the read-only history (AI bubble, not the blue user one) */
.so-support-row-ai .so-support-att.is-doc {
    color: var(--so-text-primary, #111827);
    background: var(--so-bg-secondary, #f3f4f6);
    border-color: var(--so-border-color, #e5e7eb);
}

/* ---- shimmer status ----------------------------------------------------- */
.so-support-shimmer { display: inline-flex; align-items: center; gap: 8px; }
.so-support-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--so-accent-primary, #2563eb); animation: so-support-pulse 1s ease-in-out infinite; }
.so-support-shimmer-text {
    font-size: 13px;
    background: linear-gradient(90deg, var(--so-text-muted, #9ca3af) 25%, var(--so-text-primary, #111827) 50%, var(--so-text-muted, #9ca3af) 75%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: so-support-sweep 1.6s linear infinite;
}
@keyframes so-support-pulse { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@keyframes so-support-sweep { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---- report card -------------------------------------------------------- */
.so-support-report-card {
    width: 100%;
    border: 1px solid var(--so-primary-border-subtle, #bfdbfe);
    background: var(--so-primary-bg-subtle, #eff6ff);
    border-radius: 14px;
    padding: 12px 14px;
}
.so-support-rc-head {
    display: flex; align-items: center; gap: 6px;
    font-weight: 700; font-size: 13.5px;
    color: var(--so-primary-text-emphasis, #1d4ed8);
}
.so-support-rc-head .material-symbols-rounded { font-size: 19px; }
.so-support-rc-subject { font-weight: 600; font-size: 13.5px; margin-top: 8px; color: var(--so-text-heading, #111827); }
.so-support-rc-desc { font-size: 13px; color: var(--so-text-primary, #374151); margin-top: 4px; line-height: 1.5; }
.so-support-rc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.so-support-rc-result { font-size: 13px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.so-support-rc-result.so-support-ok { color: var(--so-primary-text-emphasis, #1d4ed8); }
.so-support-rc-result.so-support-err { color: var(--so-danger-text-emphasis, #b91c1c); }
.so-support-rc-result .material-symbols-rounded { font-size: 18px; }

.so-support-rc-files { font-size: 12px; color: var(--so-text-muted, #6b7280); margin-top: 8px; }

/* A reopened conversation redraws the SAME card -- same tint, same heading,
   same outcome line -- so one report does not look like two different things
   depending on where it is seen. Only the buttons are dropped. */
.so-support-rc-result.so-support-rc-muted { color: var(--so-text-muted, #6b7280); }

/* ---- composer -----------------------------------------------------------
 * The composer is the framework SOComposer, full-width in the footer (same as
 * the AI assistant). The welcome content centres in the body above it. */
.so-support-footer { display: block; }
#soSupportComposer { width: 100%; }

/* ---- layout: the chat list beside the conversation ----------------------
 * Narrow drawer: a column — header, conversation, composer — with the chat
 * list overlaying it when opened, because there is no room for two.
 *
 * Full screen: a ROW. The list becomes a full-height column and the title bar
 * belongs to the conversation beside it, rather than a strip across the top
 * with everything hanging below. Same shape as the SixOrbit AI panel.
 * ---------------------------------------------------------------------- */
#soSupportDrawer .so-support-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;    /* without this, wide content forces the column open */
    min-height: 0;   /* lets the body scroll instead of stretching */
}
#soSupportDrawer .so-support-sidebar {
    display: none;
    overflow-y: auto;
    padding: 0.75rem;
}
/* Narrow: overlay the conversation, header included — so the list's own
   Back button is the way out. */
#soSupportDrawer.so-support-history-open .so-support-sidebar {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 5;
    background: var(--so-card-bg, #fff);
    border-radius: inherit;   /* follows the floating drawer it covers */
}
/* Full screen: a real column, top to bottom, beside everything else. */
#soSupportDrawer.so-drawer-expanded {
    flex-direction: row;
}
#soSupportDrawer.so-drawer-expanded .so-support-sidebar {
    display: block;
    position: static;
    inset: auto;
    z-index: auto;
    flex: 0 0 300px;
    max-width: 300px;
    border-right: 1px solid var(--so-border-color, #e5e7eb);
    background: var(--so-bg-secondary, transparent);
    border-top-left-radius: 12px;      /* the floating drawer is rounded and the */
    border-bottom-left-radius: 12px;   /* sidebar paints its own ground over it  */
}
/* The conversation reads better at a measure than stretched across a 27-inch
   monitor, so it is capped and centred rather than filling the width. */
#soSupportDrawer.so-drawer-expanded .so-support-body,
#soSupportDrawer.so-drawer-expanded .so-support-footer {
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* The list's action row stays put while the list scrolls under it. The
   negative margins bleed it to the sidebar's edges so nothing scrolls past
   beside it, and `inherit` takes whichever background the sidebar has in this
   mode — a card in the narrow panel, a secondary surface in full screen. */
#soSupportDrawer .so-support-sidebar-actions {
    position: sticky;
    top: -0.75rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -0.75rem -0.75rem 0.75rem;
    padding: 0.75rem;
    background: inherit;
}
/* In full screen the conversation sits beside the list, so Back has nowhere to
   go back to, and New conversation takes the row's width. flex-grow is set
   here rather than with so-flex-grow-1, which is !important and could not be
   switched off for the narrow drawer. */
#soSupportDrawer.so-drawer-expanded #soSupportSidebarBack {
    display: none;
}
#soSupportDrawer.so-drawer-expanded #soSupportSidebarNew {
    flex-grow: 1;
}
#soSupportDrawer:not(.so-drawer-expanded) #soSupportSidebarNew {
    margin-left: auto;
}
.so-support-sidebar-label {
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

/* ---- the chat list ------------------------------------------------------
 * The framework's own so-list-group at its compact scale, drawn exactly as
 * the SixOrbit AI panel draws its chats: one line per conversation, so the
 * sidebar shows as many as fit. Only the row's own geometry and the
 * open-chat marker are set here; everything else is the list-group. */
#soSupportDrawer .so-support-chat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
/* A shade tighter again than so-list-group-sm: these rows are one line of
   text. The extra left padding is for the open-chat bar — every row carries
   it, so a title does not shift sideways when its chat is opened. */
#soSupportDrawer .so-support-chat-row.so-list-group-item {
    padding: 6px 10px 6px 17px;
}
/* The conversation currently on screen. A short rounded bar rather than a
   full-height edge: it marks the row it belongs to, instead of reading as a
   border drawn down the whole list. */
.so-support-chat-current {
    position: relative;
    background: color-mix(in srgb, var(--so-accent-primary, #2563eb) 10%, transparent);
}
.so-support-chat-current::before {
    content: "";
    position: absolute;
    /* Set in from the edge, not on it: flush against the row's border the bar
       reads as a stray line rather than a marker. */
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    min-height: 14px;
    border-radius: 999px;
    background: var(--so-accent-primary, #2563eb);
}
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
    .so-support-chat-current { background: var(--so-primary-bg-subtle, #eff6ff); }
}
/* A button, not a link: it opens a conversation in place rather than
   navigating. `font: inherit` first, to pick up the family and weight from
   the button reset, then the size on its own — a title inheriting the body's
   12px sat a notch smaller than everything around it. Declared after,
   because the `font` shorthand would otherwise reset size back. */
.so-support-chat-open {
    display: block;
    width: 100%;
    background: none;
    border: 0;
    padding: 0.15rem 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    font-size: 13px;
}
.so-support-chat-open:hover {
    color: var(--so-primary-text-emphasis, #1d4ed8);
}
.so-support-history-empty {
    text-align: center;
    color: var(--so-text-muted, #6b7280);
    font-size: 13px;
    padding: 28px 12px;
}
/* A "bare" row shows its content as its own card — no wrapping chat bubble
   (used by the AI Assistant redirect note so it isn't double-boxed). */
.so-support-row.so-support-bare .so-support-bubble {
    background: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 100%;
}

/* ---- "use the AI Assistant" note (live-data question support can't answer) -- */
.so-support-assist-note {
    border: 1px solid var(--so-primary-border-subtle, #bfdbfe);
    background: var(--so-primary-bg-subtle, #eff6ff);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--so-text-primary, #111827);
}
.so-support-assist-h {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--so-primary-text-emphasis, #1d4ed8);
    margin-bottom: 4px;
}
.so-support-assist-h .material-symbols-rounded { font-size: 18px; }

/* the read-only banner at the top of a reopened conversation */
.so-support-history-banner {
    align-self: center;
    font-size: 11.5px;
    color: var(--so-text-muted, #6b7280);
    background: var(--so-bg-secondary, #f3f4f6);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 4px;
}

/* ---- small screens -----------------------------------------------------
 * Full screen is a desktop shape: it stands the chat list beside the
 * conversation, which needs width a phone has not got. The toggle goes, and
 * the expanded layout is neutralised in case the state arrives anyway (the
 * shared Alt+Enter handler, or a window resized after expanding).
 * ---------------------------------------------------------------------- */
@media (max-width: 767px) {
    #soSupportDrawer [data-so-drawer-fullscreen-toggle-btn] {
        display: none !important;
    }
    #soSupportDrawer.so-drawer-expanded {
        flex-direction: column;
    }
    #soSupportDrawer.so-drawer-expanded .so-support-sidebar {
        display: none;
        position: absolute;
        inset: 0;
        z-index: 5;
        flex: none;
        max-width: none;
        border-right: 0;
        background: var(--so-card-bg, #fff);
    }
    #soSupportDrawer.so-drawer-expanded.so-support-history-open .so-support-sidebar {
        display: block;
    }
    #soSupportDrawer.so-drawer-expanded #soSupportSidebarBack {
        display: inline-flex;
    }
    #soSupportDrawer.so-drawer-expanded #soSupportSidebarNew {
        flex-grow: 0;
        margin-left: auto;
    }
    #soSupportDrawer.so-drawer-expanded .so-support-main {
        flex: 1 1 auto;
        max-width: none;
    }
    #soSupportDrawer.so-drawer-expanded .so-support-body,
    #soSupportDrawer.so-drawer-expanded .so-support-footer {
        max-width: none;
    }
}

/* ---- FLAG v1: this whole conversation was wrong -------------------------
   There is no per-message rating in the Help Assistant: one person reads
   these answers and nobody else, so the flag is the only signal we ever get
   that one of them missed. It sits in two places - the header control for the
   open conversation, and a mark on each row in the list. */
.so-support-flag-mark {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: none;
    /* The warning palette's TEXT shade, not the raw amber: that one is
       unreadable on the light theme. */
    color: var(--so-warning-text, #b45309);
    cursor: pointer;
}
.so-support-flag-mark .material-symbols-rounded {
    font-size: 1rem;
}
/* An unflagged row keeps its mark, but out of the way: the row is a
   conversation first and a thing to be reviewed second, so the control earns
   its place only on hover or focus. A flagged one is always visible. */
.so-support-flag-off {
    opacity: 0;
    color: var(--so-text-muted);
    transition: opacity 0.12s ease;
}
.so-support-chat-row:hover .so-support-flag-off,
.so-support-flag-off:focus-visible {
    opacity: 1;
}
/* Touch has no hover to reveal it with. */
@media (hover: none) {
    .so-support-flag-off { opacity: 1; }
}
.so-support-flag-mark:hover,
.so-support-flag-mark:focus-visible {
    opacity: 1;
    color: var(--so-warning-text, #b45309);
}
/* The header control, once the conversation is flagged. .so-btn is repeated
   so this beats the ghost button's own colour rule, which has equal
   specificity and comes later in the cascade. */
#soSupportFlag.so-btn.so-support-flagged {
    color: var(--so-warning-text, #b45309);
}

/* ---- FEEDBACK v1: thumbs on one answer ---------------------------------
   The per-message counterpart to the conversation flag, and deliberately the
   same control the AI Assistant has: same icons, same two values, same
   muted-until-hovered weight. Two assistants that rate answers differently
   would be two things to learn for no reason. */
.so-support-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-top: 0.15rem;
    opacity: 0.6;
    transition: opacity 0.12s ease;
}
.so-support-row:hover .so-support-actions,
.so-support-actions:focus-within {
    opacity: 1;
}
/* Touch has no hover to reveal it with. */
@media (hover: none) {
    .so-support-actions { opacity: 1; }
}
.so-support-actions .so-btn {
    width: 26px;
    height: 26px;
    color: var(--so-text-muted);
}
/* The thumbs sit apart from copy/share: those act ON the text, these say
   something ABOUT it. Same separator the AI Assistant uses. */
.so-support-rate {
    display: inline-flex;
    gap: 0.15rem;
    margin-left: 0.35rem;
    padding-left: 0.35rem;
    border-left: 1px solid var(--so-border-color);
}
/* .so-btn is repeated so this beats the generic muted rule above, which has
   equal specificity and comes first - the same trap the AI Assistant's rated
   thumb hit, where the class applied and the colour never showed. */
.so-support-actions .so-btn.so-support-rated {
    color: var(--so-primary, #2563eb);
    opacity: 1;
}
/* A chosen thumb is FILLED, not merely tinted. Material Symbols is a variable
   font and FILL is one of its axes, so this is the SAME glyph solid rather
   than a second icon name - how the framework's own rating marks a selected
   star. An outline in an accent colour reads as "hovered", not "chosen". */
.so-support-actions .so-btn.so-support-rated .material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
/* The answer row stacks: bubble, then its actions underneath. */
.so-support-row-ai {
    flex-direction: column;
    align-items: flex-start;
}
