/* ══════════════════════════════════════════════════════════════
   AccessBot Help Navigator — Floating widget styles
   ══════════════════════════════════════════════════════════════ */

/* ── Floating trigger button ──────────────────────────────────── */
#helpbot-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9980;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent, #00d4aa);
    color: #060e1c;
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0,212,170,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s;
    -webkit-tap-highlight-color: transparent;
}
#helpbot-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0,212,170,0.6);
}
#helpbot-trigger:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}
#helpbot-trigger[aria-expanded="true"] {
    background: #00a888;
    transform: rotate(90deg) scale(1.05);
}
#helpbot-trigger .hb-icon-open  { display: flex; }
#helpbot-trigger .hb-icon-close { display: none; }
#helpbot-trigger[aria-expanded="true"] .hb-icon-open  { display: none; }
#helpbot-trigger[aria-expanded="true"] .hb-icon-close { display: flex; }

/* ── Chat panel ───────────────────────────────────────────────── */
#helpbot-panel {
    position: fixed;
    bottom: 88px;
    right: 20px;
    z-index: 9979;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--bg-card, #0d1f35);
    border: 1px solid var(--border-bright, #1b3650);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    max-height: 480px;
    animation: hb-slide-in 0.22s ease;
    overflow: hidden;
}
#helpbot-panel[hidden] { display: none; }

@keyframes hb-slide-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Header */
.hb-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border, #152840);
    flex-shrink: 0;
}
.hb-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent, #00d4aa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #060e1c;
    flex-shrink: 0;
}
.hb-header-text { flex: 1; min-width: 0; }
.hb-header-text strong {
    display: block;
    font-size: 0.95rem;
    color: var(--fg-base, #d4e8e0);
}
.hb-header-text span {
    font-size: 0.75rem;
    color: var(--fg-muted, #7eb5ad);
}
.hb-close-btn {
    background: none;
    border: none;
    color: var(--fg-muted, #7eb5ad);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    line-height: 1;
}
.hb-close-btn:hover { background: var(--bg-hover, #162f4a); color: var(--fg-base, #d4e8e0); }

/* Messages area */
.hb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border, #152840) transparent;
}

/* Individual message bubbles */
.hb-msg {
    max-width: 88%;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
}
.hb-msg.bot {
    background: var(--bg-msg-ai, #0e2236);
    border: 1px solid var(--border, #152840);
    color: var(--fg-base, #d4e8e0);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.hb-msg.user {
    background: var(--accent, #00d4aa);
    color: #060e1c;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Go-to-page button inside a bot message */
.hb-goto-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 7px 14px;
    background: var(--accent, #00d4aa);
    color: #060e1c;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.hb-goto-btn:hover { background: #00b898; }
.hb-goto-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Quick-reply chips */
.hb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px;
    flex-shrink: 0;
}
.hb-chip {
    padding: 6px 12px;
    border: 1px solid var(--accent, #00d4aa);
    border-radius: 999px;
    background: transparent;
    color: var(--accent, #00d4aa);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.hb-chip:hover { background: rgba(0,212,170,0.12); }
.hb-chip:focus-visible { outline: 2px solid var(--accent, #00d4aa); outline-offset: 2px; }

/* Input row */
.hb-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border, #152840);
    flex-shrink: 0;
}
.hb-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input, #071526);
    border: 1px solid var(--border-bright, #1b3650);
    border-radius: 8px;
    color: var(--fg-base, #d4e8e0);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s;
}
.hb-input:focus { border-color: var(--accent, #00d4aa); }
.hb-input::placeholder { color: var(--fg-muted, #7eb5ad); }
.hb-send-btn {
    padding: 8px 14px;
    background: var(--accent, #00d4aa);
    color: #060e1c;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.hb-send-btn:hover { background: #00b898; }
.hb-send-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Typing indicator */
.hb-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 10px 13px;
    align-self: flex-start;
}
.hb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fg-muted, #7eb5ad);
    animation: hb-bounce 1.2s infinite ease-in-out;
}
.hb-dot:nth-child(2) { animation-delay: 0.2s; }
.hb-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes hb-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Feedback button (header) ─────────────────────────────────── */
.hb-feedback-btn {
    background: #f59e0b;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.01em;
    line-height: 1.4;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(245,158,11,0.4);
    flex-shrink: 0;
}
.hb-feedback-btn:hover {
    background: #d97706;
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(245,158,11,0.55);
}
.hb-feedback-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── Feedback form ────────────────────────────────────────────── */
.hb-fb-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 2px 8px;
}
.hb-fb-title {
    font-size: 1rem;
    color: var(--fg-base, #d4e8e0);
    margin: 0;
}
.hb-fb-sub {
    font-size: 0.78rem;
    color: var(--fg-muted, #7eb5ad);
    margin: 0;
    line-height: 1.45;
}
/* Star rating */
.hb-fb-stars {
    display: flex;
    gap: 2px;
}
.hb-fb-star {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--border-bright, #2a4060);
    transition: color 0.1s, transform 0.1s;
    padding: 0 3px;
    line-height: 1;
}
.hb-fb-star:hover,
.hb-fb-star.active {
    color: #f59e0b;
    transform: scale(1.18);
}
.hb-fb-star:focus-visible {
    outline: 2px solid var(--accent, #00d4aa);
    outline-offset: 2px;
    border-radius: 3px;
}
/* Textarea */
.hb-fb-textarea {
    width: 100%;
    background: var(--bg-input, #071526);
    border: 1px solid var(--border-bright, #1b3650);
    border-radius: 8px;
    color: var(--fg-base, #d4e8e0);
    font-family: inherit;
    font-size: 0.88rem;
    padding: 10px 12px;
    resize: vertical;
    min-height: 80px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.hb-fb-textarea:focus   { border-color: var(--accent, #00d4aa); }
.hb-fb-textarea::placeholder { color: var(--fg-muted, #7eb5ad); }
/* Action row */
.hb-fb-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.hb-fb-cancel {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-bright, #1b3650);
    border-radius: 8px;
    color: var(--fg-muted, #7eb5ad);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.hb-fb-cancel:hover { background: var(--bg-hover, #162f4a); color: var(--fg-base, #d4e8e0); }
.hb-fb-submit {
    padding: 8px 16px;
    background: #f59e0b;
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    box-shadow: 0 2px 8px rgba(245,158,11,0.35);
}
.hb-fb-submit:hover:not(:disabled) { background: #d97706; }
.hb-fb-submit:disabled { opacity: 0.55; cursor: not-allowed; }
/* Status line */
.hb-fb-status {
    font-size: 0.82rem;
    min-height: 1.2em;
    color: var(--fg-muted, #7eb5ad);
}
.hb-fb-status.success { color: #4ade80; font-weight: 600; }
.hb-fb-status.error   { color: #f87171; font-weight: 600; }

/* On the main chat page, nudge the widget up so it clears the input */
body.page-chat #helpbot-trigger { bottom: 90px; }

@media (max-width: 700px) {
    #helpbot-trigger { bottom: 80px; right: 16px; width: 46px; height: 46px; font-size: 1.2rem; }
    #helpbot-panel   { right: 10px; bottom: 138px; width: calc(100vw - 20px); max-height: 60vh; }
    body.page-chat #helpbot-trigger { bottom: 130px; }
}
