/**
 * BaseCRM - Help Page Styles
 *
 * Dedicated styles for help center and documentation pages
 */

/* ==========================================
   HELP HERO SECTION
   ========================================== */

.help-hero {
    background: var(--gradient-3);
    padding: 140px 0 80px 0;
    margin-bottom: 3rem;
    color: #fff;
}

.help-hero h1 {
    color: #fff;
    margin-bottom: 1rem;
}

.help-hero .lead {
    color: rgba(255, 255, 255, 0.9);
}

.help-search-box {
    position: relative;
    max-width: 600px;
    margin: 2rem auto 0;
}

.help-search-box i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.help-search-box input {
    padding: 1rem 3rem 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    box-shadow: var(--shadow-lg);
}

/* ==========================================
   SEARCH RESULTS DROPDOWN
   ========================================== */

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.search-results-header {
    padding: 1rem 1.5rem;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--neutral-dark);
    border-radius: 16px 16px 0 0;
    font-size: 0.9rem;
}

.search-results-list {
    padding: 0.5rem;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.search-result-item:hover {
    background: var(--bg-page);
    border-color: #3369bd;
    transform: translateX(-3px);
}

.search-result-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.search-result-content {
    flex-grow: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    color: var(--neutral-dark);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.search-result-title mark {
    background-color: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: 700;
}

.search-result-category {
    font-size: 0.85rem;
    color: var(--primary-purple);
    margin-bottom: 0.5rem;
}

.search-result-snippet {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-snippet mark {
    background-color: #fff3cd;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    font-weight: 600;
}

.search-result-arrow {
    font-size: 1.2rem;
    color: var(--primary-purple);
    flex-shrink: 0;
}

.search-loading,
.search-no-results,
.search-error {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.search-loading i,
.search-no-results i,
.search-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    /* #3369bd, not var(--primary-blue): that variable lives in homepage.css and
       is #4ECDC4 — TURQUOISE, a marketing FILL. As ink on white it measures
       1.93:1, under the 3:1 floor for a graphic, so this icon was invisible.
       #3369bd is --primary-color and measures 5.39:1. */
    color: #3369bd;
}

.search-loading i {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.search-no-results p,
.search-error p {
    font-weight: 600;
    color: var(--neutral-dark);
    margin-bottom: 0.5rem;
}

.search-no-results small {
    color: var(--text-secondary);
}

/* Scrollbar for search results */
.search-results-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: var(--bg-page);
    border-radius: 0 16px 16px 0;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==========================================
   CATEGORY CARDS
   ========================================== */

.category-card {
    display: block;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--animation-easing);
    border: 2px solid transparent;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-purple);
    color: inherit;
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.category-icon-large {
    font-size: 3.5rem;
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--neutral-dark);
}

.category-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.category-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-purple);
    font-weight: 600;
    font-size: 0.9rem;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-3);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ==========================================
   DOCUMENTS LIST
   ========================================== */

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.document-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--animation-easing);
    border: 1px solid var(--border-color);
}

.document-card:hover {
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
    border-color: #3369bd;
    color: inherit;
}

.document-icon {
    font-size: 2rem;
    /* Was var(--primary-blue) = #4ECDC4 turquoise: 1.93:1 on white, under the
       3:1 floor for a 32px graphic. See the note on .search-error i above. */
    color: #3369bd;
    flex-shrink: 0;
}

.document-content {
    flex-grow: 1;
}

.document-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--neutral-dark);
}

.document-description {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

.document-arrow {
    font-size: 1.5rem;
    color: var(--primary-purple);
    flex-shrink: 0;
}

/* ==========================================
   ALL GUIDES (help index) — the crawlable list
   ========================================== */

.help-all-docs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem 2rem;
    margin-top: 1rem;
}

.help-all-docs__group {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.help-all-docs__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--neutral-dark);
    margin: 0 0 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.help-all-docs__icon {
    font-size: 1.35rem;
    line-height: 1;
}

.help-all-docs__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-all-docs__item + .help-all-docs__item {
    margin-top: 0.15rem;
}

/* The whole row is the target, not just the words — a 15px line of Hebrew is a
   thin thing to hit on a phone. Grow the element, not the text.
   🔴 No `color` here on purpose: homepage.css paints
   `section:not(…) a:not(…)…` at #0a58ca with specificity (0,6,2), which buries
   anything this file can say at (0,1,1). Declaring a colour here would look
   correct in the stylesheet and change nothing on screen — so the links take the
   site's standard in-content blue, which is what every other list does. */
.help-all-docs__item a {
    display: block;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: background-color 0.2s var(--animation-easing);
}

.help-all-docs__item a:hover,
.help-all-docs__item a:focus-visible {
    background: rgba(10, 88, 202, 0.08);
    text-decoration: underline;
}

@media (max-width: 575.98px) {
    .help-all-docs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .help-all-docs__group {
        padding: 1rem 1.1rem;
    }
}

/* ==========================================
   DOCUMENT VIEWER
   ========================================== */

.help-document {
    padding-top: 120px;
    min-height: 100vh;
}

.doc-sidebar {
    position: sticky;
    top: 140px;
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.sidebar-title {
    font-weight: 700;
    color: var(--neutral-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.doc-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-nav-list li {
    margin-bottom: 0.5rem;
}

.doc-nav-list li a {
    position: relative;
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 0.95rem;
}

.doc-nav-list li a:hover {
    background: var(--bg-page);
    color: var(--primary-color, var(--primary-purple));
}

.doc-nav-list li.active a {
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
}

.doc-nav-list li.active a::before {
    content: "";
    position: absolute;
    inset-inline-end: -4px;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 3px;
    background: var(--primary-color, var(--primary-purple));
    border-radius: 2px;
}

/* ==========================================
   MARKDOWN CONTENT STYLES
   ========================================== */

.document-content {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
}

.markdown-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--neutral-dark);
    line-height: 1.3;
}

.markdown-body h1 {
    font-size: 2.5rem;
    border-bottom: 3px solid var(--primary-purple);
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.markdown-body h2 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.markdown-body h3 {
    font-size: 1.5rem;
}

.markdown-body h4 {
    font-size: 1.25rem;
}

.markdown-body p {
    margin-bottom: 1.25rem;
}

.markdown-body a {
    /* Renders #0a58ca today only because homepage.css's `section … a:not(…)`
       rule outweighs this one. The moment that rule changes, every link in
       every guide turns #4ECDC4 turquoise at 1.93:1. Stated correctly here. */
    color: #3369bd;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.markdown-body a:hover {
    color: var(--primary-purple);
    border-bottom-color: var(--primary-purple);
}

/* Code Blocks */
.markdown-body code {
    background: var(--bg-page);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.markdown-body pre {
    background: #2D3142;
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-md);
}

.markdown-body pre code {
    background: none;
    color: #fff;
    padding: 0;
    font-size: 0.95rem;
}

/* Lists */
.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.25rem;
    padding-right: 2rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body ul ul,
.markdown-body ol ol {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Tables */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
    overflow: hidden;
}

.markdown-body th {
    background: var(--gradient-3);
    color: #fff;
    padding: 1rem;
    text-align: right;
    font-weight: 600;
}

.markdown-body td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.markdown-body tr:hover {
    background: var(--bg-page);
}

/* Blockquotes */
.markdown-body blockquote {
    border-right: 4px solid #3369bd;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--bg-page);
    border-radius: 8px;
    font-style: italic;
}

.markdown-body blockquote p:last-child {
    margin-bottom: 0;
}

/* Images */
.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin: 1.5rem 0;
}

/* ==========================================
   "START HERE" BANNER ON THE HELP CENTER INDEX
   ==========================================
   🔴 Not styled through .category-card: the index's search JS hides every
   element carrying that class while filtering, and this banner must stay.
   ========================================== */

.help-start-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem;
    margin-bottom: 2.5rem;
    border-radius: 16px;
    /* 🔴 Literal hexes, and NOT var(--primary-blue)/var(--primary-purple).
       Those live in homepage.css, where --primary-blue is #4ECDC4 — TURQUOISE,
       a FILL from the marketing palette, not the brand blue this card's own
       box-shadow (rgba(59,125,216,…)) was written for. White on #4ECDC4 measures
       1.93:1. The card was unreadable at its light end whichever ink won.
       #3369bd is --primary-color in design-tokens.css and #764ba2 is the site's
       --gradient-hero purple: white measures 5.39:1 / 6.04:1 / 6.37:1 across
       start, midpoint and end, so every point of the gradient clears AA. */
    background: linear-gradient(135deg, #3369bd, #764ba2);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(59, 125, 216, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.help-start-card:hover,
.help-start-card:focus-visible {
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(59, 125, 216, 0.32);
}

.help-start-card:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
}

.help-start-card__icon {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.help-start-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.help-start-card__eyebrow {
    font-size: 0.85rem;
    font-weight: 600;
    /* No opacity here on purpose: at 0.85 this measured 4.40:1 on the light end
       of the gradient — under the 4.5 floor for 13.6px text, and invisible to
       review because getComputedStyle still reports a pure white `color`.
       Size and weight already carry the hierarchy. */
}

.help-start-card__title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.3;
}

.help-start-card__desc {
    font-size: 0.95rem;
    line-height: 1.5;
}

.help-start-card__chev {
    font-size: 1.5rem;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .help-start-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem;
    }
    .help-start-card__chev { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .help-start-card { transition: none; }
    .help-start-card:hover { transform: none; }
}

/* ==========================================
   CTA BUTTONS INSIDE A GUIDE
   ==========================================
   Parsedown runs in safe mode, so a guide cannot write its own HTML. A paragraph
   that is nothing but a link into the app gets tagged .help-cta / .help-cta-btn
   by MarkdownParser::markCtaLinks(). That method decides WHICH paragraphs
   qualify; this block decides only how they look — keep the split.

   Specificity note: .markdown-body .help-cta-btn (0,2,0) beats .markdown-body a
   (0,1,1) on its own, so none of this needs !important.
   ========================================== */

.markdown-body .help-cta {
    margin: 1.25rem 0 1.75rem;
}

.markdown-body .help-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.6rem;
    min-height: 44px;                 /* touch target — IS 5568 / WCAG 2.5.8 */
    border: 0;
    border-bottom: 0;                 /* cancels the underline .markdown-body a draws on hover */
    border-radius: 999px;
    /* --primary-blue is the marketing palette's TEAL on this page, which reads as
       an accent rather than an action. Purple is the site's own link-action
       colour (the H1 rule, the nav's outline buttons), so a CTA in it looks
       native instead of imported from the app. */
    background: var(--primary-purple);
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.4;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(157, 78, 221, 0.3);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* The arrow points at the end of the reading direction — left in Hebrew. */
.markdown-body .help-cta-btn::after {
    content: "\2190";
    font-size: 1.1em;
    line-height: 1;
}

[dir="ltr"] .markdown-body .help-cta-btn::after {
    content: "\2192";
}

.markdown-body .help-cta-btn:hover,
.markdown-body .help-cta-btn:focus-visible {
    /* 🔴 This used to hover to var(--primary-blue) — the TEAL the comment four
       rules above rejects for the rest state — and kept the white label, so the
       button measured 1.93:1 exactly when you pointed at it. A hover darkens the
       fill, it does not change its hue: #764ba2 is the site's --gradient-hero
       purple and takes white at 6.37:1, up from 4.60:1 at rest. */
    background: #764ba2;
    color: #fff;
    border-bottom: 0;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(157, 78, 221, 0.38);
}

.markdown-body .help-cta-btn:focus-visible {
    outline: 3px solid #f59e0b;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .markdown-body .help-cta-btn {
        transition: none;
    }
    .markdown-body .help-cta-btn:hover {
        transform: none;
    }
}

/* Horizontal Rules */
.markdown-body hr {
    border: none;
    height: 2px;
    background: linear-gradient(to left, transparent, var(--primary-purple), transparent);
    margin: 2.5rem 0;
}

/* ==========================================
   DOCUMENT NAVIGATION (PREV/NEXT)
   ========================================== */

.doc-navigation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.doc-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--animation-easing);
}

.doc-nav-link:hover {
    border-color: var(--primary-purple);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    color: inherit;
}

.doc-nav-link.prev {
    justify-content: flex-start;
}

.doc-nav-link.next {
    justify-content: flex-end;
    text-align: left;
}

.doc-nav-link i {
    font-size: 1.5rem;
    color: var(--primary-purple);
}

.doc-nav-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.doc-nav-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.doc-nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--neutral-dark);
}

/* ==========================================
   BREADCRUMB CUSTOMIZATION
   ========================================== */

.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "◄";
    color: var(--text-secondary);
}

.breadcrumb-item a {
    /* Same landmine as .markdown-body a — buried by homepage.css today. */
    color: #3369bd;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary-purple);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 991px) {
    .help-hero {
        padding: 120px 0 60px 0;
    }

    .help-document {
        padding-top: 100px;
    }

    .doc-sidebar {
        display: none;
    }

    .document-content {
        padding: 1.5rem;
    }

    .markdown-body h1 {
        font-size: 2rem;
    }

    .markdown-body h2 {
        font-size: 1.75rem;
    }

    .category-card {
        padding: 1.5rem;
    }

    .document-card {
        padding: 1rem;
    }
}

@media (max-width: 575px) {
    .help-hero {
        padding: 100px 0 40px 0;
    }

    .help-search-box {
        margin: 1rem auto 0;
    }

    .help-search-box input {
        padding: 0.875rem 3rem 0.875rem 1rem;
        font-size: 1rem;
    }

    .category-icon {
        font-size: 2.5rem;
    }

    .category-title {
        font-size: 1.25rem;
    }

    .document-content {
        padding: 1rem;
    }

    .markdown-body {
        font-size: 1rem;
    }

    .markdown-body h1 {
        font-size: 1.75rem;
    }

    .markdown-body h2 {
        font-size: 1.5rem;
    }

    .markdown-body pre {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .doc-nav-link {
        padding: 1rem;
    }

    .doc-nav-title {
        font-size: 0.95rem;
    }
}

/* ==========================================
   UTILITIES
   ========================================== */

.text-gradient {
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-hover {
    transition: all 0.3s var(--animation-easing);
}

.shadow-hover:hover {
    box-shadow: var(--shadow-lg);
}
