/* Help Sidepanel - Unique Component with help- prefixes */

/* Base help sidepanel styling */
.help-sidepanel {
    /* Extend AI Assistant framework */
    position: fixed;
    top: 0;
    width: var(--ai-assistant-sidepanel-width, 500px);
    height: 100vh;
    background: var(--ai-assistant-bg-color, #ffffff);
    box-shadow: var(--ai-assistant-box-shadow, -2px 0 20px rgba(0, 0, 0, 0.1));
    z-index: 1050;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--ai-assistant-border-color, #dee2e6);

    /* Ensure proper initial positioning */
    right: -500px;
    /* Fallback if CSS variable fails */
    right: calc(-1 * var(--ai-assistant-sidepanel-width, 500px));

    /* Closed means CLOSED, not merely off-screen.
     *
     * This panel was hidden by `right: -500px` alone -- no visibility, display,
     * inert or pointer-events -- so on all 109 views that render it, its close
     * button, its Ask AI button and the whole help article stayed in the tab
     * order and in the accessibility tree. A keyboard user tabbing through any
     * of those pages fell into a panel they could not see, and a screen-reader
     * user heard a full article that was not on screen.
     *
     * visibility (not display) so the 0.3s slide still runs, and it is
     * transitioned with a DELAY equal to that slide: opening flips to visible
     * immediately (0s delay, below), closing waits the full 0.3s so the panel
     * animates out and only then leaves the tree. `display: none` would remove
     * it instantly and lose the animation; opacity would not remove it from the
     * tab order at all, which is the entire bug.
     */
    visibility: hidden;
    transition: right 0.3s ease, visibility 0s linear 0.3s;
}

.help-sidepanel.help-open {
    right: 0 !important;
    visibility: visible;
    /* No delay on the way IN. */
    transition: right 0.3s ease, visibility 0s linear 0s;
}

/* Help-specific overlay */
.help-sidepanel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.help-sidepanel-overlay.help-show {
    opacity: 1;
    visibility: visible;
}

/* Help-specific header styling */
.help-sidepanel .help-header {
    padding: 1rem;
    border-bottom: 2px solid var(--bs-info, #0dcaf0);
    background: var(--ai-assistant-header-bg, #f8f9fa);
    flex-shrink: 0;
}

/* Help-specific body with proper scrolling */
.help-sidepanel .help-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* Ensure scrollbar is always visible when needed */
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 transparent;
}

/* Webkit scrollbar styling for help sidepanel */
.help-sidepanel .help-body::-webkit-scrollbar {
    width: 8px;
}

.help-sidepanel .help-body::-webkit-scrollbar-track {
    background: transparent;
}

.help-sidepanel .help-body::-webkit-scrollbar-thumb {
    background-color: #dee2e6;
    border-radius: 4px;
}

.help-sidepanel .help-body::-webkit-scrollbar-thumb:hover {
    background-color: #adb5bd;
}

/* Help content with proper padding */
.help-sidepanel .help-content {
    padding: 1.5rem;
    min-height: 100%;
}

.help-sidepanel .help-content h6 {
    color: var(--ai-assistant-primary-color, var(--bs-primary, #007bff));
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Help process steps styling */
.help-sidepanel .help-process-steps {
    margin-bottom: 2rem;
}

.help-sidepanel .help-process-step {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--ai-assistant-header-bg, #f8f9fa);
    border-radius: var(--ai-assistant-border-radius, 0.5rem);
    border-left: 3px solid #dee2e6;
}

.help-sidepanel .help-process-step-content h6 {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.help-sidepanel .help-process-step-content p {
    margin-bottom: 0;
    font-size: 0.8rem;
    line-height: 1.4;
}

.help-sidepanel .help-process-step-content ul {
    margin-bottom: 0;
    margin-top: 0.5rem;
    padding-left: 1rem;
}

.help-sidepanel .help-process-step-content li {
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.help-sidepanel .help-content .alert {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.help-sidepanel .help-content .alert h6 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Color variants for different step types */
.help-sidepanel .help-step-primary {
    border-left-color: var(--ai-assistant-primary-color, var(--bs-primary, #007bff));
}

.help-sidepanel .help-step-warning {
    border-left-color: var(--ai-assistant-warning-color, var(--bs-warning, #ffc107));
}

.help-sidepanel .help-step-info {
    border-left-color: var(--bs-info, #0dcaf0);
}

.help-sidepanel .help-step-success {
    border-left-color: var(--ai-assistant-success-color, var(--bs-success, #28a745));
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .help-sidepanel {
        width: 100vw !important;
        right: -100vw !important;
    }

    .help-sidepanel.help-open {
        right: 0 !important;
    }

    .help-sidepanel .help-process-step {
        flex-direction: column;
        text-align: center;
    }

    .help-sidepanel .help-process-step-icon {
        margin-right: 0;
        margin-bottom: 0.75rem;
    }
}