/* Anne — inBiot custom styling (see also public/theme.json) */

:root {
    /* inBiot brand palette. Blue carries all UI chrome (zero AQ-status meaning,
       so it never collides with the green/amber/red traffic-light status that
       Anne uses for PASS/WARN/FAIL). Orange is RESERVED — logo accent only,
       kept away from tables and status chips so it can't read as WARN/amber. */
    --inbiot-blue: #009be5;
    --inbiot-blue-light: #63ccff;
    --inbiot-blue-dark: #006db3;
    --inbiot-orange: #ef6c00;
    --inbiot-orange-light: #ff9d3f;
    --inbiot-orange-dark: #b53d00;
    --inbiot-neutral-dark: #424242;
    /* Serif for headings (Claude-like editorial feel); Inter for body + data */
    --anne-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --anne-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    /* Chainlit wide default is min(60rem, 100vw) — bump for IAQ tables/dashboards */
    --anne-chat-max-width: min(80rem, 100vw);
}

/* Typography: Inter for body/UI (loaded via theme.json custom_fonts) */
body,
button,
input,
textarea,
select {
    font-family: var(--anne-sans);
}

/* Widen message thread + composer (inline maxWidth from Chainlit EC()) */
[style*="min(60rem"],
[style*="min(48rem"] {
    max-width: var(--anne-chat-max-width) !important;
}

/* ───────────────────────────────────────────────────────────
   Claude-inspired editorial reading rhythm
   ─────────────────────────────────────────────────────────── */

/* Comfortable body line-height + measured paragraph spacing */
.message-content {
    line-height: 1.68;
    font-size: 1rem;
    letter-spacing: 0.002em;
}

.message-content p {
    margin: 0.85em 0;
}

.message-content p:first-child {
    margin-top: 0;
}

/* Serif headings — warm, editorial, the "consultant voice" */
.message-content h1,
.message-content h2,
.message-content h3 {
    font-family: var(--anne-serif);
    font-weight: 600;
    color: hsl(var(--foreground));
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 1.5em 0 0.5em;
}

.message-content h1 {
    font-size: 1.6rem;
}

.message-content h2 {
    font-size: 1.34rem;
}

.message-content h3 {
    font-size: 1.14rem;
}

/* h4+ stays in Inter for a clean structural step-down */
.message-content h4 {
    font-family: var(--anne-sans);
    font-weight: 700;
    font-size: 1rem;
    margin: 1.2em 0 0.4em;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

/* Lists: breathing room */
.message-content ul,
.message-content ol {
    margin: 0.7em 0;
    padding-left: 1.4em;
}

.message-content li {
    margin: 0.3em 0;
}

/* Blockquote — quiet blue rail (Claude uses a soft side rail) */
.message-content blockquote {
    border-left: 3px solid var(--inbiot-blue);
    background: hsl(var(--muted));
    margin: 1em 0;
    padding: 0.6em 1em;
    border-radius: 0 8px 8px 0;
    color: hsl(var(--muted-foreground));
}

/* Links — inBiot blue, gentle underline */
.message-content a:not([href*="/dashboards/"]) {
    color: var(--inbiot-blue-dark);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(0, 155, 229, 0.4);
}

/* Inline code + code blocks — warm paper tone */
.message-content code {
    font-size: 0.88em;
    background: hsl(var(--secondary));
    padding: 0.12em 0.38em;
    border-radius: 5px;
}

.message-content pre {
    background: hsl(var(--secondary));
    border: 1px solid hsl(var(--border));
    border-radius: 10px;
    padding: 0.9em 1.1em;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* ───────────────────────────────────────────────────────────
   Tables — clean, warm, IAQ-friendly
   ─────────────────────────────────────────────────────────── */
.message-content table {
    border-collapse: collapse;
    margin: 1.1em 0;
    font-size: 0.92em;
    border-radius: 10px;
    overflow: hidden;
}
.message-content th,
.message-content td {
    padding: 0.5em 0.8em;
    border: 1px solid hsl(var(--border));
    text-align: left;
}
.message-content th {
    background: rgba(0, 155, 229, 0.08);
    font-weight: 600;
}
.message-content tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.015);
}

/* Dashboard CTA — solid blue button */
.message-content a[href*="/dashboards/"] {
    display: inline-block;
    padding: 0.55em 1em;
    background: linear-gradient(180deg, #009BE5 0%, #006DB3 100%);
    color: white !important;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 600;
    margin: 0.5em 0;
    box-shadow: 0 1px 2px rgba(0, 109, 179, 0.25);
}
.message-content a[href*="/dashboards/"]:hover {
    filter: brightness(1.06);
}

audio {
    width: 100%;
    max-width: 420px;
}

/* ───────────────────────────────────────────────────────────
   Composer — soft floating card (Claude-like)
   ─────────────────────────────────────────────────────────── */
form:has(textarea),
#message-composer {
    border-radius: 1rem !important;
    box-shadow: 0 1px 2px rgba(60, 50, 30, 0.05),
                0 10px 30px rgba(60, 50, 30, 0.07);
    border: 1px solid hsl(var(--border)) !important;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
form:has(textarea):focus-within,
#message-composer:focus-within {
    border-color: var(--inbiot-blue) !important;
    box-shadow: 0 1px 2px rgba(0, 109, 179, 0.10),
                0 10px 30px rgba(0, 109, 179, 0.12);
}

/* ───────────────────────────────────────────────────────────
   Settings sidebar (functional — width + section headers)
   ─────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    [data-panel-group-direction="horizontal"] > [data-panel]:has(#chat-settings-sidebar-title) {
        flex: 0 0 30% !important;
        max-width: min(30vw, 440px) !important;
        min-width: 240px !important;
    }

    [data-panel-group-direction="horizontal"] > [data-panel]:first-of-type {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    aside:has(#chat-settings-sidebar-title) .overflow-y-auto {
        gap: 0.35rem;
        padding-bottom: 1rem;
    }
}

/* Section headers injected by custom.js via data-section-title. */
aside:has(#chat-settings-sidebar-title) [data-section-title] {
    padding-top: 1.1rem;
    margin-top: 0.7rem;
    border-top: 1px solid hsl(var(--border));
}

aside:has(#chat-settings-sidebar-title) [data-section="iaq"]:first-of-type {
    border-top: none;
    margin-top: 0;
    padding-top: 0.2rem;
}

aside:has(#chat-settings-sidebar-title) [data-section-title]::before {
    content: attr(data-section-title);
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--inbiot-blue, #009be5);
    margin-bottom: 0.5rem;
}

/* ───────────────────────────────────────────────────────────
   Starter chips — full prompt, soft warm cards
   ─────────────────────────────────────────────────────────── */
#starters {
    width: 100%;
    max-width: var(--anne-chat-max-width);
    justify-content: flex-start !important;
    align-items: stretch !important;
}

#starters [id^="starter-"] {
    height: auto;
    max-width: 100%;
    white-space: normal;
    text-align: left;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    transition: border-color 0.15s ease, background 0.15s ease;
}

#starters [id^="starter-"]:hover {
    border-color: var(--inbiot-blue);
    background: hsl(var(--accent));
}

#starters [id^="starter-"] p {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.45;
}

/* ───────────────────────────────────────────────────────────
   Tasks panel (cl.TaskList) — wider so phase labels don't wrap.
   Chainlit's panel is `flex-grow max-w-[21rem]` with no width floor, so
   the greedy message area squeezes it well below 21rem. The fix is a
   flex BASIS + min-width floor (not just a bigger max), so it actually
   claims space. Mobile uses .tasklist-mobile (w-full) and is untouched.
   ─────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
    .tasklist {
        flex: 0 0 14rem !important;   /* fixed-ish basis: claim real width */
        min-width: 14rem !important;  /* floor so labels stay on one line */
        max-width: 14rem !important;  /* compact side panel */
    }
}
