/* Help robot (partials/help-chat) + instructor Messages pages. */
:root {
    --hc-navy: #16307a;
    --hc-navy-2: #23449e;
    --hc-green: #1ba84c;
    --hc-surface: #ffffff;
    --hc-surface-2: #f3f6fb;
    --hc-line: #dde3ee;
    --hc-text: #1d2433;
    --hc-muted: #5b6577;
    --hc-bot-bg: #eef2fa;
    --hc-me-bg: #16307a;
    --hc-me-text: #ffffff;
    --hc-chip-bg: #ffffff;
    --hc-chip-line: #b9c6e4;
    --hc-chip-text: #16307a;
    --hc-shadow: 0 18px 50px rgba(17, 30, 66, .22), 0 4px 14px rgba(17, 30, 66, .12);
}
.dark-theme {
    --hc-surface: #161c29;
    --hc-surface-2: #1d2433;
    --hc-line: #2e3749;
    --hc-text: #e8ecf4;
    --hc-muted: #a3adbf;
    --hc-bot-bg: #222b3d;
    --hc-me-bg: #3b5fc4;
    --hc-chip-bg: #1d2433;
    --hc-chip-line: #3d4a66;
    --hc-chip-text: #b9c9f5;
    --hc-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

/* ---------- launcher: the robot ---------- */
.hc-launcher {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1030;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #2d56c4 0%, var(--hc-navy) 70%);
    box-shadow: 0 10px 26px rgba(22, 48, 122, .38), inset 0 -4px 0 rgba(0, 0, 0, .15);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform .18s ease, box-shadow .18s ease;
}
.hc-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 30px rgba(22, 48, 122, .45); }
.hc-launcher:focus-visible { outline: 3px solid #f5b400; outline-offset: 3px; }
.hc-launcher svg { width: 58px; height: 58px; display: block; overflow: visible; }
.hc-launcher .hc-bot-float { animation: hc-float 3.2s ease-in-out infinite; transform-origin: 50% 60%; }
.hc-bot-eye { animation: hc-blink 5s infinite; transform-origin: center; transform-box: fill-box; }
.hc-bot-antenna { animation: hc-glow 2.4s ease-in-out infinite; }
.hc-launcher[aria-expanded="true"] .hc-bot-float { animation: none; }
.hc-launcher__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #e5383b;
    color: #fff;
    font: 700 12px/22px system-ui, sans-serif;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.hc-launcher__badge[hidden] { display: none; }
.hc-hello {
    position: fixed;
    right: 98px;
    bottom: 34px;
    z-index: 1030;
    max-width: 210px;
    padding: 9px 13px;
    border-radius: 14px 14px 4px 14px;
    background: var(--hc-surface);
    color: var(--hc-text);
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 8px 22px rgba(17, 30, 66, .18);
    border: 1px solid var(--hc-line);
    animation: hc-pop .25s ease-out;
}
.hc-hello[hidden] { display: none; }

@keyframes hc-float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes hc-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes hc-glow { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes hc-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .hc-launcher .hc-bot-float, .hc-bot-eye, .hc-bot-antenna, .hc-hello, .hc-panel { animation: none !important; }
}

/* Simulator pages: a small, quiet bubble so it does not cover the work area. */
.hc-compact .hc-launcher { width: 46px; height: 46px; right: 10px; bottom: 10px; opacity: .8; }
.hc-compact .hc-launcher:hover, .hc-compact .hc-launcher:focus-visible, .hc-compact .hc-launcher[aria-expanded="true"] { opacity: 1; }
.hc-compact .hc-launcher svg { width: 38px; height: 38px; }
.hc-compact .hc-launcher .hc-bot-float { animation: none; }
.hc-compact .hc-panel { bottom: 66px; right: 10px; }
.hc-compact .hc-hello { display: none; }

/* Admin and instructor panels: lift their back-to-top button above the robot. */
.wrapper .back-to-top { bottom: 102px; right: 34px; }
@media (max-width: 575.98px) { .wrapper .back-to-top { bottom: 82px; right: 22px; } }
.hc-open .wrapper .back-to-top { display: none !important; }

/* ---------- panel ---------- */
.hc-panel {
    position: fixed;
    right: 18px;
    bottom: 102px;
    z-index: 1030;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: min(600px, calc(100vh - 130px));
    display: flex;
    flex-direction: column;
    background: var(--hc-surface);
    color: var(--hc-text);
    border-radius: 20px;
    box-shadow: var(--hc-shadow);
    overflow: hidden;
    animation: hc-pop .22s ease-out;
    font-size: 14.5px;
}
.hc-panel[hidden] { display: none; }
.hc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    background: linear-gradient(135deg, var(--hc-navy) 0%, var(--hc-navy-2) 100%);
    color: #fff;
}
.hc-head__avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: grid; place-items: center; flex: none; }
.hc-head__avatar svg { width: 34px; height: 34px; }
.hc-head__text { flex: 1; min-width: 0; }
.hc-head__title { margin: 0; font-size: 16px; font-weight: 700; color: #fff; line-height: 1.2; }
.hc-head__sub { margin: 0; font-size: 12.5px; color: rgba(255, 255, 255, .82); display: flex; align-items: center; gap: 6px; }
.hc-head__sub::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 2px rgba(74, 222, 128, .3); }
.hc-icon-btn {
    width: 36px; height: 36px; flex: none;
    border: 0; border-radius: 10px;
    background: transparent; color: inherit;
    display: grid; place-items: center; cursor: pointer;
    font-size: 22px; line-height: 1;
}
.hc-icon-btn:hover { background: rgba(255, 255, 255, .15); }
.hc-icon-btn:focus-visible { outline: 2px solid #f5b400; outline-offset: 1px; }

.hc-switch { display: flex; gap: 4px; padding: 8px 10px 0; background: var(--hc-surface); border-bottom: 1px solid var(--hc-line); }
.hc-switch button {
    flex: 1;
    padding: 8px 6px 10px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--hc-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.hc-switch button[aria-selected="true"] { color: var(--hc-navy); border-bottom-color: var(--hc-green); }
.dark-theme .hc-switch button[aria-selected="true"] { color: #b9c9f5; }
.hc-switch .hc-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: #e5383b; color: #fff; font-size: 11px; line-height: 18px; }

.hc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; background: var(--hc-surface-2); scroll-behavior: smooth; }
.hc-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hc-row { display: flex; gap: 8px; align-items: flex-end; animation: hc-pop .2s ease-out; }
.hc-row--me { justify-content: flex-end; }
.hc-row__avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--hc-navy); display: grid; place-items: center; }
.hc-row__avatar svg { width: 22px; height: 22px; }
.hc-bubble {
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 16px 16px 16px 4px;
    background: var(--hc-bot-bg);
    color: var(--hc-text);
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.hc-row--me .hc-bubble { border-radius: 16px 16px 4px 16px; background: var(--hc-me-bg); color: var(--hc-me-text); }
.hc-bubble p { margin: 0 0 6px; }
.hc-bubble p:last-child { margin: 0; }
.hc-bubble ol { margin: 4px 0 0; padding-left: 20px; }
.hc-bubble li + li { margin-top: 5px; }
.hc-bubble__q { font-weight: 700; margin-bottom: 4px; }
.hc-pre { white-space: pre-line; }
.hc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 36px; }
.hc-chip {
    padding: 7px 12px;
    border: 1.5px solid var(--hc-chip-line);
    border-radius: 999px;
    background: var(--hc-chip-bg);
    color: var(--hc-chip-text);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}
.hc-chip:hover { border-color: var(--hc-navy); background: #e6ecfa; color: var(--hc-navy); }
.dark-theme .hc-chip:hover { background: #2a3550; color: #fff; }
.hc-chip:focus-visible { outline: 2px solid #f5b400; outline-offset: 2px; }
.hc-chip--go { background: var(--hc-green); border-color: var(--hc-green); color: #fff; }
.hc-chip--go:hover { background: #158a3e; border-color: #158a3e; color: #fff; }
.hc-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.hc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--hc-muted); animation: hc-dots 1s infinite ease-in-out; }
.hc-typing span:nth-child(2) { animation-delay: .15s; }
.hc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hc-dots { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.hc-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--hc-line); background: var(--hc-surface); }
.hc-foot textarea, .hc-form textarea, .hc-form select {
    width: 100%;
    border: 1.5px solid var(--hc-line);
    border-radius: 12px;
    background: var(--hc-surface);
    color: var(--hc-text);
    font: inherit;
    padding: 9px 12px;
}
.hc-foot textarea { resize: none; height: 42px; max-height: 110px; overflow-y: hidden; line-height: 1.4; }
.hc-foot textarea:focus, .hc-form textarea:focus, .hc-form select:focus { outline: none; border-color: var(--hc-navy-2); box-shadow: 0 0 0 3px rgba(35, 68, 158, .18); }
.hc-send {
    width: 42px; height: 42px; flex: none;
    border: 0; border-radius: 12px;
    background: var(--hc-green); color: #fff;
    display: grid; place-items: center; cursor: pointer;
}
.hc-send:hover { background: #158a3e; }
.hc-send:disabled { opacity: .5; cursor: default; }
.hc-send svg { width: 20px; height: 20px; }

/* compose + threads */
.hc-form { display: flex; flex-direction: column; gap: 10px; }
.hc-form label { font-weight: 700; font-size: 13.5px; margin-bottom: -4px; }
.hc-form textarea { min-height: 130px; resize: vertical; }
.hc-note { font-size: 12.5px; color: var(--hc-muted); margin: 0; }
.hc-error { padding: 8px 10px; border-radius: 10px; background: #fde8e8; color: #9b1c1c; font-size: 13.5px; margin: 0; }
.hc-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 16px;
    border: 0; border-radius: 12px;
    background: var(--hc-green); color: #fff;
    font-weight: 700; font-size: 14.5px;
    cursor: pointer; text-decoration: none;
}
.hc-btn svg { width: 18px; height: 18px; flex: none; }
.hc-btn:hover { background: #158a3e; color: #fff; }
.hc-btn:disabled { opacity: .6; cursor: default; }
.hc-btn--ghost { background: transparent; color: var(--hc-navy); border: 1.5px solid var(--hc-chip-line); }
.hc-btn--ghost:hover { background: #e6ecfa; color: var(--hc-navy); }
.dark-theme .hc-btn--ghost { color: #b9c9f5; }
.hc-back { border: 0; background: none; color: var(--hc-navy); font-weight: 700; padding: 0 0 8px; cursor: pointer; }
.dark-theme .hc-back { color: #b9c9f5; }
.hc-threads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hc-thread {
    width: 100%;
    text-align: left;
    padding: 11px 12px;
    border: 1px solid var(--hc-line);
    border-radius: 14px;
    background: var(--hc-surface);
    color: var(--hc-text);
    cursor: pointer;
    display: grid;
    gap: 3px;
}
.hc-thread:hover { border-color: var(--hc-chip-line); }
.hc-thread.is-unread { border-left: 4px solid var(--hc-green); }
.hc-thread__subject { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.hc-thread__meta { font-size: 12.5px; color: var(--hc-muted); }
.hc-empty-box { text-align: center; padding: 26px 12px; color: var(--hc-muted); }
.hc-empty-box svg { width: 64px; height: 64px; margin-bottom: 8px; }

/* ---------- status pills, shared with instructor pages ---------- */
.hc-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.hc-status--open { background: #fff4d6; color: #8a5a00; }
.hc-status--answered { background: #dcf5e5; color: #116132; }
.hc-status--closed { background: #e9ecf1; color: #4b5565; }
.hc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--hc-green); margin-right: 6px; vertical-align: middle; }

/* ---------- admin: Help robot AI review ---------- */
.hc-ai-q { min-width: 240px; max-width: 380px; white-space: normal !important; overflow-wrap: anywhere; }
.hc-ai-flags { white-space: normal !important; }
.hc-ai-flags .hc-status { margin: 2px 4px 2px 0; }

/* ---------- instructor Messages pages ---------- */
.hc-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.hc-tabs__item { padding: 7px 14px; border-radius: 999px; border: 1px solid #d0d7e4; color: #344054; font-weight: 600; font-size: 14px; text-decoration: none; background: #fff; }
.hc-tabs__item:hover { border-color: #16307a; color: #16307a; }
.hc-tabs__item.is-active { background: #16307a; border-color: #16307a; color: #fff; }
.hc-empty { padding: 28px 20px; text-align: center; }
.hc-inbox { list-style: none; margin: 0; padding: 0; }
.hc-inbox__row + .hc-inbox__row { border-top: 1px solid #e7ebf2; }
.hc-inbox__link {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr auto;
    grid-template-areas: "who subject status" "who meta status";
    column-gap: 16px;
    row-gap: 2px;
    align-items: center;
    padding: 14px 18px;
    color: inherit;
    text-decoration: none;
}
.hc-inbox__link:hover { background: #f5f8fd; }
.hc-inbox__who { grid-area: who; font-weight: 600; }
.hc-inbox__subject { grid-area: subject; color: #1d2433; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-inbox__meta { grid-area: meta; font-size: 13px; color: #667085; }
.hc-inbox__meta span + span { margin-left: 2px; }
.hc-inbox__row .hc-status { grid-area: status; }
.hc-inbox__row.is-unread .hc-inbox__who, .hc-inbox__row.is-unread .hc-inbox__subject { font-weight: 700; }
.hc-convo { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hc-convo__msg { max-width: 88%; padding: 12px 14px; border-radius: 14px; background: #f1f4fa; border: 1px solid #e3e8f1; }
.hc-convo__msg.is-staff { align-self: flex-end; background: #e8f6ee; border-color: #c9ebd6; }
.hc-convo__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 4px; font-size: 13.5px; }
.hc-convo__head time { color: #667085; font-size: 12.5px; }
.hc-convo__body { line-height: 1.6; overflow-wrap: anywhere; }
.hc-facts { margin: 0 0 14px; }
.hc-facts dt { font-size: 12.5px; color: #667085; font-weight: 600; margin-top: 8px; }
.hc-facts dd { margin: 0; overflow-wrap: anywhere; }
.dark-theme .hc-tabs__item { background: transparent; color: #d0d7e4; border-color: #3d4a66; }
.dark-theme .hc-tabs__item.is-active { background: #3b5fc4; border-color: #3b5fc4; color: #fff; }
.dark-theme .hc-inbox__subject { color: inherit; }
.dark-theme .hc-inbox__link:hover { background: rgba(255, 255, 255, .04); }
.dark-theme .hc-convo__msg { background: #1d2433; border-color: #2e3749; }
.dark-theme .hc-convo__msg.is-staff { background: #17301f; border-color: #24502f; }

@media (max-width: 720px) {
    .hc-inbox__link { grid-template-columns: 1fr auto; grid-template-areas: "who status" "subject subject" "meta meta"; }
}

/* ---------- phones ---------- */
@media (max-width: 575.98px) {
    .hc-launcher { width: 60px; height: 60px; right: 12px; bottom: 12px; }
    .hc-launcher svg { width: 48px; height: 48px; }
    .hc-hello { right: 80px; bottom: 24px; }
    .hc-panel { right: 8px; left: 8px; width: auto; max-width: none; bottom: 80px; height: calc(100vh - 100px); height: calc(100dvh - 100px); border-radius: 18px; }
    /* learner dashboard: stay above the bottom navigation bar */
    body:has(.clp-bottom-nav) .hc-launcher { bottom: 78px; }
    body:has(.clp-bottom-nav) .hc-hello { bottom: 90px; }
    body:has(.clp-bottom-nav) .hc-panel { bottom: 146px; height: calc(100dvh - 166px); }
}

/* ---------- live meeting now (red pop-up above Byte) ---------- */
.hc-launcher.is-live { animation: hc-live-ring 1.6s ease-out infinite; }
@keyframes hc-live-ring {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .7), 0 10px 26px rgba(22, 48, 122, .38); }
    70% { box-shadow: 0 0 0 18px rgba(220, 38, 38, 0), 0 10px 26px rgba(22, 48, 122, .38); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0), 0 10px 26px rgba(22, 48, 122, .38); }
}
.hc-live {
    position: fixed; right: 18px; bottom: 104px; z-index: 1031;
    width: 330px; max-width: calc(100vw - 36px); box-sizing: border-box;
    background: #B91C1C; color: #FFFFFF; border-radius: 16px; padding: 14px 16px 16px;
    box-shadow: 0 16px 36px rgba(127, 29, 29, .45), 0 0 0 3px rgba(255, 255, 255, .9);
    font-family: inherit; animation: hc-live-in .35s ease-out;
}
@keyframes hc-live-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.hc-live__head { display: flex; align-items: center; gap: 8px; }
.hc-live__dot { width: 11px; height: 11px; border-radius: 50%; background: #FFFFFF; animation: hc-live-blink 1s ease-in-out infinite; }
@keyframes hc-live-blink { 50% { opacity: .25; } }
.hc-live__tag { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.hc-live__x { margin-left: auto; background: transparent; border: 0; color: #FFFFFF; font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 8px; border-radius: 8px; }
.hc-live__x:hover, .hc-live__x:focus-visible { background: rgba(255, 255, 255, .18); outline: none; }
.hc-live__title { margin: 8px 0 2px; font-size: 19px; font-weight: 700; line-height: 1.25; color: #FFFFFF; }
.hc-live__meta { margin: 0 0 12px; font-size: 13px; line-height: 1.4; color: #FEE2E2; }
.hc-live__join, .hc-live__join:visited { display: block; text-align: center; background: #FFFFFF; color: #B91C1C !important; font-weight: 700; font-size: 17px; padding: 12px 14px; border-radius: 10px; text-decoration: none !important; }
.hc-live__join:hover, .hc-live__join:focus-visible { background: #FEE2E2; outline: 3px solid #FFFFFF; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    .hc-launcher.is-live, .hc-live, .hc-live__dot { animation: none; }
    .hc-launcher.is-live { box-shadow: 0 0 0 4px #DC2626, 0 10px 26px rgba(22, 48, 122, .38); }
}
@media (max-width: 575.98px) {
    .hc-live { left: 12px; right: 12px; width: auto; max-width: none; bottom: 84px; }
    body:has(.clp-bottom-nav) .hc-live { bottom: 150px; }
}
