/* herny-ui.css  (Herny AI chat: chat.html and the floating button in ai-chat.js)
   Colours follow Bootstrap's variables, so the site's light/dark switch (data-bs-theme) applies. */
.hy {
    --hy-teal: var(--mc-teal, #138d90);
    --hy-bg: var(--bs-body-bg, #fff);
    --hy-fg: var(--bs-body-color, #212529);
    --hy-muted: var(--bs-secondary-color, #6c757d);
    --hy-line: var(--bs-border-color, #dee2e6);
    --hy-soft: var(--bs-tertiary-bg, #f8f9fa);
    --hy-user: #e7f4f4;
    --hy-link: var(--bs-link-color, #0d6efd);
    --hy-bad: #b42318;
    --hy-warn-bg: #fff8e1;
    --hy-warn-fg: #6b4e00;
    display: flex; flex-direction: column; min-height: 0; height: 100%;
    background: var(--hy-bg); color: var(--hy-fg);
    font-size: 0.95rem; line-height: 1.5;
}
[data-bs-theme="dark"] .hy { --hy-user: #17393a; --hy-bad: #ff8a80; --hy-warn-bg: #3a3112; --hy-warn-fg: #ffe08a; --hy-link: #6ea8fe; }
.hy *, .hy *::before, .hy *::after { box-sizing: border-box; }
.hy button { font: inherit; color: inherit; }
.hy .hy-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.hy-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--hy-line); flex: 0 0 auto; }
.hy-logo { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--hy-teal); color: #fff; font-weight: 800; font-size: 1rem; letter-spacing: -0.02em; }
.hy-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; }
.hy-title strong { font-size: 1.02rem; white-space: nowrap; }
.hy-pill { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--hy-soft); color: var(--hy-muted); border: 1px solid var(--hy-line); white-space: nowrap; }
.hy-pill[data-state="ready"] { color: #0f6b5c; background: #e3f6f1; border-color: #a7e0d2; }
.hy-pill[data-state="busy"], .hy-pill[data-state="loading"] { color: #0b5d8a; background: #e5f2fb; border-color: #b5d9f0; }
.hy-pill[data-state="bad"] { color: var(--hy-bad); }
[data-bs-theme="dark"] .hy-pill[data-state="ready"] { color: #7ee2c8; background: #123b33; border-color: #1f5c50; }
[data-bs-theme="dark"] .hy-pill[data-state="busy"], [data-bs-theme="dark"] .hy-pill[data-state="loading"] { color: #8ccaf2; background: #12324a; border-color: #1d4d70; }
.hy-head-btns { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.hy-icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid transparent; border-radius: 8px; background: transparent; cursor: pointer; color: var(--hy-muted); text-decoration: none; position: relative; }
.hy-icon-btn:hover, .hy-icon-btn[aria-expanded="true"] { background: var(--hy-soft); color: var(--hy-fg); border-color: var(--hy-line); }
.hy-full-text { font-size: 0.8rem; font-weight: 600; }
.hy-text-btn { border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--hy-muted); cursor: pointer; font-size: 0.82rem; display: inline-flex; align-items: center; gap: 4px; }
.hy-text-btn:hover { color: var(--hy-fg); background: var(--hy-soft); }
.hy :focus-visible { outline: 2px solid var(--hy-teal); outline-offset: 2px; }

/* settings */
.hy-settings { flex: 0 0 auto; max-height: 55%; overflow-y: auto; padding: 10px 14px 12px; border-bottom: 1px solid var(--hy-line); background: var(--hy-soft); }
.hy-set-title { font-size: 0.72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--hy-teal); margin: 6px 0 6px; }
.hy-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--hy-line); border-radius: 10px; background: var(--hy-bg); margin-bottom: 6px; cursor: pointer; }
.hy-opt input { margin-top: 4px; accent-color: var(--hy-teal); }
.hy-opt .hy-small { display: block; }
.hy-opt.hy-disabled { opacity: .6; cursor: not-allowed; }
.hy-set-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.hy-btn { border: 1px solid var(--hy-teal); background: var(--hy-teal); color: #fff !important; border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.hy-btn:disabled { opacity: .5; cursor: default; }
.hy-btn-quiet { background: transparent; color: var(--hy-fg) !important; border-color: var(--hy-line); }
.hy-small { font-size: 0.8rem; margin: 4px 0; }
.hy-muted { color: var(--hy-muted); }

/* scroll area */
.hy-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px; overscroll-behavior: contain; }
.hy-card { border: 1px solid var(--hy-line); border-left: 4px solid var(--hy-teal); border-radius: 12px; padding: 16px 18px; background: var(--hy-bg); margin-bottom: 14px; }
.hy-page .hy-card { padding: 22px 24px; max-width: 760px; margin: 8px auto 18px; box-shadow: 0 6px 20px rgba(0,0,0,.05); }
.hy-card-logo .hy-logo { width: 44px; height: 44px; font-size: 1.4rem; border-radius: 12px; margin-bottom: 8px; }
.hy-card-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 10px; }
.hy-popup .hy-card-title { font-size: 1.05rem; }
.hy-points { padding-left: 1.1rem; margin: 0 0 12px; }
.hy-points li { margin-bottom: 6px; }
.hy-start-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.hy-start { border: 0; background: var(--hy-teal); color: #fff !important; font-weight: 700; padding: 10px 18px; border-radius: 10px; cursor: pointer; box-shadow: 0 4px 12px rgba(19,141,144,.25); }
.hy-start:hover { filter: brightness(1.07); }
.hy-start:disabled { opacity: .55; cursor: default; box-shadow: none; }
.hy-alert { border: 1px solid #f1c27d; background: var(--hy-warn-bg); color: var(--hy-warn-fg); border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; margin: 6px 0 10px; }
.hy-progress { margin: 8px 0 6px; }
.hy-bar { height: 8px; border-radius: 999px; background: var(--hy-soft); border: 1px solid var(--hy-line); overflow: hidden; }
.hy-bar > div { height: 100%; width: 0; background: var(--hy-teal); transition: width .3s ease; }
.hy-ptext { font-size: 0.82rem; color: var(--hy-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* messages */
.hy-msgs { display: flex; flex-direction: column; gap: 14px; }
.hy-page .hy-msgs, .hy-page .hy-chips { max-width: 820px; margin-left: auto; margin-right: auto; width: 100%; }
.hy-msg { display: flex; flex-direction: column; max-width: 100%; }
.hy-u { align-items: flex-end; }
.hy-u .hy-bubble { background: var(--hy-user); border-radius: 14px 14px 4px 14px; padding: 8px 12px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; }
.hy-a .hy-bubble { padding: 2px 0; max-width: 100%; overflow-wrap: anywhere; }
.hy-a .hy-bubble p { margin: 0 0 8px; }
.hy-a .hy-bubble ul, .hy-a .hy-bubble ol { margin: 0 0 8px; padding-left: 1.2rem; }
.hy-a .hy-bubble li { margin-bottom: 3px; }
.hy-a .hy-bubble code { background: var(--hy-soft); border: 1px solid var(--hy-line); border-radius: 4px; padding: 0 4px; font-size: .88em; color: inherit; }
.hy-pre { background: var(--hy-soft); border: 1px solid var(--hy-line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; font-size: .85em; }
.hy-ref { font-size: .75em; vertical-align: super; text-decoration: none; color: var(--hy-link); margin-left: 1px; }
.hy-err { color: var(--hy-bad); }
.hy-attached { font-size: 0.75rem; color: var(--hy-muted); margin-top: 3px; display: inline-flex; gap: 4px; align-items: center; }
.hy-src { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.hy-src-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hy-src-label { font-size: 0.72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--hy-muted); margin-right: 2px; }
.hy-src-link { display: inline-flex; gap: 5px; align-items: center; max-width: 100%; font-size: 0.8rem; padding: 3px 9px; border: 1px solid var(--hy-line); border-radius: 999px;
    color: var(--hy-fg); text-decoration: none; background: var(--hy-bg); }
.hy-src-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hy-src-link b { color: var(--hy-link); font-weight: 600; }
.hy-src-link svg { color: var(--hy-teal); flex: 0 0 auto; }
.hy-src-link:hover { border-color: var(--hy-teal); color: var(--hy-teal); }
.hy-note { font-size: 0.8rem; color: var(--hy-warn-fg); background: var(--hy-warn-bg); border-radius: 8px; padding: 4px 8px; margin-top: 6px; }
.hy-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.hy-meta { font-size: 0.75rem; color: var(--hy-muted); }
.hy-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.hy-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--hy-muted); animation: hyDot 1.2s infinite ease-in-out both; }
.hy-dots i:nth-child(1) { animation-delay: -.3s; } .hy-dots i:nth-child(2) { animation-delay: -.15s; }
@keyframes hyDot { 0%, 80%, 100% { transform: scale(.4); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hy-dots i { animation: none; } .hy-bar > div { transition: none; } }

/* suggestion chips */
.hy-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hy-chips-label { width: 100%; font-size: 0.72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--hy-muted); }
.hy-chip { border: 1px solid var(--hy-line); background: var(--hy-bg); border-radius: 999px; padding: 5px 12px; font-size: 0.83rem; cursor: pointer; text-align: left; }
.hy-chip:hover { border-color: var(--hy-teal); color: var(--hy-teal); }

/* composer */
.hy-compose { flex: 0 0 auto; border-top: 1px solid var(--hy-line); padding: 8px 12px 6px; background: var(--hy-bg); }
.hy-page .hy-compose > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.hy-row { display: flex; gap: 6px; align-items: flex-end; }
.hy-input { flex: 1 1 auto; min-width: 0; resize: none; border: 1px solid var(--hy-line); border-radius: 12px; padding: 8px 12px; max-height: 160px;
    background: var(--hy-bg); color: var(--hy-fg); font: inherit; line-height: 1.4; }
.hy-input:focus { outline: none; border-color: var(--hy-teal); box-shadow: 0 0 0 3px rgba(19,141,144,.18); }
.hy-send { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--hy-teal); color: #fff !important; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.hy-send:disabled { opacity: .45; cursor: default; }
.hy-send.hy-stop { background: var(--hy-fg); color: var(--hy-bg) !important; }
.hy-gcode-btn { height: 40px; border-color: var(--hy-line); }
.hy-gcode-btn.hy-on { color: var(--hy-teal); border-color: var(--hy-teal); font-weight: 700; font-size: .8rem; }
.hy-gcode { margin-bottom: 6px; }
.hy-gcode-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.8rem; color: var(--hy-muted); margin-bottom: 4px; }
.hy-gcode-tools { display: inline-flex; gap: 2px; }
.hy-file-label { margin: 0; }
.hy-gcode-text { width: 100%; height: 130px; resize: vertical; font: 12.5px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; border: 1px solid var(--hy-line); border-radius: 8px; padding: 6px 8px; background: var(--hy-soft); color: var(--hy-fg); }
.hy-limits { font-size: 0.72rem; color: var(--hy-muted); text-align: center; margin-top: 4px; }

/* page variant: header is a toolbar inside the page */
.hy-page .hy-head { padding: 8px 14px; }
.hy-page .hy-head .hy-logo, .hy-page .hy-title strong { display: none; }   /* the page's top bar already says Herny AI */

@media (max-width: 575.98px) {
    .hy-scroll { padding: 10px; }
    .hy-page .hy-card { padding: 16px; margin-top: 0; }
    .hy-card-title { font-size: 1.1rem; }
    .hy-u .hy-bubble { max-width: 92%; }
    .hy-full-text { display: none; }
    .hy-compose { padding: 6px 8px 4px; }
}
