/* Get help widget (floating button + panel) and the attachment picker, both apps — see includes/support-widget.php */

.help-widget { position: fixed; right: 20px; bottom: 20px; z-index: 1060; font-size: 0.86rem; }
.help-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.05rem;
    border: 0;
    border-radius: 999px;
    background: var(--navcdp-primary-dark, #2d5016);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(13, 31, 21, 0.28);
    transition: transform 0.15s ease, background 0.15s ease;
}
.help-launcher:hover { background: #24420f; transform: translateY(-1px); }
.help-launcher i { font-size: 1.1rem; }
.help-launcher-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #dc3545;
    font-size: 0.7rem;
    line-height: 20px;
    text-align: center;
}
.help-launcher-badge[hidden] { display: none; }
.help-widget.is-open .help-launcher { display: none; }

.help-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    width: 380px;
    height: min(620px, calc(100vh - 40px));
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}
.help-panel[hidden] { display: none; }
.help-panel-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    background: linear-gradient(135deg, #13291d 0%, #2d5016 100%);
    color: #fff;
}
.help-panel-title { flex: 1; margin: 0; font-size: 1rem; font-weight: 700; color: #fff; }
.help-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}
.help-icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.help-icon-btn[hidden] { display: none; }
.help-panel-body { flex: 1; overflow-y: auto; padding: 1rem; background: #f8faf6; }

.help-loading, .help-empty { padding: 1.25rem 0.5rem; text-align: center; color: #6b7280; }
.help-hello { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.9rem; }
.help-hello strong { font-size: 1.02rem; color: #0f172a; }
.help-hello span { color: #4b5563; font-size: 0.8rem; }
.help-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 0;
    border-radius: 10px;
    background: var(--navcdp-primary, #56ab2f);
    color: #fff;
    font-weight: 600;
}
.help-primary:hover { background: #4a9628; }
.help-primary:disabled { opacity: 0.65; }
.help-primary--sm { width: auto; padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.help-section-title { margin: 1.1rem 0 0.4rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #6b7280; }
.help-threads { display: flex; flex-direction: column; gap: 0.4rem; }
.help-thread-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    text-align: left;
}
.help-thread-item:hover { border-color: var(--navcdp-primary, #56ab2f); }
.help-thread-subject { font-weight: 600; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.help-thread-item.is-unread .help-thread-subject::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: var(--navcdp-primary, #56ab2f);
    vertical-align: middle;
}
.help-thread-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; font-size: 0.74rem; color: #6b7280; }
.help-status { padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.68rem; font-weight: 700; }
.help-status.is-open { background: #fff4d6; color: #8a5a00; }
.help-status.is-received { background: #dff4fb; color: #0b6a83; }
.help-status.is-resolved { background: #e3f4dc; color: #2d6a14; }
.help-status.is-closed { background: #eceff3; color: #4b5563; }
.help-link { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.9rem; font-size: 0.8rem; font-weight: 600; color: var(--navcdp-primary-dark, #2d5016); text-decoration: none; }
.help-link:hover { text-decoration: underline; }

.help-form { display: flex; flex-direction: column; gap: 0.35rem; }
.help-label { margin-top: 0.4rem; font-size: 0.76rem; font-weight: 600; color: #334155; }
.help-to { display: flex; flex-direction: column; gap: 0.4rem; margin: 0; padding: 0; border: 0; }
.help-to legend { float: none; margin: 0 0 0.1rem; font-size: 0.76rem; font-weight: 600; color: #334155; }
.help-to-option { display: flex; gap: 0.55rem; padding: 0.5rem 0.65rem; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; cursor: pointer; }
.help-to-option:has(input:checked) { border-color: var(--navcdp-primary, #56ab2f); background: #f3faef; }
.help-to-option input { margin-top: 0.2rem; }
.help-to-option span { display: flex; flex-direction: column; }
.help-to-option small { color: #4b5563; }
.help-context { display: flex; gap: 0.45rem; align-items: flex-start; margin: 0.5rem 0 0.6rem; font-size: 0.76rem; color: #4b5563; }
.help-context input { margin-top: 0.15rem; }

/* Attachment picker (widget and Messages page) */
.help-picker { margin-top: 0.4rem; }
.help-picker-list { display: flex; flex-direction: column; gap: 0.35rem; }
.help-picker-list:not(:empty) { margin-bottom: 0.45rem; }
.help-picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; }
.help-attach-btn { padding: 0.25rem 0.55rem; border: 1px dashed #94a3b8; border-radius: 8px; background: #fff; color: #334155; font-size: 0.78rem; }
.help-attach-btn:hover { border-color: var(--navcdp-primary, #56ab2f); color: var(--navcdp-primary-dark, #2d5016); }
.help-picker-hint { font-size: 0.72rem; color: #6b7280; }
.help-thumb { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.help-thumb img, .help-thumb-pdf { flex-shrink: 0; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #f1f5f9; }
.help-thumb-pdf { display: inline-flex; align-items: center; justify-content: center; color: #b91c1c; font-size: 1.2rem; }
.help-thumb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; color: #334155; }
.help-thumb-remove { border: 0; background: transparent; color: #64748b; padding: 0.2rem 0.4rem; }
.help-thumb-remove:hover { color: #dc3545; }

/* One conversation in the panel */
.help-thread-head { display: flex; flex-direction: column; gap: 0.35rem; padding-bottom: 0.75rem; margin-bottom: 0.75rem; border-bottom: 1px solid #e5e7eb; }
.help-thread-head strong { color: #0f172a; font-size: 0.95rem; }
.help-bubbles { display: flex; flex-direction: column; gap: 0.6rem; margin: 0 0 0.9rem; padding: 0; list-style: none; }
.help-bubble { display: flex; gap: 0.45rem; align-items: flex-end; }
.help-bubble.is-mine { justify-content: flex-end; }
.help-avatar {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dfeedd;
    color: var(--navcdp-primary-dark, #2d5016);
    font-size: 0.66rem;
    font-weight: 700;
}
.help-bubble-body { max-width: 82%; padding: 0.5rem 0.7rem; border: 1px solid #e5e7eb; border-radius: 12px 12px 12px 4px; background: #fff; }
.help-bubble.is-mine .help-bubble-body { border-color: #cfe6bf; border-radius: 12px 12px 4px 12px; background: #e6f3dd; }
.help-bubble-head { margin-bottom: 0.15rem; font-size: 0.7rem; color: #6b7280; }
.help-bubble-text { color: #1f2937; overflow-wrap: anywhere; }
.help-event { align-self: center; font-size: 0.72rem; color: #6b7280; }
.help-files { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.help-file-img img { display: block; width: 96px; height: 72px; border: 1px solid #e5e7eb; border-radius: 6px; object-fit: cover; }
.help-file-doc { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.5rem; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; font-size: 0.75rem; color: #334155; text-decoration: none; }
.help-file-doc i { color: #b91c1c; }
.help-reply { display: flex; flex-direction: column; gap: 0.4rem; }
.help-reply .help-primary { align-self: flex-end; }

@media (max-width: 575.98px) {
    .help-widget { right: 14px; bottom: 14px; }
    .help-launcher { padding: 0.75rem; }
    .help-launcher-text { display: none; }
    .help-panel { inset: 0; width: auto; height: auto; border-radius: 0; }
}
@media print { .help-widget { display: none; } }

/* Guest help (login pages, public forms, /help page): works without Bootstrap */
.help-widget, .help-widget *, .help-page, .help-page * { box-sizing: border-box; }
.help-widget button, .help-widget input, .help-widget select, .help-widget textarea,
.help-page button, .help-page input, .help-page textarea { font: inherit; }
.help-input {
    display: block;
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font-size: 0.86rem;
}
.help-input:focus { border-color: var(--navcdp-primary, #56ab2f); outline: 2px solid rgba(86, 171, 47, 0.25); outline-offset: 0; }
textarea.help-input { resize: vertical; }
.help-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.help-note { font-size: 0.72rem; color: #6b7280; }
.help-tip { display: flex; gap: 0.5rem; padding: 0.55rem 0.65rem; border-radius: 8px; background: #fdf6e3; border: 1px solid rgba(209, 166, 58, 0.45); font-size: 0.78rem; line-height: 1.45; color: #374151; }
.help-tip[hidden] { display: none; }
.help-tip i { margin-top: 0.15rem; color: #7a5230; }
.help-tip strong { display: block; color: #111827; }
.help-tip a { font-weight: 600; color: #2d6a30; }
.help-error { padding: 0.5rem 0.65rem; border: 1px solid #f5c2c7; border-radius: 8px; background: #fdecee; color: #a4161a; font-size: 0.8rem; }
.help-error[hidden] { display: none; }
.help-verified { padding: 0.45rem 0.65rem; border-radius: 8px; background: #e6f3dd; color: #2d5016; font-size: 0.8rem; font-weight: 600; }
.help-code-input { max-width: 9rem; margin: 0.4rem auto 0.6rem; font-size: 1.5rem; letter-spacing: 0.5em; text-align: center; }
.help-code-actions { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.6rem; }
.help-text-btn { padding: 0; border: 0; background: none; color: var(--navcdp-primary-dark, #2d5016); font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.help-text-btn:disabled { color: #9ca3af; cursor: default; }
.help-text-btn:not(:disabled):hover { text-decoration: underline; }
a.help-primary, a.help-thread-item { text-decoration: none; }
a.help-primary:hover { color: #fff; }
.help-done { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 1rem 0.25rem; text-align: center; }
.help-done strong { font-size: 1.05rem; color: #0f172a; }
.help-done span { font-size: 0.82rem; color: #4b5563; }
.help-done-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: #e3f4dc; color: #2d6a14; font-size: 1.4rem; }
.help-spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.1em;
    animation: help-spin 0.7s linear infinite;
}
@keyframes help-spin { to { transform: rotate(360deg); } }

/* Signed-out visitors may not recognise a bare icon: keep the label on phones */
@media (max-width: 575.98px) {
    .help-widget--guest .help-launcher { padding: 0.65rem 0.9rem; }
    .help-widget--guest .help-launcher-text { display: inline; font-size: 0.82rem; }
}
