/* ============================================================
   HELP DOCUMENTATION — DEDICATED STYLESHEET
   CustomerPortal_LP — Saurashtra Freight Pvt. Ltd.
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --portal-primary-color: #e53935;
    --help-sidebar-w: 280px;
    --help-accent: var(--portal-primary-color, #e53935);
    --help-accent-hover: #d32f2f;
    --help-bg: #f8f9fb;
    --help-sidebar-bg: #ffffff;
    --help-content-bg: #ffffff;
    --help-border: #e2e6ed;
    --help-text: #2d3748;
    --help-text-muted: #718096;
    --help-heading: #1a202c;
    --help-code-bg: #f1f5f9;
    --help-tree-hover: #ffebee;
    --help-tree-active: #ffcdd2;
    --help-tree-active-text: #d32f2f;
    --help-screenshot-bg: #f0f4f8;
    --help-screenshot-border: #d0d7e2;
    --help-badge-bg: #ffebee;
    --help-badge-text: #e53935;
    --help-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --help-shadow-md: 0 4px 6px rgba(0, 0, 0, .05), 0 2px 4px rgba(0, 0, 0, .04);
    --help-radius: 8px;
    --help-radius-sm: 6px;
    --help-transition: .2s ease;
}

/* Dark mode overrides */
.dark-mode {
    --help-bg: #1a1e2e;
    --help-sidebar-bg: #1e2235;
    --help-content-bg: #232840;
    --help-border: #2d3350;
    --help-text: #c9d1d9;
    --help-text-muted: #8b949e;
    --help-heading: #e6edf3;
    --help-code-bg: #2d3350;
    --help-tree-hover: rgba(229, 57, 53, 0.15);
    --help-tree-active: rgba(229, 57, 53, 0.28);
    --help-tree-active-text: #ff6b6b;
    --help-screenshot-bg: #2d3350;
    --help-screenshot-border: #3d4560;
    --help-badge-bg: rgba(229, 57, 53, 0.2);
    --help-badge-text: #ff6b6b;
    --help-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    --help-shadow-md: 0 4px 6px rgba(0, 0, 0, .25);
}

/* ---------- Shell Layout ---------- */
.help-doc-shell {
    display: flex;
    min-height: calc(100vh - 57px);
    background: var(--help-bg);
}

/* ---------- Sidebar ---------- */
.help-doc-sidebar {
    position: sticky;
    top: 57px;
    width: var(--help-sidebar-w);
    min-width: var(--help-sidebar-w);
    height: calc(100vh - 57px);
    overflow-y: auto;
    background: var(--help-sidebar-bg);
    border-right: 1px solid var(--help-border);
    padding: 0;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: var(--help-border) transparent;
    transition: transform var(--help-transition);
}

.help-doc-sidebar::-webkit-scrollbar {
    width: 5px;
}

.help-doc-sidebar::-webkit-scrollbar-thumb {
    background: var(--help-border);
    border-radius: 10px;
}

/* Sidebar Header */
.help-doc-sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--help-border);
}

.help-doc-sidebar-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: .95rem;
    color: var(--help-heading);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-doc-sidebar-title i {
    color: var(--help-accent);
    font-size: 1.1rem;
}

/* Search */
.help-doc-search {
    position: relative;
}

.help-doc-search input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--help-border);
    border-radius: var(--help-radius-sm);
    font-size: .82rem;
    font-family: 'Roboto', sans-serif;
    color: var(--help-text);
    background: var(--help-bg);
    transition: border-color var(--help-transition), box-shadow var(--help-transition);
    outline: none;
}

.help-doc-search input:focus {
    border-color: var(--help-accent);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, .14);
}

.help-doc-search input::placeholder {
    color: var(--help-text-muted);
}

.help-doc-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--help-text-muted);
    font-size: .8rem;
    pointer-events: none;
}

/* Sidebar Tree */
.help-doc-tree {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.help-doc-tree-item {
    margin: 0;
}

.help-doc-tree-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 18px;
    color: var(--help-text);
    text-decoration: none;
    font-size: .83rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--help-transition);
    cursor: pointer;
    user-select: none;
}

.help-doc-tree-link:hover {
    background: var(--help-tree-hover);
    color: var(--help-text);
    text-decoration: none;
}

.help-doc-tree-link.is-active {
    background: var(--help-tree-active);
    color: var(--help-tree-active-text);
    border-left-color: var(--help-accent);
    font-weight: 600;
}

.help-doc-tree-link i.tree-icon {
    width: 18px;
    text-align: center;
    font-size: .85rem;
    color: var(--help-text-muted);
    flex-shrink: 0;
}

.help-doc-tree-link.is-active i.tree-icon {
    color: var(--help-tree-active-text);
}

/* Parent toggle arrow */
.help-doc-tree-toggle {
    margin-left: auto;
    font-size: .7rem;
    color: var(--help-text-muted);
    transition: transform .25s ease;
}

.help-doc-tree-item.is-open>.help-doc-tree-link .help-doc-tree-toggle {
    transform: rotate(90deg);
}

/* Sub-tree */
.help-doc-subtree {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.help-doc-tree-item.is-open>.help-doc-subtree {
    max-height: 600px;
}

.help-doc-subtree .help-doc-tree-link {
    padding-left: 46px;
    font-weight: 400;
    font-size: .8rem;
}

/* Section Labels (IMPORT / EXPORT) */
.help-doc-tree-label {
    padding: 14px 16px 6px 18px;
    font-size: .68rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--help-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* ---------- Content Area ---------- */
.help-doc-content {
    flex: 1;
    min-width: 0;
    padding: 32px 40px 60px;
    max-width: 900px;
}

/* Breadcrumb */
.help-doc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    color: var(--help-text-muted);
    margin-bottom: 24px;
    font-family: 'Roboto', sans-serif;
}

.help-doc-breadcrumb a {
    color: var(--help-accent);
    text-decoration: none;
}

.help-doc-breadcrumb a:hover {
    text-decoration: underline;
}

.help-doc-breadcrumb .sep {
    color: var(--help-border);
}

/* Section */
.help-doc-section {
    margin-bottom: 48px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--help-border);
    scroll-margin-top: 80px;
}

.help-doc-section:last-child {
    border-bottom: none;
}

.help-doc-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.help-doc-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--help-radius);
    background: var(--help-badge-bg);
    color: var(--help-badge-text);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.help-doc-section-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.45rem;
    color: var(--help-heading);
    margin: 0;
    line-height: 1.3;
}

.help-doc-section-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    background: var(--help-badge-bg);
    color: var(--help-badge-text);
    font-size: .7rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-left: 8px;
}

.help-doc-section-desc {
    color: var(--help-text);
    font-size: .92rem;
    line-height: 1.75;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 20px;
}

/* Sub-section (for sub-modules) */
.help-doc-subsection {
    margin: 28px 0 28px 0;
    padding: 24px;
    background: var(--help-bg);
    border-radius: var(--help-radius);
    border: 1px solid var(--help-border);
    scroll-margin-top: 80px;
}

.help-doc-subsection-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.help-doc-subsection-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--help-radius-sm);
    background: var(--help-badge-bg);
    color: var(--help-badge-text);
    font-size: .85rem;
    flex-shrink: 0;
}

.help-doc-subsection-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--help-heading);
    margin: 0;
}

.help-doc-subsection-desc {
    color: var(--help-text);
    font-size: .88rem;
    line-height: 1.7;
    font-family: 'Roboto', sans-serif;
    margin-bottom: 14px;
}

/* Steps */
.help-doc-steps {
    counter-reset: help-step;
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.help-doc-steps li {
    counter-increment: help-step;
    position: relative;
    padding: 8px 0 8px 40px;
    color: var(--help-text);
    font-size: .88rem;
    line-height: 1.6;
    font-family: 'Roboto', sans-serif;
}

.help-doc-steps li::before {
    content: counter(help-step);
    position: absolute;
    left: 0;
    top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--help-badge-bg);
    color: var(--help-badge-text);
    font-weight: 700;
    font-size: .78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

.help-doc-steps li strong {
    color: var(--help-heading);
}

/* Screenshot Placeholder */
.help-doc-screenshot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    margin: 20px 0;
    padding: 32px 24px;
    background: var(--help-screenshot-bg);
    border: 2px dashed var(--help-screenshot-border);
    border-radius: var(--help-radius);
    text-align: center;
    transition: border-color var(--help-transition);
}

.help-doc-screenshot:hover {
    border-color: var(--help-accent);
}

.help-doc-screenshot i {
    font-size: 2.2rem;
    color: var(--help-text-muted);
    margin-bottom: 12px;
    opacity: .5;
}

.help-doc-screenshot .help-doc-screenshot-label {
    font-size: .82rem;
    color: var(--help-text-muted);
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
}

.help-doc-screenshot .help-doc-screenshot-sub {
    font-size: .74rem;
    color: var(--help-text-muted);
    font-family: 'Roboto', sans-serif;
    margin-top: 4px;
    opacity: .7;
}

/* When a real image is present */
.help-doc-screenshot img {
    max-width: 100%;
    height: auto;
    border-radius: var(--help-radius-sm);
    box-shadow: var(--help-shadow-md);
}

.help-doc-screenshot.has-image {
    border-style: solid;
    border-width: 1px;
    padding: 12px;
    min-height: auto;
}

/* Info/Tip/Note boxes */
.help-doc-note {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--help-radius-sm);
    margin: 16px 0;
    font-size: .85rem;
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
}

.help-doc-note--info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.help-doc-note--tip {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    color: #166534;
}

.help-doc-note--warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.dark-mode .help-doc-note--info {
    background: #1e2a4a;
    border-left-color: #60a5fa;
    color: #93c5fd;
}

.dark-mode .help-doc-note--tip {
    background: #1a2e25;
    border-left-color: #4ade80;
    color: #86efac;
}

.dark-mode .help-doc-note--warning {
    background: #2e2a1a;
    border-left-color: #fbbf24;
    color: #fde68a;
}

.help-doc-note i {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Key-value feature list */
.help-doc-features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.help-doc-feature-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: var(--help-bg);
    border: 1px solid var(--help-border);
    border-radius: var(--help-radius-sm);
}

.help-doc-feature-card i {
    color: var(--help-accent);
    font-size: .9rem;
    margin-top: 3px;
    flex-shrink: 0;
}

.help-doc-feature-card strong {
    display: block;
    font-size: .84rem;
    color: var(--help-heading);
    margin-bottom: 2px;
}

.help-doc-feature-card span {
    font-size: .8rem;
    color: var(--help-text-muted);
    line-height: 1.5;
}

/* Table of Contents at top */
.help-doc-toc {
    background: var(--help-bg);
    border: 1px solid var(--help-border);
    border-radius: var(--help-radius);
    padding: 20px 24px;
    margin-bottom: 36px;
}

.help-doc-toc h3 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: .9rem;
    color: var(--help-heading);
    margin: 0 0 12px;
}

.help-doc-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 24px;
}

.help-doc-toc-list li {
    break-inside: avoid;
    margin-bottom: 6px;
}

.help-doc-toc-list a {
    color: var(--help-text);
    text-decoration: none;
    font-size: .84rem;
    font-family: 'Roboto', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    transition: color var(--help-transition);
}

.help-doc-toc-list a:hover {
    color: var(--help-accent);
}

.help-doc-toc-list a i {
    color: var(--help-accent);
    font-size: .75rem;
    width: 16px;
    text-align: center;
}

/* Mobile sidebar toggle */
.help-doc-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--help-accent);
    color: #fff;
    border: none;
    box-shadow: var(--help-shadow-md);
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background var(--help-transition);
}

.help-doc-mobile-toggle:hover {
    background: var(--help-accent-hover);
}

/* Mobile overlay */
.help-doc-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 99;
}

/* Back to top button */
.help-doc-back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--help-accent);
    color: #fff;
    border: none;
    box-shadow: var(--help-shadow-md);
    font-size: .9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--help-transition);
    z-index: 50;
}

.help-doc-back-top.is-visible {
    opacity: 1;
    visibility: visible;
}

.help-doc-back-top:hover {
    background: var(--help-accent-hover);
    transform: translateY(-2px);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .help-doc-content {
        padding: 24px 24px 48px;
    }

    .help-doc-toc-list {
        columns: 1;
    }
}

@media (max-width: 768px) {
    .help-doc-mobile-toggle {
        display: flex;
    }

    .help-doc-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: var(--help-shadow-md);
    }

    .help-doc-sidebar.is-open {
        transform: translateX(0);
    }

    .help-doc-sidebar-overlay.is-open {
        display: block;
    }

    .help-doc-content {
        padding: 20px 16px 48px;
    }

    .help-doc-section-title {
        font-size: 1.2rem;
    }

    .help-doc-features {
        grid-template-columns: 1fr;
    }

    .help-doc-subsection {
        padding: 16px;
    }
}

/* ---------- Print ---------- */
@media print {

    .help-doc-sidebar,
    .help-doc-mobile-toggle,
    .help-doc-back-top,
    .help-doc-sidebar-overlay {
        display: none !important;
    }

    .help-doc-content {
        max-width: 100%;
        padding: 0;
    }

    .help-doc-shell {
        display: block;
    }

    .help-doc-section {
        page-break-inside: avoid;
    }

    .help-doc-screenshot {
        border-style: solid;
    }
}

/* ---------- Smooth scroll ---------- */
html {
    scroll-behavior: smooth;
}

/* ---------- Portal public layout overrides for help page ---------- */
.portal-public-help .portal-content-wrapper,
.portal-public-help .content-wrapper {
    margin-left: 0 !important;
}

.portal-public-help .main-sidebar {
    display: none !important;
}

.portal-public-help .portal-page-shell {
    padding: 0;
    max-width: none;
}

.portal-public-help .content.pt-3,
.portal-public-help .content.pt-1 {
    padding-top: 0 !important;
}

/* ---------- Lightbox Popup Modal & Multi-Image Gallery ---------- */
.help-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.help-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.help-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.help-lightbox-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    max-width: 94vw;
    max-height: 94vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.help-lightbox-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(30, 41, 59, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.help-lightbox-counter {
    font-size: .78rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    background: rgba(229, 57, 53, 0.2);
    color: #ff6b6b;
    padding: 3px 10px;
    border-radius: 12px;
    flex-shrink: 0;
}

.help-lightbox-caption {
    font-size: .88rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    color: #e2e8f0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.help-lightbox-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.help-lightbox-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.help-lightbox-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 200px;
    background: #090d16;
}

.help-lightbox-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 88vw;
    max-height: 80vh;
    overflow: hidden;
}

.help-lightbox-image-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.help-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(30, 41, 59, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.help-lightbox-nav:hover {
    background: var(--portal-primary-color, #e53935);
    border-color: var(--portal-primary-color, #e53935);
    transform: translateY(-50%) scale(1.08);
}

.help-lightbox-prev { left: 20px; }
.help-lightbox-next { right: 20px; }

.help-lightbox-nav.is-hidden {
    display: none !important;
}

/* Zoomable Images */
.help-doc-zoomable,
.help-doc-screenshot.has-image img,
.help-doc-gallery-item img {
    cursor: zoom-in;
    transition: transform .2s ease, box-shadow .2s ease;
}

.help-doc-zoomable:hover,
.help-doc-screenshot.has-image:hover img,
.help-doc-gallery-item:hover img {
    transform: scale(1.01);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.help-doc-screenshot-hint {
    font-size: .74rem;
    color: var(--help-text-muted);
    font-family: 'Roboto', sans-serif;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: .8;
}

/* Gallery Grid for Multi-Image Support */
.help-doc-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.help-doc-gallery-item {
    background: var(--help-screenshot-bg);
    border: 1px solid var(--help-screenshot-border);
    border-radius: var(--help-radius);
    padding: 10px;
    text-align: center;
    transition: all var(--help-transition);
}

.help-doc-gallery-item:hover {
    border-color: var(--help-accent);
    transform: translateY(-2px);
    box-shadow: var(--help-shadow-md);
}

.help-doc-gallery-item img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: var(--help-radius-sm);
}

.help-doc-gallery-caption {
    font-size: .78rem;
    color: var(--help-text);
    font-weight: 500;
    margin-top: 8px;
    font-family: 'Roboto', sans-serif;
}