/* ========================================================================
 * HELP DRAWER - Per-page user guide with AI fallback
 * Slide-in from right. Light + dark themes. Reused across portal/superadmin/
 * pentest-app via the same CSS file (path differs per service).
 * ======================================================================= */

.help-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.18);
    color: #00B4D8;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 0.5rem;
}
.help-trigger:hover {
    background: rgba(0, 180, 216, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 180, 216, 0.25);
}
.help-trigger i { font-size: 0.95rem; }

html.dark .help-trigger {
    background: rgba(0, 180, 216, 0.1);
    border-color: rgba(0, 180, 216, 0.25);
    color: #67e8f9;
}

/* Backdrop */
.help-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 43, 91, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.help-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
html.dark .help-backdrop {
    background: rgba(0, 0, 0, 0.5);
}

/* Drawer panel */
.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 92vw;
    height: 100vh;
    background: #ffffff;
    z-index: 1100;
    box-shadow: -8px 0 40px rgba(15, 43, 91, 0.18);
    transform: translate3d(100%, 0, 0);
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(15, 43, 91, 0.08);
}
.help-drawer.open { transform: translate3d(0, 0, 0); }

html.dark .help-drawer {
    background: #0f1729;
    border-left-color: rgba(255, 255, 255, 0.08);
}

/* Header */
.help-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #0F2B5B 0%, #1a65d6 50%, #00B4D8 100%);
    color: #fff;
    flex-shrink: 0;
}
.help-drawer__title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}
.help-drawer__title i { font-size: 1.1rem; }
.help-drawer__close {
    background: rgba(255, 255, 255, 0.15);
    border: 0;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.help-drawer__close:hover { background: rgba(255, 255, 255, 0.25); }

/* Body */
.help-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    line-height: 1.55;
}
.help-drawer__page-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #00B4D8;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.help-drawer__loading {
    color: #64748b;
    font-style: italic;
    padding: 1.25rem 0;
}

/* Section blocks */
.help-section {
    margin-bottom: 1.125rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: rgba(0, 180, 216, 0.04);
    border: 1px solid rgba(0, 180, 216, 0.1);
}
.help-section h4 {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0F2B5B;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.help-section h4 i { color: #00B4D8; font-size: 0.9rem; }
.help-section p, .help-section li {
    color: #475569;
    font-size: 0.875rem;
    margin: 0 0 0.375rem;
}
.help-section ol, .help-section ul {
    padding-left: 1.25rem;
    margin: 0.375rem 0 0;
}
.help-section ol li { margin-bottom: 0.25rem; }
.help-section code {
    background: rgba(0, 180, 216, 0.1);
    padding: 0.0625rem 0.375rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', monospace;
    color: #0F2B5B;
}

html.dark .help-drawer__page-name { color: #67e8f9; }
html.dark .help-section {
    background: rgba(0, 180, 216, 0.06);
    border-color: rgba(0, 180, 216, 0.18);
}
html.dark .help-section h4 { color: #f1f5f9; }
html.dark .help-section h4 i { color: #67e8f9; }
html.dark .help-section p, html.dark .help-section li { color: #cbd5e1; }
html.dark .help-section code {
    background: rgba(0, 180, 216, 0.18);
    color: #67e8f9;
}

/* Quick actions chips */
.help-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}
.help-action-chip {
    background: #fff;
    border: 1px solid rgba(0, 180, 216, 0.25);
    color: #0F2B5B;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.help-action-chip:hover {
    background: rgba(0, 180, 216, 0.1);
    transform: translateY(-1px);
}
html.dark .help-action-chip {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 180, 216, 0.3);
    color: #e2e8f0;
}

/* AI Ask section at bottom */
.help-drawer__ask {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(15, 43, 91, 0.08);
    background: rgba(0, 180, 216, 0.02);
    flex-shrink: 0;
}
.help-drawer__ask-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.help-drawer__ask-label .help-sparkle {
    color: #00B4D8;
    animation: helpSparkle 2.5s ease-in-out infinite;
}
@keyframes helpSparkle {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.2) rotate(15deg); opacity: 1; }
}
.help-drawer__ask-form {
    display: flex;
    gap: 0.5rem;
}
.help-drawer__ask-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border-radius: 10px;
    border: 1px solid rgba(15, 43, 91, 0.15);
    background: #fff;
    font-size: 0.875rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.help-drawer__ask-input:focus {
    border-color: #00B4D8;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}
.help-drawer__ask-send {
    background: linear-gradient(135deg, #0F2B5B, #00B4D8);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 0 1rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.help-drawer__ask-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 180, 216, 0.3);
}
.help-drawer__ask-send:disabled { opacity: 0.6; cursor: wait; }

html.dark .help-drawer__ask {
    border-top-color: rgba(255, 255, 255, 0.08);
    background: rgba(0, 180, 216, 0.04);
}
html.dark .help-drawer__ask-label { color: #94a3b8; }
html.dark .help-drawer__ask-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}
html.dark .help-drawer__ask-input:focus { border-color: #00B4D8; }

/* AI response bubble */
.help-ai-response {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 43, 91, 0.04), rgba(0, 180, 216, 0.04));
    border: 1px solid rgba(0, 180, 216, 0.18);
    font-size: 0.875rem;
    color: #1e293b;
    line-height: 1.55;
}
.help-ai-response__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #00B4D8;
    letter-spacing: 1px;
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
html.dark .help-ai-response {
    background: linear-gradient(135deg, rgba(15, 43, 91, 0.3), rgba(0, 180, 216, 0.08));
    border-color: rgba(0, 180, 216, 0.25);
    color: #e2e8f0;
}
html.dark .help-ai-response__label { color: #67e8f9; }

/* Mobile: full-width drawer */
@media (max-width: 600px) {
    .help-drawer {
        width: 100vw;
        max-width: 100vw;
    }
    .help-trigger { width: 32px; height: 32px; }
}

/* GPU hint - use will-change instead of transform: translateZ(0), which
 * otherwise overrides the closed-state transform on .help-drawer (same
 * specificity, declared later) and leaves the drawer stuck open when the
 * .open class is removed. */
.help-drawer, .help-backdrop, .help-trigger {
    will-change: transform;
    backface-visibility: hidden;
}
