/* ============================================================
   HELP DRAWER — botão ? do header + drawer lateral
   ============================================================ */

/* ============================================================
   HELP FAB — botão flutuante (canto inferior direito)
   Só aparece no desktop. No mobile, usa o ? do header.
   ============================================================ */
.help-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .35), 0 2px 6px rgba(0, 0, 0, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9989;
    transition: transform .18s ease, box-shadow .18s ease, opacity .2s ease;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}
.help-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 28px rgba(99, 102, 241, .45), 0 4px 10px rgba(0, 0, 0, .35);
}
.help-fab:active {
    transform: translateY(-1px) scale(1.02);
}
.help-fab svg {
    width: 26px;
    height: 26px;
}
.help-fab.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(.9);
}

/* Onboarding: pulsa 3x no primeiro carregamento */
.help-fab.pulse::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid #8b5cf6;
    animation: help-fab-pulse 1.4s ease-out 3;
    pointer-events: none;
}
@keyframes help-fab-pulse {
    0%   { transform: scale(.9); opacity: .85; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Tooltip no hover (só desktop) */
.help-fab[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .85);
    color: #fff;
    padding: .4rem .7rem;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

/* Esconde no mobile (back-to-top ocupa o canto) */
@media (max-width: 767px) {
    .help-fab { display: none !important; }
}


/* Backdrop */
.help-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    z-index: 9990;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
}
.help-backdrop.open { opacity: 1; pointer-events: auto; }

/* Drawer principal */
.help-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(960px, 100%);
    background: var(--card, #1a1a2e);
    border-left: 1px solid var(--border, #2d2d44);
    box-shadow: -8px 0 32px rgba(0, 0, 0, .35);
    z-index: 9991;
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    color: var(--text, #fff);
}
.help-drawer.open { transform: translateX(0); }

/* Header do drawer — gradient roxo discreto */
.help-drawer-head {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 1rem 1.4rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
}
.help-drawer-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    flex: 1;
}
.help-drawer-close {
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    font-size: 1.1rem;
}
.help-drawer-close:hover { background: rgba(255, 255, 255, .25); }

/* Body — layout 2 colunas */
.help-drawer-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar índice */
.help-drawer-aside {
    width: 240px;
    background: rgba(0, 0, 0, .15);
    border-right: 1px solid var(--border, #2d2d44);
    overflow-y: auto;
    padding: .8rem .6rem;
    flex-shrink: 0;
}
.help-drawer-aside-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-light, #a7a7a7);
    padding: .4rem .6rem .6rem;
    margin: 0;
    font-weight: 600;
}
.help-aside-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .65rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text, #fff);
    font-size: .85rem;
    transition: background .15s;
    text-decoration: none;
}
.help-aside-item:hover { background: rgba(255, 255, 255, .06); }
.help-aside-item.active {
    background: rgba(99, 102, 241, .2);
    border: 1px solid rgba(99, 102, 241, .5);
    color: #c7d2fe;
    font-weight: 600;
}
.help-aside-item.active:hover { background: rgba(99, 102, 241, .25); }
.help-aside-icon {
    flex-shrink: 0;
    width: 20px; text-align: center;
    font-size: .95rem;
    opacity: .85;
}

/* Conteúdo principal */
.help-drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.4rem 1.8rem 2rem;
    line-height: 1.65;
}
.help-drawer-content h1 {
    font-size: 1.4rem;
    margin: 0 0 1rem;
    color: var(--text, #fff);
    border-bottom: 1px solid var(--border, #2d2d44);
    padding-bottom: .6rem;
}
.help-drawer-content h2 {
    font-size: 1.05rem;
    margin: 1.4rem 0 .6rem;
    color: var(--text, #fff);
}
.help-drawer-content h3 {
    font-size: .95rem;
    margin: 1rem 0 .4rem;
    color: var(--text-light, #cfcfcf);
}
.help-drawer-content p {
    margin: 0 0 .8rem;
    color: var(--text, #fff);
    font-size: .92rem;
}
.help-drawer-content ul, .help-drawer-content ol {
    margin: 0 0 1rem 1.2rem;
    padding: 0;
}
.help-drawer-content li {
    margin: .25rem 0;
    font-size: .92rem;
}
.help-drawer-content b, .help-drawer-content strong {
    color: #c7d2fe;
    font-weight: 700;
}
.help-drawer-content a {
    color: #8b5cf6;
    text-decoration: underline;
}
.help-drawer-content code {
    background: rgba(0, 0, 0, .35);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .85em;
    color: #fbbf24;
}
.help-drawer-content blockquote {
    margin: 1rem 0;
    padding: .6rem .9rem;
    border-left: 3px solid #8b5cf6;
    background: rgba(139, 92, 246, .08);
    border-radius: 0 6px 6px 0;
    color: var(--text-light, #cfcfcf);
}

/* Vídeo */
.help-video-wrap {
    margin: 0 0 1.2rem;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border, #2d2d44);
}
.help-video-wrap video {
    width: 100%;
    display: block;
}

/* Galeria de imagens */
.help-imgs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .6rem;
    margin: 1rem 0;
}
.help-img-thumb {
    cursor: zoom-in;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border, #2d2d44);
    background: var(--bg, #0d0d0d);
    transition: transform .15s, border-color .15s;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.help-img-thumb:hover {
    transform: translateY(-2px);
    border-color: #8b5cf6;
}
.help-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Estado vazio (rota sem help ainda) */
.help-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light, #a7a7a7);
}
.help-empty-emoji {
    font-size: 3rem;
    margin-bottom: .8rem;
}
.help-empty-text {
    font-size: .95rem;
}

/* Loading */
.help-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light, #a7a7a7);
}
.help-loading-spinner {
    display: inline-block;
    width: 32px; height: 32px;
    border: 3px solid var(--border, #2d2d44);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: help-spin .8s linear infinite;
    margin-bottom: .8rem;
}
@keyframes help-spin { to { transform: rotate(360deg); } }

/* Lightbox */
.help-lightbox {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: zoom-out;
}
.help-lightbox.open { display: flex; }
.help-lightbox img {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.help-lightbox-close {
    position: absolute;
    top: 1rem; right: 1rem;
    width: 40px; height: 40px;
    background: rgba(255, 255, 255, .15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background .15s;
}
.help-lightbox-close:hover { background: rgba(255, 255, 255, .3); }

/* Tema claro */
[data-theme="light"] .help-drawer {
    background: #fff;
    color: #1a1a1a;
}
[data-theme="light"] .help-drawer-content h1,
[data-theme="light"] .help-drawer-content h2,
[data-theme="light"] .help-drawer-content p,
[data-theme="light"] .help-drawer-content li {
    color: #1a1a1a;
}
[data-theme="light"] .help-drawer-content h3 { color: #4b5563; }
[data-theme="light"] .help-drawer-content b,
[data-theme="light"] .help-drawer-content strong { color: #6d28d9; }
[data-theme="light"] .help-drawer-aside {
    background: #f7f7fa;
}
[data-theme="light"] .help-aside-item { color: #1a1a1a; }
[data-theme="light"] .help-aside-item:hover { background: rgba(0, 0, 0, .04); }
[data-theme="light"] .help-aside-item.active {
    background: rgba(99, 102, 241, .12);
    border-color: rgba(99, 102, 241, .35);
    color: #6d28d9;
}

/* Mobile */
@media (max-width: 760px) {
    .help-drawer-body { flex-direction: column; }
    .help-drawer-aside {
        width: 100%;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border, #2d2d44);
        display: flex;
        flex-wrap: wrap;
        gap: .35rem;
        padding: .6rem;
    }
    .help-drawer-aside-title { display: none; }
    .help-aside-item {
        padding: .4rem .7rem;
        font-size: .78rem;
        border: 1px solid var(--border, #2d2d44);
        flex: 0 0 auto;
    }
    .help-drawer-content {
        padding: 1rem 1.1rem 2rem;
    }
    .help-drawer-content h1 { font-size: 1.2rem; }
}
