/**
 * BriskDesk — Knowledge Base template styles.
 *
 * Extracted from the server-rendered KB templates and enqueued via
 * wp_enqueue_style('briskdesk-kb-templates') in class-briskdesk.php so no raw
 * <style> blocks ship in the templates (WordPress.org enqueue requirement).
 * All selectors are .briskdesk-scoped; safe to load on every KB page.
 */

/* ============================================================
   Knowledge Base index / [briskdesk_kb] shortcode page
   ============================================================ */
    /* Force full-width content on the KB page */
    .briskdesk-kb-wrap { width: 100%; max-width: 100%; margin: 0 auto; padding: 0; }
    /* Hide any theme sidebar that might still render */
    body.briskdesk-kb-page .widget-area,
    body.briskdesk-kb-page aside.sidebar,
    body.briskdesk-kb-page #secondary { display: none !important; }
    /* Expand the content area to full width */
    body.briskdesk-kb-page .content-area,
    body.briskdesk-kb-page .site-content,
    body.briskdesk-kb-page .site-main,
    body.briskdesk-kb-page #primary { width: 100% !important; max-width: 100% !important; float: none !important; margin: 0 !important; padding: 0 !important; }

/* ============================================================
   Single KB article
   ============================================================ */
    /* ── Full-width override ───────────────────────────────── */
    .briskdesk-kb-wrap { width: 100%; max-width: 100%; margin: 0 auto; padding: 0; }
    body.briskdesk-kb-page .widget-area,
    body.briskdesk-kb-page aside.sidebar,
    body.briskdesk-kb-page #secondary { display: none !important; }
    body.briskdesk-kb-page .content-area,
    body.briskdesk-kb-page .site-content,
    body.briskdesk-kb-page .site-main,
    body.briskdesk-kb-page #primary { width: 100% !important; max-width: 100% !important; float: none !important; margin: 0 !important; padding: 0 !important; }

    /* ── 3-column layout ───────────────────────────────────── */
    .briskdesk-kb-layout {
        max-width: 1280px; margin: 0 auto; padding: 0 24px;
        display: grid;
        grid-template-columns: 280px 1fr 250px;
        gap: 32px;
        align-items: start;
        min-height: 100vh;
    }

    /* ── Left sidebar ──────────────────────────────────────── */
    .briskdesk-kb-sidebar-left {
        position: sticky; top: var(--briskdesk-header-offset, 32px);
        padding: 24px 0;
        max-height: calc(100vh - var(--briskdesk-header-offset, 32px) - 16px);
        overflow-y: auto;
    }

    /* Sidebar nav */
    .briskdesk-sidebar-nav details { border-bottom: 1px solid #f1f5f9; }
    .briskdesk-sidebar-nav details:last-child { border-bottom: none; }
    .briskdesk-sidebar-nav summary {
        list-style: none; cursor: pointer;
        display: flex; align-items: center; justify-content: space-between;
        padding: 12px 12px; font-size: 15px; font-weight: 700;
        color: #1e293b; transition: color .15s ease;
        -webkit-user-select: none; user-select: none;
    }
    .briskdesk-sidebar-nav summary::-webkit-details-marker { display: none; }
    .briskdesk-sidebar-nav summary:hover { color: #059669; }
    .briskdesk-sidebar-nav summary .briskdesk-chev {
        width: 18px; height: 18px; flex-shrink: 0; color: #94a3b8;
        transition: transform .2s ease;
    }
    .briskdesk-sidebar-nav details[open] > summary .briskdesk-chev {
        transform: rotate(90deg);
    }

    .briskdesk-sidebar-articles {
        list-style: none; margin: 0 0 8px; padding: 0;
    }
    .briskdesk-sidebar-articles li a {
        display: block; padding: 6px 12px 6px 32px;
        font-size: 14px; color: #475569; text-decoration: none;
        border-radius: 6px; transition: background .12s ease, color .12s ease;
        line-height: 1.5;
    }
    .briskdesk-sidebar-articles li a:hover {
        background: #f1f5f9; color: #1e293b;
    }
    .briskdesk-sidebar-articles li a.briskdesk-sidebar-active {
        background: #dcfce7; color: #166534; font-weight: 600;
    }

    /* Child categories in sidebar */
    .briskdesk-sidebar-sub-cat {
        display: block; font-size: 13px; font-weight: 600; color: #64748b;
        padding: 8px 12px 4px 24px; margin: 0;
        text-transform: uppercase; letter-spacing: .03em;
        text-decoration: none;
    }
    a.briskdesk-sidebar-sub-cat:hover { color: #059669; }

    /* ── Center content ────────────────────────────────────── */
    .briskdesk-kb-main { padding: 32px 0 80px; min-width: 0; }

    /* Breadcrumbs */
    .briskdesk-breadcrumbs {
        display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
        margin-bottom: 24px; font-size: 14px; color: #64748b;
    }
    .briskdesk-breadcrumbs a { color: #3b82f6; text-decoration: none; }
    .briskdesk-breadcrumbs a:hover { color: #1d4ed8; text-decoration: underline; }
    .briskdesk-breadcrumbs .briskdesk-bc-sep { color: #cbd5e1; }
    .briskdesk-breadcrumbs .briskdesk-bc-current { color: #1e293b; font-weight: 600; }

    /* Article header */
    .briskdesk-article-title {
        font-size: 30px; font-weight: 700; line-height: 1.3;
        color: #1e293b; margin: 0 0 16px;
    }
    .briskdesk-article-meta {
        display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
        font-size: 13px; color: #64748b; margin-bottom: 28px;
    }
    .briskdesk-article-meta span { display: flex; align-items: center; gap: 5px; }
    .briskdesk-article-meta svg { flex-shrink: 0; }

    /* Article body */
    .briskdesk-article-body {
        color: #1e293b; line-height: 1.75; font-size: 16px;
    }
    .briskdesk-article-body h2 { font-size: 22px; font-weight: 700; margin: 36px 0 14px; color: #1e293b; }
    .briskdesk-article-body h3 { font-size: 18px; font-weight: 700; margin: 28px 0 10px; color: #1e293b; }
    .briskdesk-article-body h4 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; color: #1e293b; }
    .briskdesk-article-body p { margin: 0 0 16px; }
    .briskdesk-article-body a { color: #059669; text-decoration: underline; }
    .briskdesk-article-body a:hover { color: #047857; }
    .briskdesk-article-body ul, .briskdesk-article-body ol { margin: 0 0 16px; padding-left: 24px; }
    .briskdesk-article-body li { margin-bottom: 6px; }
    .briskdesk-article-body pre {
        background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
        padding: 16px; overflow-x: auto; font-size: 14px; margin: 0 0 16px;
    }
    .briskdesk-article-body code { background: #f1f5f9; border-radius: 3px; padding: 2px 6px; font-size: 14px; }
    .briskdesk-article-body pre code { background: none; padding: 0; }
    .briskdesk-article-body blockquote {
        border-left: 4px solid #059669; margin: 0 0 16px;
        padding: 12px 20px; background: #f0fdf4; color: #374151;
    }
    .briskdesk-article-body img { max-width: 100%; height: auto; border-radius: 6px; }
    .briskdesk-article-body table { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
    .briskdesk-article-body th, .briskdesk-article-body td { border: 1px solid #e2e8f0; padding: 10px 14px; text-align: left; }
    .briskdesk-article-body th { background: #f8fafc; font-weight: 600; }

    /* Article interactive */
    .briskdesk-article-interactive { margin-top: 40px; }

    /* ── Right sidebar (TOC) ───────────────────────────────── */
    .briskdesk-kb-sidebar-right {
        position: sticky; top: var(--briskdesk-header-offset, 32px);
        padding: 24px 0;
    }

    /* ── Responsive ────────────────────────────────────────── */
    @media (max-width: 1100px) {
        .briskdesk-kb-layout {
            grid-template-columns: 260px 1fr;
        }
        .briskdesk-kb-sidebar-right { display: none; }
    }
    @media (max-width: 768px) {
        .briskdesk-kb-layout {
            grid-template-columns: 1fr;
            padding: 0 16px;
        }
        .briskdesk-kb-sidebar-left { display: none; }
        .briskdesk-kb-main { padding: 20px 0 60px; }
        .briskdesk-article-title { font-size: 24px; }
    }

/* ============================================================
   KB category (taxonomy) archive
   ============================================================ */
    /* ── Full-width override ───────────────────────────────── */
    .briskdesk-kb-wrap { width: 100%; max-width: 100%; margin: 0 auto; padding: 0; }
    body.briskdesk-kb-page .widget-area,
    body.briskdesk-kb-page aside.sidebar,
    body.briskdesk-kb-page #secondary { display: none !important; }
    body.briskdesk-kb-page .content-area,
    body.briskdesk-kb-page .site-content,
    body.briskdesk-kb-page .site-main,
    body.briskdesk-kb-page #primary { width: 100% !important; max-width: 100% !important; float: none !important; margin: 0 !important; padding: 0 !important; }

    /* ── 3-column layout ───────────────────────────────────── */
    .briskdesk-kb-layout {
        max-width: 1280px; margin: 0 auto; padding: 0 24px;
        display: grid;
        grid-template-columns: 280px 1fr 250px;
        gap: 32px;
        align-items: start;
        min-height: 100vh;
    }

    /* ── Left sidebar ──────────────────────────────────────── */
    .briskdesk-kb-sidebar-left {
        position: sticky; top: var(--briskdesk-header-offset, 32px);
        padding: 24px 0;
        max-height: calc(100vh - var(--briskdesk-header-offset, 32px) - 16px);
        overflow-y: auto;
    }

    .briskdesk-sidebar-nav details { border-bottom: 1px solid #f1f5f9; }
    .briskdesk-sidebar-nav details:last-child { border-bottom: none; }
    .briskdesk-sidebar-nav summary {
        list-style: none; cursor: pointer;
        display: flex; align-items: center; justify-content: space-between;
        padding: 12px 12px; font-size: 15px; font-weight: 700;
        color: #1e293b; transition: color .15s ease;
        -webkit-user-select: none; user-select: none;
    }
    .briskdesk-sidebar-nav summary::-webkit-details-marker { display: none; }
    .briskdesk-sidebar-nav summary:hover { color: #059669; }
    .briskdesk-sidebar-nav summary .briskdesk-chev {
        width: 18px; height: 18px; flex-shrink: 0; color: #94a3b8;
        transition: transform .2s ease;
    }
    .briskdesk-sidebar-nav details[open] > summary .briskdesk-chev {
        transform: rotate(90deg);
    }

    .briskdesk-sidebar-articles {
        list-style: none; margin: 0 0 8px; padding: 0;
    }
    .briskdesk-sidebar-articles li a {
        display: block; padding: 6px 12px 6px 32px;
        font-size: 14px; color: #475569; text-decoration: none;
        border-radius: 6px; transition: background .12s ease, color .12s ease;
        line-height: 1.5;
    }
    .briskdesk-sidebar-articles li a:hover {
        background: #f1f5f9; color: #1e293b;
    }
    .briskdesk-sidebar-articles li a.briskdesk-sidebar-active {
        background: #dcfce7; color: #166534; font-weight: 600;
    }

    /* Nested subcategory inside a parent <details>. Visually offset so the
       hierarchy reads as "this is a child of the open category". */
    .briskdesk-sidebar-nav details.briskdesk-sidebar-subdetails {
        border-bottom: none;
        margin: 0 0 4px 12px;
        border-left: 2px solid #e2e8f0;
    }
    .briskdesk-sidebar-nav details.briskdesk-sidebar-subdetails > summary {
        padding: 8px 12px 8px 16px;
        font-size: 13px;
        font-weight: 600;
        color: #64748b;
    }
    .briskdesk-sidebar-nav details.briskdesk-sidebar-subdetails > summary:hover { color: #059669; }
    .briskdesk-sidebar-nav details.briskdesk-sidebar-subdetails > summary .briskdesk-chev {
        width: 14px; height: 14px;
    }
    .briskdesk-sidebar-nav details.briskdesk-sidebar-subdetails .briskdesk-sidebar-articles li a {
        padding-left: 40px;
    }

    /* ── Center content ────────────────────────────────────── */
    .briskdesk-kb-main { padding: 32px 0 80px; min-width: 0; }

    /* Breadcrumbs */
    .briskdesk-breadcrumbs {
        display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
        margin-bottom: 24px; font-size: 14px; color: #64748b;
    }
    .briskdesk-breadcrumbs a { color: #3b82f6; text-decoration: none; }
    .briskdesk-breadcrumbs a:hover { color: #1d4ed8; text-decoration: underline; }
    .briskdesk-breadcrumbs .briskdesk-bc-sep { color: #cbd5e1; }
    .briskdesk-breadcrumbs .briskdesk-bc-current { color: #1e293b; font-weight: 600; }

    /* Category header */
    .briskdesk-cat-header { margin-bottom: 28px; }
    .briskdesk-cat-title {
        font-size: 30px; font-weight: 700; line-height: 1.3;
        color: #1e293b; margin: 0 0 10px;
    }
    .briskdesk-cat-description { font-size: 15px; line-height: 1.6; color: #64748b; margin: 0; }

    /* Child categories row */
    .briskdesk-cat-children { margin-bottom: 32px; }
    .briskdesk-cat-children-heading {
        font-size: 13px; font-weight: 700; text-transform: uppercase;
        letter-spacing: .04em; color: #64748b; margin: 0 0 12px;
    }
    .briskdesk-cat-children-grid { display: flex; flex-wrap: wrap; gap: 12px; }
    .briskdesk-child-chip {
        display: inline-flex; align-items: center; gap: 8px;
        background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
        padding: 10px 16px; text-decoration: none; color: #166534;
        font-size: 14px; font-weight: 600;
        transition: background .15s ease, border-color .15s ease;
    }
    .briskdesk-child-chip:hover { background: #dcfce7; border-color: #86efac; }
    .briskdesk-child-chip-count {
        background: #16a34a; color: #fff; border-radius: 50%;
        width: 22px; height: 22px; display: flex; align-items: center;
        justify-content: center; font-size: 11px; font-weight: 700;
    }

    /* Article list */
    .briskdesk-cat-articles-heading {
        font-size: 13px; font-weight: 700; text-transform: uppercase;
        letter-spacing: .04em; color: #64748b; margin: 0 0 14px;
    }
    .briskdesk-articles-list { list-style: none; margin: 0; padding: 0; }
    .briskdesk-article-item {
        border-bottom: 1px solid #f1f5f9;
    }
    .briskdesk-article-item:last-child { border-bottom: none; }
    .briskdesk-article-item a {
        display: flex; align-items: center; gap: 12px;
        padding: 14px 8px; text-decoration: none; color: inherit;
        border-radius: 6px; transition: background .12s ease;
    }
    .briskdesk-article-item a:hover { background: #f8fafc; }
    .briskdesk-article-item a svg {
        flex-shrink: 0; width: 18px; height: 18px; color: #94a3b8;
    }
    .briskdesk-article-item-info { min-width: 0; flex: 1; }
    .briskdesk-article-item-title {
        font-size: 16px; font-weight: 600; color: #1e293b; margin: 0 0 4px;
        line-height: 1.4;
    }
    .briskdesk-article-item-excerpt {
        font-size: 13px; color: #64748b; line-height: 1.5; margin: 0;
        display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
    }

    /* Empty state */
    .briskdesk-cat-empty {
        text-align: center; padding: 48px 24px; color: #64748b;
    }
    .briskdesk-cat-empty-title { font-size: 18px; font-weight: 600; color: #1e293b; margin: 0 0 8px; }
    .briskdesk-cat-empty-desc { font-size: 15px; margin: 0; }

    /* Pagination */
    .briskdesk-cat-pagination {
        display: flex; justify-content: center; gap: 6px; margin-top: 28px;
    }
    .briskdesk-cat-pagination a,
    .briskdesk-cat-pagination span {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 34px; height: 34px; padding: 0 8px;
        border: 1px solid #e2e8f0; border-radius: 6px; font-size: 13px;
        text-decoration: none; color: #475569; background: #fff;
        transition: border-color .12s ease, background .12s ease;
    }
    .briskdesk-cat-pagination a:hover { border-color: #059669; color: #059669; }
    .briskdesk-cat-pagination .current {
        background: #059669; border-color: #059669; color: #fff; font-weight: 600;
    }

    /* ── Right sidebar ─────────────────────────────────────── */
    .briskdesk-kb-sidebar-right {
        position: sticky; top: var(--briskdesk-header-offset, 32px);
        padding: 24px 0;
    }
    .briskdesk-search-sidebar-wrap {
        margin-bottom: 24px;
    }

    /* ── Responsive ────────────────────────────────────────── */
    @media (max-width: 1100px) {
        .briskdesk-kb-layout {
            grid-template-columns: 260px 1fr;
        }
        .briskdesk-kb-sidebar-right { display: none; }
    }
    @media (max-width: 768px) {
        .briskdesk-kb-layout {
            grid-template-columns: 1fr;
            padding: 0 16px;
        }
        .briskdesk-kb-sidebar-left { display: none; }
        .briskdesk-kb-main { padding: 20px 0 60px; }
        .briskdesk-cat-title { font-size: 24px; }
    }

/* ============================================================
   KB post-type archive
   ============================================================ */
    /* ── Full-width override ───────────────────────────────── */
    .briskdesk-kb-wrap { width: 100%; max-width: 100%; margin: 0 auto; padding: 0; }
    body.briskdesk-kb-page .widget-area,
    body.briskdesk-kb-page aside.sidebar,
    body.briskdesk-kb-page #secondary { display: none !important; }
    body.briskdesk-kb-page .content-area,
    body.briskdesk-kb-page .site-content,
    body.briskdesk-kb-page .site-main,
    body.briskdesk-kb-page #primary { width: 100% !important; max-width: 100% !important; float: none !important; margin: 0 !important; padding: 0 !important; }

    /* ── Hero ───────────────────────────────────────────────── */
    .briskdesk-kb-hero {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        padding: 56px 24px;
        text-align: center;
    }
    .briskdesk-kb-hero-inner { max-width: 680px; margin: 0 auto; }
    .briskdesk-kb-hero-title {
        font-size: 34px; font-weight: 700; color: #fff;
        margin: 0 0 10px; line-height: 1.25;
    }
    .briskdesk-kb-hero-subtitle {
        font-size: 17px; color: #cbd5e1; margin: 0 0 28px; line-height: 1.5;
    }
    .briskdesk-kb-search-wrap { max-width: 560px; margin: 0 auto; }

    /* ── Popular articles ──────────────────────────────────── */
    .briskdesk-popular-articles {
        max-width: 1200px; margin: 0 auto; padding: 40px 24px 0;
    }

    /* ── Category grid ─────────────────────────────────────── */
    .briskdesk-kb-categories {
        max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px;
    }
    .briskdesk-kb-grid {
        display: grid; grid-template-columns: repeat(3, 1fr);
        gap: 28px; align-items: start;
    }

    /* ── Category card ─────────────────────────────────────── */
    .briskdesk-kb-card {
        background: #fff; border-radius: 10px; overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
        transition: box-shadow .2s ease;
    }
    .briskdesk-kb-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }

    .briskdesk-kb-card-header {
        background: #d1fae5;
        padding: 18px 20px;
        display: flex; align-items: center; justify-content: space-between;
    }
    .briskdesk-kb-card-title {
        font-size: 17px; font-weight: 700; color: #1e293b;
        margin: 0; line-height: 1.35;
    }
    .briskdesk-kb-card-title a {
        color: inherit; text-decoration: none;
    }
    .briskdesk-kb-card-title a:hover { color: #065f46; }
    .briskdesk-kb-card-badge {
        background: #16a34a; color: #fff;
        width: 32px; height: 32px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 13px; font-weight: 700; flex-shrink: 0;
    }

    .briskdesk-kb-card-body { padding: 12px 8px 16px; }

    .briskdesk-kb-card-list {
        list-style: none; margin: 0; padding: 0;
    }
    .briskdesk-kb-card-list li { margin: 0; }
    .briskdesk-kb-card-list li a {
        display: flex; align-items: center; gap: 10px;
        padding: 7px 14px; border-radius: 6px;
        font-size: 14px; color: #334155; text-decoration: none;
        transition: background .15s ease, color .15s ease;
        line-height: 1.45;
    }
    .briskdesk-kb-card-list li a:hover {
        background: #f0fdf4; color: #065f46;
    }
    .briskdesk-kb-card-list li a svg {
        flex-shrink: 0; width: 16px; height: 16px; color: #94a3b8;
    }

    /* ── Empty state ───────────────────────────────────────── */
    .briskdesk-kb-empty {
        text-align: center; padding: 60px 24px; color: #64748b;
    }
    .briskdesk-kb-empty-title { font-size: 20px; font-weight: 600; color: #1e293b; margin: 0 0 8px; }
    .briskdesk-kb-empty-desc { font-size: 16px; margin: 0; }

    /* ── Responsive ────────────────────────────────────────── */
    @media (max-width: 960px) {
        .briskdesk-kb-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    }
    @media (max-width: 600px) {
        .briskdesk-kb-hero { padding: 40px 16px; }
        .briskdesk-kb-hero-title { font-size: 26px; }
        .briskdesk-kb-hero-subtitle { font-size: 15px; }
        .briskdesk-kb-categories { padding: 28px 16px 60px; }
        .briskdesk-kb-grid { grid-template-columns: 1fr; gap: 18px; }
    }

