/* ── PM Help Widget ──────────────────────────────────────────────────────── */

/* ── FAB button (closed state) — speech-bubble style ─────────────────────── */
.pm-hw-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #92400e 0%, #b45309 50%, #d97706 100%);
    color: #fff;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px -4px rgba(146,64,14,0.5), 0 3px 8px rgba(0,0,0,0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    line-height: 1;
}
/* Speech-bubble tail at bottom-right */
.pm-hw-fab::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 4px solid transparent;
    border-top: 9px solid #b45309;
}
.pm-hw-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px -4px rgba(146,64,14,0.55), 0 4px 10px rgba(0,0,0,0.2);
}
.pm-hw-fab:active { transform: translateY(0); }

/* Inner layout of closed FAB */
.pm-hw-fab-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px 11px 14px;
}
.pm-hw-fab-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.95;
}
.pm-hw-fab-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}
.pm-hw-fab-top {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    color: #fef3c7;
}
.pm-hw-fab-sub {
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1;
    color: rgba(255,255,255,0.85);
}

/* Open state — compact circle with X */
.pm-hw-fab.is-open {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
}
.pm-hw-fab.is-open::after { display: none; }
.pm-hw-fab svg { flex-shrink: 0; }

/* Panel */
.pm-hw-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 9000;
    width: 320px;
    max-height: 540px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25), 0 10px 20px -5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: inherit;
    font-size: 14px;
    color: #1e293b;
}
.pm-hw-panel.pm-hw-hidden { display: none; }

/* Header */
.pm-hw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.pm-hw-header-left { display: flex; align-items: center; gap: 8px; }
.pm-hw-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #92400e, #b45309);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pm-hw-header-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1e293b;
}
.pm-hw-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
    font-family: inherit;
}
.pm-hw-close-btn:hover { color: #475569; }

/* Search */
.pm-hw-search-wrap {
    padding: 12px 16px 8px;
    flex-shrink: 0;
}
.pm-hw-search-inner { position: relative; }
.pm-hw-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: flex;
}
.pm-hw-search-input {
    width: 100%;
    font-size: 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 12px 8px 36px;
    outline: none;
    background: #f8fafc;
    color: #1e293b;
    transition: border-color 0.15s;
    font-family: inherit;
    box-sizing: border-box;
}
.pm-hw-search-input:focus { border-color: #fbbf24; background: #fff; }
.pm-hw-search-input::placeholder { color: #94a3b8; }

/* Body scroll area */
.pm-hw-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.pm-hw-body::-webkit-scrollbar { width: 4px; }
.pm-hw-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* Topic section label */
.pm-hw-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 4px 16px 8px;
}

/* Topics accordion */
.pm-hw-topics { padding: 0 12px 12px; }
.pm-hw-topic-row {}
.pm-hw-topic-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: none;
    background: none;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    transition: background 0.12s;
}
.pm-hw-topic-btn:hover { background: #f8fafc; }
.pm-hw-topic-btn-left { display: flex; align-items: center; gap: 8px; }
.pm-hw-topic-icon { font-size: 1rem; line-height: 1; }
.pm-hw-topic-chevron {
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.pm-hw-topic-chevron.expanded { transform: rotate(180deg); }

/* FAQs under topic */
.pm-hw-faqs { margin: 2px 0 4px 12px; display: none; }
.pm-hw-faqs.expanded { display: block; }
.pm-hw-faq-item {
    margin-bottom: 4px;
}
.pm-hw-faq-btn {
    width: 100%;
    text-align: left;
    border: none;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    color: #334155;
    transition: background 0.12s;
}
.pm-hw-faq-btn:hover { background: #fffbeb; }
.pm-hw-faq-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.pm-hw-faq-q { line-height: 1.4; }
.pm-hw-faq-toggle {
    color: #94a3b8;
    font-size: 0.875rem;
    flex-shrink: 0;
    margin-top: 1px;
    font-weight: 400;
}
.pm-hw-faq-answer {
    display: none;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.6;
    border-top: 1px solid #e2e8f0;
    margin-top: 8px;
    padding-top: 8px;
}
.pm-hw-faq-answer.expanded { display: block; }

/* Markdown content inside answers */
.pm-hw-faq-answer p,
.pm-hw-result-a p { margin: 0 0 6px; }
.pm-hw-faq-answer p:last-child,
.pm-hw-result-a p:last-child { margin-bottom: 0; }
.pm-hw-faq-answer ul,
.pm-hw-faq-answer ol,
.pm-hw-result-a ul,
.pm-hw-result-a ol { margin: 4px 0 6px; padding-left: 18px; }
.pm-hw-faq-answer li,
.pm-hw-result-a li { margin-bottom: 2px; }
.pm-hw-faq-answer strong,
.pm-hw-result-a strong { color: #334155; font-weight: 600; }
.pm-hw-faq-answer a,
.pm-hw-result-a a { color: #b45309; text-decoration: underline; }
.pm-hw-faq-answer a:hover,
.pm-hw-result-a a:hover { color: #92400e; }
.pm-hw-faq-answer code,
.pm-hw-result-a code { font-size: 0.7rem; background: #f1f5f9; border-radius: 3px; padding: 1px 4px; }

/* Search results */
.pm-hw-search-results { padding: 0 16px 12px; }
.pm-hw-search-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.pm-hw-updated-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 1px 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: pm-hw-badge-fade 2s ease forwards;
}
@keyframes pm-hw-badge-fade {
    0%   { opacity: 1; }
    60%  { opacity: 1; }
    100% { opacity: 0; }
}
.pm-hw-search-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
    padding: 20px 0;
}
.pm-hw-search-result-item {
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 0;
}
.pm-hw-search-result-item:last-child { border-bottom: none; }
.pm-hw-result-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}
.pm-hw-result-topic-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #b45309;
}
.pm-hw-result-q {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 4px;
}
.pm-hw-result-a {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}

/* Footer CTA (WhatsApp) */
.pm-hw-footer {
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    padding: 12px 16px;
    flex-shrink: 0;
}
.pm-hw-footer-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}
.pm-hw-wa-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.pm-hw-wa-btn:hover {
    background: #f0fdf4;
    border-color: #86efac;
    color: inherit;
    text-decoration: none;
}
.pm-hw-wa-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.pm-hw-wa-text-main {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
}
.pm-hw-wa-text-sub {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.3;
}
.pm-hw-wa-chevron { color: #cbd5e1; margin-left: auto; flex-shrink: 0; }

/* WhatsApp step */
.pm-hw-wa-step { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.pm-hw-wa-step.pm-hw-hidden { display: none; }
.pm-hw-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #b45309;
    font-size: 0.875rem;
    background: none;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s;
    text-align: left;
}
.pm-hw-back-btn:hover { background: #fffbeb; }
.pm-hw-wa-step-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 20px 20px;
    flex: 1;
    justify-content: center;
}
.pm-hw-wa-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #dcfce7;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
    color: #22c55e;
}
.pm-hw-wa-step-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 6px;
}
.pm-hw-wa-step-desc {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 20px;
}
.pm-hw-wa-msg-preview {
    width: 100%;
    text-align: left;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    box-sizing: border-box;
}
.pm-hw-wa-msg-label {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 4px;
}
.pm-hw-wa-msg-text {
    font-size: 0.875rem;
    color: #475569;
}
.pm-hw-wa-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #22c55e;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
}
.pm-hw-wa-open-btn:hover { background: #16a34a; color: #fff; text-decoration: none; }

/* Browse pane */
.pm-hw-browse { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.pm-hw-browse.pm-hw-hidden { display: none; }

/* Mobile: shift panel & FAB up on small screens */
@media (max-width: 480px) {
    .pm-hw-panel {
        right: 12px;
        bottom: 80px;
        width: calc(100vw - 24px);
        max-width: 340px;
    }
    .pm-hw-fab { right: 12px; bottom: 16px; }
}
