/* eFYP student help assistant. Uses the portal's colour tokens so it follows
   the light/dark theme; only the tinted pieces need their own dark values. */
.hb-launch {
    position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 1040;
    width: 52px; height: 52px; border: 0; border-radius: 50%;
    background: #2563eb; color: #fff; font-size: 22px; line-height: 52px; text-align: center;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .28); cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}
.hb-launch:hover { background: #1d4ed8; transform: translateY(-1px); }
.hb-launch:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.hb-launch .glyphicon { top: 2px; }

.hb-panel {
    position: fixed; right: 18px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 1041;
    width: 360px; max-width: calc(100vw - 24px); height: 520px; max-height: calc(100vh - 110px);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--clr-card, #fff); color: var(--clr-text, #1e293b);
    border: 1px solid var(--clr-border, #d9e2ec); border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .25);
    font-size: 14px;
}
.hb-panel[hidden] { display: none !important; }
.hb-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: #1e3a8a; color: #fff;
}
.hb-head-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.hb-head-sub { font-size: 12px; opacity: .85; }
.hb-close {
    margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px;
    background: transparent; color: #fff; font-size: 20px; line-height: 32px; cursor: pointer;
}
.hb-close:hover { background: rgba(255, 255, 255, .15); }
.hb-close:focus-visible { outline: 2px solid #fff; }

.hb-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
          background: var(--clr-surface, #f8fafc); }
.hb-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; line-height: 1.45;
          overflow-wrap: anywhere; white-space: pre-line; }
.hb-bot  { align-self: flex-start; background: var(--clr-card, #fff); border: 1px solid var(--clr-border, #d9e2ec);
           border-bottom-left-radius: 4px; }
.hb-user { align-self: flex-end; background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }
.hb-msg p { margin: 0 0 4px; }
.hb-msg p:last-child { margin-bottom: 0; }
.hb-links { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.hb-links a { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
              background: #e6f0fd; color: #1e4f9c; text-decoration: none; }
.hb-links a:hover { background: #d3e4fb; text-decoration: none; }
.hb-typing { align-self: flex-start; color: var(--clr-muted, #526173); font-size: 13px; padding: 2px 4px; }

.hb-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; border-top: 1px solid var(--clr-border, #d9e2ec);
            background: var(--clr-card, #fff); max-height: 96px; overflow-y: auto; }
.hb-chip { border: 1px solid #bfd3f2; background: transparent; color: #1e4f9c; border-radius: 999px;
           padding: 4px 10px; font-size: 13px; cursor: pointer; }
.hb-chip:hover { background: #e6f0fd; }
.hb-chip:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

.hb-form { display: flex; gap: 8px; padding: 10px 12px 12px; background: var(--clr-card, #fff); }
.hb-input { flex: 1; min-width: 0; height: 38px; padding: 6px 10px; font-size: 14px;
            border: 1px solid var(--clr-border, #cbd5e1); border-radius: 8px;
            background: var(--clr-card, #fff); color: var(--clr-text, #1e293b); }
.hb-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.hb-send { height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: #2563eb; color: #fff;
           font-weight: 600; cursor: pointer; }
.hb-send:hover { background: #1d4ed8; }
.hb-send:disabled { opacity: .6; cursor: default; }

@media (max-width: 480px) {
    .hb-panel { right: 8px; left: 8px; width: auto; max-width: none;
                bottom: calc(80px + env(safe-area-inset-bottom, 0px)); height: calc(100vh - 150px); }
    .hb-launch { right: 12px; }
}
@media print { .hb-launch, .hb-panel { display: none !important; } }

html[data-efyp-theme="dark"] .hb-head { background: #1b2c4a; }
html[data-efyp-theme="dark"] .hb-links a { background: #1e3149; color: #b9d6ff; }
html[data-efyp-theme="dark"] .hb-links a:hover { background: #26405f; }
html[data-efyp-theme="dark"] .hb-chip { border-color: #3a5577; color: #b9d6ff; }
html[data-efyp-theme="dark"] .hb-chip:hover { background: #1e3149; }
html[data-efyp-theme="dark"] .hb-input { border-color: #5f6c7a; }
