/**
 * ERPAthos Help Drawer Styles
 * Right-side sliding drawer for contextual help and application flow guides
 * 
 * Features:
 * - Mobile-first responsive design
 * - Fullscreen on mobile (< 768px)
 * - Right-side drawer on desktop (≥ 768px)
 * - Smooth slide-in animations
 * - Overlay backdrop
 * - Sticky header on mobile
 * - Internal scrolling
 * - ESC key support via JavaScript interop
 */

/* ========================================
 * DRAWER OVERLAY (backdrop)
 * ======================================== */
.help-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1049; /* Below modals (1050) but above content */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ========================================
 * HELP DRAWER - MOBILE FIRST (< 768px)
 * ======================================== */
.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bs-body-bg, #fff);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1050; /* Same as modal */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-drawer.open {
    transform: translateX(0);
}

/* ========================================
 * DRAWER HEADER
 * ======================================== */
.help-drawer-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background-color: var(--bs-body-bg, #fff);
    position: sticky;
    top: 0;
    z-index: 10;
}

.help-drawer-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--bs-body-color, #212529);
    display: flex;
    align-items: center;
}

.help-drawer-header .btn-close {
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
}

/* ========================================
 * DRAWER TABS
 * ======================================== */
.help-drawer-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background-color: var(--bs-light, #f8f9fa);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.help-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.help-tab:hover {
    background-color: var(--bs-primary, #007bff);
    color: #fff;
    border-color: var(--bs-primary, #007bff);
}

.help-tab.active {
    background-color: var(--bs-primary, #007bff);
    color: #fff;
    border-color: var(--bs-primary, #007bff);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.25);
}

/* ========================================
 * DRAWER CONTENT
 * ======================================== */
.help-drawer-content {
    flex: 1 1 auto;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Smooth scroll behavior */
.help-drawer-content::-webkit-scrollbar {
    width: 8px;
}

.help-drawer-content::-webkit-scrollbar-track {
    background: var(--bs-light, #f8f9fa);
}

.help-drawer-content::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400, #ced4da);
    border-radius: 4px;
}

.help-drawer-content::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500, #adb5bd);
}

/* ========================================
 * SEARCH TAB CONTENT
 * ======================================== */
.help-search-tab {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-search-result-item {
    padding: 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-search-result-item:hover {
    border-color: var(--bs-primary, #007bff);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.help-search-result-item h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-body-color, #212529);
}

.help-search-result-item p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--bs-gray-600, #6c757d);
    line-height: 1.5;
}

/* ========================================
 * RESPONSIVE - TABLET (768px - 1023px)
 * ======================================== */
@media (min-width: 768px) {
    .help-drawer {
        width: 480px;
        max-width: 95vw;
    }

    .help-drawer-title {
        font-size: 1.25rem;
    }

    .help-drawer-content {
        padding: 1.5rem;
    }
}

/* ========================================
 * RESPONSIVE - DESKTOP (≥ 1024px)
 * ======================================== */
@media (min-width: 1024px) {
    .help-drawer {
        width: 540px;
        max-width: 40vw;
    }

    .help-drawer-header {
        padding: 1.25rem 1.5rem;
    }

    .help-drawer-tabs {
        padding: 1rem 1.5rem;
    }

    .help-drawer-content {
        padding: 2rem 1.5rem;
    }

    .help-tab {
        font-size: 0.9375rem;
    }
}

/* ========================================
 * DARK MODE SUPPORT
 * ======================================== */
.dark-mode .help-drawer {
    background-color: var(--bs-dark, #212529);
    color: var(--bs-light, #f8f9fa);
}

.dark-mode .help-drawer-header {
    background-color: var(--bs-dark, #212529);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .help-drawer-title {
    color: var(--bs-light, #f8f9fa);
}

.dark-mode .help-drawer-tabs {
    background-color: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .help-tab {
    background-color: var(--bs-dark, #212529);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--bs-light, #f8f9fa);
}

.dark-mode .help-tab:hover,
.dark-mode .help-tab.active {
    background-color: var(--bs-primary, #007bff);
    border-color: var(--bs-primary, #007bff);
    color: #fff;
}

.dark-mode .help-drawer-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.dark-mode .help-drawer-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.dark-mode .help-drawer-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dark-mode .help-search-result-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .help-search-result-item:hover {
    border-color: var(--bs-primary, #007bff);
}

/* ========================================
 * ACCESSIBILITY
 * ======================================== */
.help-drawer:focus-visible {
    outline: 2px solid var(--bs-primary, #007bff);
    outline-offset: -2px;
}

.help-tab:focus-visible {
    outline: 2px solid var(--bs-primary, #007bff);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .help-drawer {
        border: 2px solid currentColor;
    }

    .help-tab {
        border-width: 2px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .help-drawer,
    .help-drawer-overlay,
    .help-tab {
        transition: none;
    }
}
