/* ============================================================
   KB Public Pages — Shared Styles
   Used by: kb-home, kb-category, kb-article, kb-search
   ============================================================ */

/* Hero Section */
.kb-hero {
    background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
}
.input-group-lg.kb-hero-search > .form-control {
    height: 52px;
    font-size: 1rem;
    padding: 0 1rem;
    border-radius: 4px 0 0 4px;
}
.input-group-lg.kb-hero-search > .input-group-append > .btn {
    height: 52px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 4px 4px 0;
}

/* Search Autocomplete Dropdown */
.kb-search-wrap {
    position: relative;
}
.kb-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.kb-search-dropdown.open {
    display: block;
    animation: kbAcFade 0.15s ease;
}
@keyframes kbAcFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Autocomplete items */
.kb-ac-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.1s;
}
/* Active/hover: the 4px left accent bar is the PRIMARY cue, not the background —
   #1565c0 vs white is ~5.7:1 (clears WCAG 1.4.11's 3:1 for non-text indicators),
   while any background wash calm enough for this surface cannot. Same device as
   the V3 conversation list's active indicator. Drawn as an inset box-shadow
   rather than a real border so rows don't shift 4px when highlighted.
   Hover and keyboard-active are identical on purpose: both mean "what Enter
   would pick". (Decision record: design_strategy.md, 2026-08-08.) */
.kb-ac-item:hover,
.kb-ac-item.active {
    background-color: #e8eef7;
    box-shadow: inset 4px 0 0 #1565c0;
    text-decoration: none;
    color: inherit;
}
.kb-ac-item .kb-ac-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: #212529;
    line-height: 1.3;
}
.kb-ac-item .kb-ac-title strong {
    font-weight: 700;
    color: #1565c0;
}
.kb-ac-item .kb-ac-category {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
/* #6c757d is already at AA's edge on white (4.7:1) and would drop to ~4.0:1 on
   the #e8eef7 highlight — darken it in the highlighted states only. */
.kb-ac-item:hover .kb-ac-category,
.kb-ac-item.active .kb-ac-category {
    color: #495057;
}

/* "View all results" footer */
.kb-ac-footer {
    display: block;
    padding: 10px 16px;
    text-align: center;
    font-size: 0.85rem;
    color: #1565c0;
    font-weight: 600;
    text-decoration: none;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    transition: background-color 0.1s;
}
.kb-ac-footer:hover,
.kb-ac-footer.active {
    background: #e8eef7;
    box-shadow: inset 4px 0 0 #1565c0; /* same accent as the items — one selection language */
    text-decoration: none;
    color: #0d47a1;
}

/* Loading state */
.kb-ac-loading {
    padding: 14px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
}
.kb-ac-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #dee2e6;
    border-top-color: #1565c0;
    border-radius: 50%;
    animation: kbSpin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes kbSpin {
    to { transform: rotate(360deg); }
}

/* Empty state */
.kb-ac-empty {
    padding: 14px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
}
.kb-ac-empty strong {
    color: #495057;
}

/* Category Cards */
.kb-category-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.kb-category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
}
.kb-category-card .material-symbols-outlined,
.kb-category-card .material-icons {
    font-size: 36px;
    color: #1565c0;
}
.kb-category-card .kb-cat-name {
    font-weight: 600;
    color: #212529;
    font-size: 0.95rem;
}
.kb-category-card .kb-cat-count {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Breadcrumbs */
.kb-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "\203A";
    color: #adb5bd;
}
.kb-breadcrumb a {
    text-decoration: none;
}
.kb-breadcrumb a:hover {
    text-decoration: underline;
}

/* ── Breadcrumb ON the blue hero (kb-search only) ──
   Scoped by ancestor, not a modifier class, so the base rules above stay untouched for
   kb-article/kb-category, which render their trails on WHITE. Verified: .kb-hero appears in
   only two .aspx (kb-search, index) and index's hero has no breadcrumb — so this cannot
   reach the sibling pages.

   Crumb colour is NOT here: Bootstrap's .text-white carries !important and beats .text-muted,
   so it's handled in markup. This rule is the only CSS the hero breadcrumb needs. A separator
   override used to sit here too; it went with the "Search results" crumb on 2026-07-15 —
   under the ancestors-only rule kb-search renders exactly ONE crumb, so an adjacent-sibling
   selector can never match. */
.kb-hero .kb-breadcrumb a {
    /* Marks the sole crumb as clickable against the gradient without relying on colour —
       there is no AA-safe faded white here (text-white-50 measures ~2.61-3.36:1, fails). */
    text-decoration: underline;
}

/* Article Prose (content body) */
.kb-article-prose {
    font-size: 1rem;
    line-height: 1.7;
    color: #343a40;
}
.kb-article-prose h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #212529;
}
.kb-article-prose h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #212529;
}
/* TOC links and #kb-heading-N URLs jump to these headings. The master's #navMain is
   fixed-top (68px min), so without this the heading lands underneath it. 80px matches
   the .kb-right-rail sticky offset and stays inside the scroll spy's 120px window. */
.kb-article-prose h2,
.kb-article-prose h3 {
    scroll-margin-top: 80px;
}
.kb-article-prose p {
    margin-bottom: 1rem;
}
.kb-article-prose img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}
.kb-article-prose pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
}
.kb-article-prose code {
    background: #f8f9fa;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.875em;
    color: #e83e8c;
}
.kb-article-prose pre code {
    background: none;
    padding: 0;
    color: inherit;
}
.kb-article-prose blockquote {
    border-left: 4px solid #1565c0;
    padding-left: 1rem;
    margin-left: 0;
    color: #495057;
    font-style: italic;
}
.kb-article-prose table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}
.kb-article-prose table th,
.kb-article-prose table td {
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}
.kb-article-prose table th {
    background: #f8f9fa;
    font-weight: 600;
}

/* Video Embeds */
.kb-video-embed {
    margin: 1.5rem 0;
    border-radius: 4px;
    overflow: hidden;
}
.kb-video-embed iframe {
    display: block;
    border: none;
}

/* Right rail (desktop): TOC + Related pinned as one block. The max-height keeps the
   rail inside the viewport and overflow-y lets it scroll on its own, so the bottom
   of Related Articles is always reachable even when the rail is taller than the screen. */
.kb-right-rail {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 80px - 1rem);
    overflow-y: auto;
}
.kb-toc-list li {
    margin-bottom: 0.35rem;
}
.kb-toc-list a {
    color: #6c757d;
    text-decoration: none;
    font-size: 0.85rem;
    display: block;
    padding: 0.15rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: color 0.15s, border-color 0.15s;
}
.kb-toc-list a:hover,
.kb-toc-list a.active {
    color: #1565c0;
    border-left-color: #1565c0;
}
.kb-toc-list .kb-toc-h3 {
    padding-left: 1.5rem;
}

/* Mobile TOC */
.kb-toc-mobile-toggle {
    cursor: pointer;
}

/* Helpful Widget */
.kb-feedback-panel {
    background: #f8f9fa;
}
.kb-feedback-panel .btn {
    min-width: 80px;
}

/* Search Results */
.kb-search-result {
    display: block;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.kb-search-result:hover {
    border-color: #1565c0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
}
.kb-search-result .kb-result-title {
    font-weight: 600;
    color: #1565c0;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.kb-search-result .kb-result-category {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.kb-search-result .kb-result-excerpt {
    font-size: 0.875rem;
    color: #495057;
    margin-top: 0.35rem;
}
.kb-search-result mark {
    background: #fff3cd;
    padding: 0.1rem 0.15rem;
    border-radius: 2px;
}

/* Comment Styles */
.kb-comment {
    border-left: 3px solid #e9ecef;
    padding-left: 1rem;
    margin-bottom: 1.25rem;
}
.kb-comment.kb-staff-reply {
    border-left-color: #1565c0;
    background: #f0f4ff;
    padding: 0.75rem 1rem;
    border-radius: 0 4px 4px 0;
}
.kb-comment-author {
    font-weight: 600;
    font-size: 0.9rem;
}
.kb-comment-date {
    font-size: 0.8rem;
    color: #6c757d;
}
.kb-comment-text {
    font-size: 0.9rem;
    margin-top: 0.35rem;
    color: #495057;
}
.kb-comment-replies {
    margin-left: 1.5rem;
    margin-top: 0.75rem;
}

/* Honeypot (spam) */
.kb-honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
}

/* Skeleton Loaders */
.kb-skeleton {
    background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: kb-shimmer 1.5s infinite;
    border-radius: 4px;
    height: 14px;
}
.kb-skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}
.kb-skeleton-line {
    height: 14px;
}
@keyframes kb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Article List Items (category page) */
.kb-article-list-item {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.1s;
}
.kb-article-list-item:hover {
    text-decoration: none;
    color: inherit;
    background-color: #f8f9fa;
}
.kb-article-list-item .kb-ali-title {
    font-weight: 600;
    color: #1565c0;
    font-size: 0.95rem;
}
.kb-article-list-item .kb-ali-meta {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.15rem;
}
/* Article summary under the title in category lists (source: MetaDescription).
   Its own class rather than reusing .kb-ali-meta: .kb-ali-meta is the geography
   applicability badge line (task feature_kb_article_region_tags — activated 2026-08-13
   after sitting dormant), and the two must be restylable independently.
   2-line clamp follows the working precedent at notification-system.css:427-435
   (.action-card-excerpt). The clamp is load-bearing, not cosmetic: MetaDescription's cap is
   160 chars, which fits ~2 lines at lg but overflows further at xs — the clamp is what holds
   the row height stable across viewports. -webkit-* is correct here despite the prefix:
   it's the de facto standard and works in every browser Bootstrap 4.6 targets. */
.kb-article-list-item .kb-ali-summary {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.4;
    margin-top: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Related Articles */
#kbRelatedList li,
#kbRelatedListMobile li {
    margin-bottom: 0.5rem;
}
#kbRelatedList a,
#kbRelatedListMobile a {
    color: #1565c0;
    font-size: 0.85rem;
    text-decoration: none;
}
#kbRelatedList a:hover,
#kbRelatedListMobile a:hover {
    text-decoration: underline;
}

/* Contain floated media (wrap-left/wrap-right images & videos) within the article body */
.kb-article-prose::after {
    content: "";
    display: block;
    clear: both;
}

/* ── KB List Visual Slot (category list, home cards, search results) ── */
.kb-list-visual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 6px;
    background-color: #f4f5f7;
    overflow: hidden;
    flex-shrink: 0;
}

.kb-list-visual-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.kb-list-visual-emoji {
    font-size: 22px;
    line-height: 1;
    display: block;
}

.kb-list-visual-fallback {
    font-size: 18px;
    color: #c4cad3;
}

/* ── Article list item: flex layout with visual slot (additive override —
     cascade beats the earlier display:block at equal specificity) ── */
.kb-article-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem;
}
.kb-article-list-item:hover,
.kb-article-list-item:focus-visible {
    background-color: #f8f9fa;
    text-decoration: none;
    color: inherit;
}
.kb-article-list-item:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: -2px;
}
.kb-ali-text {
    flex: 1;
    min-width: 0;
}

/* ── Article list skeleton state ── */
.kb-article-list-skeleton {
    pointer-events: none;
}
.kb-article-list-skeleton .kb-list-visual {
    background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: kb-shimmer 1.5s infinite;
}

/* ── Gap utility (Bootstrap 4 has no gap utilities) ── */
.gap-kb-card {
    gap: 0.75rem;
}

/* ── Home page card title ── */
.kb-home-card-title {
    font-size: 1rem;
    line-height: 1.35;
}

/* ── Support Ticket CTA — footer strip (KB home + category) ── */
/* Separator only. The button itself is Bootstrap's .btn.btn-outline-primary —
   see design_strategy_help_home_cta.md: green btn-success is reserved for the
   genuine dead-end (search no-results); outline-primary is the default
   available-action button everywhere else. The old .kb-support-link plain-text
   variant was removed 2026-07-15 when category adopted the button. */
.kb-support-footer {
    border-top: 1px solid #e9ecef;
}

/* ============================================================
   Region preference + geography badges
   (task feature_kb_article_region_tags, 2026-08-13)
   Neutral register throughout: this is an informative facet,
   never a warning — no green (spent on Search), no yellow
   (the admin Restricted register). Badge text is composed
   server-/shared-JS-side; these rules are placement only.
   ============================================================ */

/* Geography badge line — search results + article meta share the idiom the
   category list gets from .kb-article-list-item .kb-ali-meta. */
.kb-geo-badge {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.15rem;
}

/* "{N} articles are hidden…" disclosure — quiet single line above results;
   real prominence comes from position, not color. */
.kb-region-notice {
    border-bottom: 1px solid #f0f0f0;
}
.kb-region-notice a {
    color: #1565c0;
    text-decoration: underline;
}
