/* FRZ Knowledgebase — hub, manual layout and AI drawer. Colours follow the FRZ brand. */

.frzkb {
    --kb-ink: #181818;
    --kb-ink-2: #545454;
    --kb-muted: #767676;
    --kb-line: #e3e5e8;
    --kb-soft: #f5f6f7;
    --kb-green: #7ed957;
    --kb-green-ink: #2f7a12;
    --kb-green-soft: #eef9e8;
    --kb-dark: #181818;
    --kb-radius: 10px;
    --kb-shadow: 0 10px 30px rgba(17, 17, 17, .12);
    color: var(--kb-ink);
    box-sizing: border-box;
}
.frzkb *, .frzkb *::before, .frzkb *::after { box-sizing: border-box; }
.frzkb button { font: inherit; float: none; text-transform: none; letter-spacing: normal; margin: 0; min-height: 0; height: auto; width: auto; box-shadow: none; }
.frzkb :focus-visible { outline: 2px solid var(--kb-green-ink); outline-offset: 2px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.frzkb-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--kb-dark); color: #fff; border: 0; border-radius: 8px;
    padding: 10px 16px; font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.frzkb-btn:hover { background: #000; color: var(--kb-green); }
.frzkb-btn-ghost {
    background: #fff; color: var(--kb-ink); border: 1px solid var(--kb-line); border-radius: 8px;
    padding: 6px 14px; font-size: 14px; cursor: pointer;
}
.frzkb-btn-ghost:hover { border-color: var(--kb-ink); }
.frzkb-link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }
.frzkb-chip {
    background: #fff; border: 1px solid var(--kb-line); border-radius: 999px; padding: 5px 12px;
    font-size: 13px; color: var(--kb-ink); cursor: pointer; line-height: 1.3;
}
.frzkb-chip:hover { border-color: var(--kb-green-ink); background: var(--kb-green-soft); }

/* ── Search ──────────────────────────────────────────────────────────────── */

.frzkb-search { position: relative; flex: 1 1 auto; min-width: 0; }
.frzkb-search-field {
    display: flex; align-items: center; gap: 8px; background: #fff;
    border: 1px solid #cfd3d8; border-radius: 10px; padding: 0 6px 0 12px; transition: border-color .15s, box-shadow .15s;
}
.frzkb-search-field:focus-within { border-color: var(--kb-ink); box-shadow: 0 0 0 3px rgba(126, 217, 87, .35); }
.frzkb-search-icon { color: var(--kb-muted); flex: 0 0 auto; }
.frzkb .frzkb-search-input {
    flex: 1 1 auto; min-width: 0; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent !important;
    padding: 12px 0 !important; margin: 0 !important; font-size: 16px; color: var(--kb-ink); width: auto;
}
.frzkb-search.is-loading .frzkb-search-icon { animation: frzkb-pulse 1s ease-in-out infinite; }
.frzkb-scope { display: flex; align-self: center; align-items: center; background: var(--kb-soft); border-radius: 7px; padding: 3px; flex: 0 0 auto; }
.frzkb .frzkb-scope button {
    border: 0; background: transparent; border-radius: 5px; padding: 5px 10px; font-size: 12px; line-height: 1.2; color: var(--kb-ink-2); cursor: pointer;
}
.frzkb .frzkb-scope button.is-active { background: #fff; color: var(--kb-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

.frzkb-results {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1000;
    background: #fff; border: 1px solid var(--kb-line); border-radius: var(--kb-radius); box-shadow: var(--kb-shadow);
    max-height: min(70vh, 560px); overflow-y: auto; padding: 6px; text-align: left;
}
.frzkb-result {
    display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none !important; color: var(--kb-ink) !important;
    border-left: 3px solid transparent;
}
.frzkb-result:hover, .frzkb-result.is-active { background: var(--kb-soft); border-left-color: var(--kb-green); }
.frzkb-result-title { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; }
.frzkb-result-where { display: block; font-size: 12px; color: var(--kb-muted); margin-top: 2px; }
.frzkb-result-snippet { display: block; font-size: 13px; color: var(--kb-ink-2); margin-top: 4px; line-height: 1.45; }
.frzkb-results mark { background: var(--kb-green-soft); color: inherit; padding: 0 1px; border-radius: 2px; box-shadow: inset 0 -2px 0 var(--kb-green); }
.frzkb-tag {
    display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    background: var(--kb-dark); color: var(--kb-green); border-radius: 4px; padding: 2px 5px; margin-right: 6px; vertical-align: 2px;
}
.frzkb-results-empty { padding: 12px; color: var(--kb-ink-2); font-size: 14px; }
.frzkb-result-action {
    display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--kb-line);
    padding: 11px 12px; font-size: 14px; color: var(--kb-ink); cursor: pointer; border-radius: 0 0 8px 8px;
}
.frzkb-result-action:hover { background: var(--kb-green-soft); }
.frzkb-result-ai { font-weight: 600; }

/* ── Hub ─────────────────────────────────────────────────────────────────── */

.frzkb-hub { margin: 0 0 30px; }
.frzkb-hero {
    background: linear-gradient(135deg, #111 0%, #222 100%); color: #fff; border-radius: 14px;
    padding: 36px 32px 28px; margin-bottom: 18px; text-align: center; position: relative;
}
.frzkb-hero::after {
    content: ""; position: absolute; left: 32px; right: 32px; bottom: 0; height: 3px; background: var(--kb-green); border-radius: 3px 3px 0 0;
}
.frzkb .frzkb-hero-title { color: #fff; margin: 0 0 6px; font-size: 30px; line-height: 1.2; }
.frzkb-hero-sub { color: #c9c9c9; margin: 0 0 20px; font-size: 16px; }
.frzkb-hero .frzkb-search { max-width: 680px; margin: 0 auto; }
.frzkb-hero .frzkb-search-field { border-color: #fff; }
.frzkb-hero .frzkb-search-input { font-size: 17px; padding: 15px 0 !important; }
.frzkb-popular { margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; font-size: 13px; line-height: 1.3; color: #bdbdbd; }
.frzkb-popular > span { margin-right: 2px; }
.frzkb-hero .frzkb-chip { background: transparent; color: #fff; border-color: #555; }
.frzkb-hero .frzkb-chip:hover { border-color: var(--kb-green); background: rgba(126, 217, 87, .12); }

.frzkb-ai-card {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    border: 1px solid var(--kb-line); border-left: 4px solid var(--kb-green); border-radius: var(--kb-radius);
    padding: 14px 18px; margin-bottom: 22px; background: #fff;
}
.frzkb-ai-card-text strong { display: block; font-size: 16px; }
.frzkb-ai-card-text span { color: var(--kb-ink-2); font-size: 14px; }

.frzkb-catnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.frzkb-catnav a {
    font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--kb-soft); color: var(--kb-ink) !important; text-decoration: none !important;
}
.frzkb-catnav a:hover { background: var(--kb-green-soft); }

.frzkb-cat { margin-top: 26px; scroll-margin-top: 90px; }
.frzkb .frzkb-cat-title { font-size: 19px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--kb-line); }
.frzkb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.frzkb-card {
    display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--kb-line); border-radius: var(--kb-radius);
    background: #fff; text-decoration: none !important; color: var(--kb-ink) !important; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.frzkb-card:hover { border-color: var(--kb-green-ink); box-shadow: 0 6px 18px rgba(17, 17, 17, .08); transform: translateY(-1px); }
.frzkb-card-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; margin: 0 !important; }
.frzkb-card-badge {
    width: 56px; height: 56px; border-radius: 8px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
    background: var(--kb-dark); color: var(--kb-green); font-weight: 700; font-size: 18px; letter-spacing: .02em;
}
.frzkb-card-text { min-width: 0; }
.frzkb-card-name { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; }
.frzkb-card-meta { display: block; font-size: 12px; color: var(--kb-muted); margin-top: 2px; }
.frzkb-empty { color: var(--kb-ink-2); }

/* ── Manual page layout ─────────────────────────────────────────────────── */

.frzkb-crumbs { font-size: 13px; color: var(--kb-muted); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.frzkb-crumbs a { color: var(--kb-ink-2) !important; text-decoration: none !important; }
.frzkb-crumbs a:hover { color: var(--kb-ink) !important; text-decoration: underline !important; }

.frzkb-toolbar { display: flex; gap: 10px; align-items: stretch; margin-bottom: 22px; }
.frzkb-toolbar .frzkb-btn { padding: 0 18px; }

.frzkb-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; align-items: start; }
.frzkb-side { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; font-size: 14px; }
.admin-bar .frzkb-side { top: 56px; }
.frzkb-side-inner { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.frzkb-box { border: 1px solid var(--kb-line); border-radius: var(--kb-radius); padding: 12px 14px; background: #fff; }
.frzkb-box-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--kb-ink-2); margin-bottom: 8px; }
.frzkb-toc summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.frzkb-toc summary::-webkit-details-marker { display: none; }
.frzkb-toc summary::after { content: "▾"; float: right; color: var(--kb-muted); }
.frzkb-toc:not([open]) summary::after { content: "▸"; }
.frzkb-toc[open] summary { margin-bottom: 8px; }
.frzkb .frzkb-toc ul, .frzkb .frzkb-pages { list-style: none; margin: 0; padding: 0; }
.frzkb .frzkb-toc li, .frzkb .frzkb-pages li { margin: 0; padding: 0; }
.frzkb-toc a, .frzkb-pages a {
    display: block; padding: 4px 8px; border-left: 2px solid transparent; color: var(--kb-ink-2) !important;
    text-decoration: none !important; line-height: 1.35;
}
.frzkb-toc a:hover, .frzkb-pages a:hover { color: var(--kb-ink) !important; background: var(--kb-soft); }
.frzkb-toc a.is-active { border-left-color: var(--kb-green); color: var(--kb-ink) !important; font-weight: 600; }
.frzkb-toc .frzkb-toc-l3 a { padding-left: 20px; font-size: 13px; }
.frzkb-pages { counter-reset: kbpage; }
.frzkb-pages li.is-current a { border-left-color: var(--kb-green); color: var(--kb-ink) !important; font-weight: 600; background: var(--kb-green-soft); }

.frzkb-body { min-width: 0; }
.frzkb-content h2, .frzkb-content h3, .frzkb-content tr[id] { scroll-margin-top: 90px; }
.frzkb-content img { max-width: 100%; height: auto; }
.frzkb-content table { display: block; max-width: 100%; overflow-x: auto; }
.frzkb-flash { animation: frzkb-flash 2.4s ease-out; }
tr.frzkb-flash > td { animation: frzkb-flash 2.4s ease-out; }
@keyframes frzkb-flash { 0%, 30% { background-color: rgba(126, 217, 87, .45); } 100% { background-color: transparent; } }
@keyframes frzkb-pulse { 50% { opacity: .3; } }

.frzkb-pager { display: flex; justify-content: space-between; gap: 12px; margin: 34px 0 0; }
.frzkb-pager a {
    flex: 0 1 48%; border: 1px solid var(--kb-line); border-radius: var(--kb-radius); padding: 12px 16px;
    text-decoration: none !important; color: var(--kb-ink) !important; font-weight: 600;
}
.frzkb-pager a:hover { border-color: var(--kb-green-ink); }
.frzkb-pager small { display: block; font-weight: 400; color: var(--kb-muted); font-size: 12px; }
.frzkb-pager-next { margin-left: auto; text-align: right; }

.frzkb-feedback {
    margin-top: 30px; padding: 14px 16px; background: var(--kb-soft); border-radius: var(--kb-radius);
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 15px;
}
.frzkb-feedback-q { font-weight: 600; margin-right: 4px; }
.frzkb-feedback-more { width: 100%; }
.frzkb-feedback-more label { display: block; font-size: 14px; margin-bottom: 6px; }
.frzkb-feedback-more textarea { width: 100%; border: 1px solid var(--kb-line); border-radius: 8px; padding: 8px; font: inherit; margin-bottom: 8px; }
.frzkb-feedback-done { color: var(--kb-green-ink); font-weight: 600; }

.frzkb-help {
    margin-top: 16px; padding: 14px 16px; border: 1px solid var(--kb-line); border-radius: var(--kb-radius);
    display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px;
}
.frzkb-help span { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.frzkb-help a, .frzkb-help .frzkb-link { color: var(--kb-ink) !important; text-decoration: underline; }

/* ── AI drawer ──────────────────────────────────────────────────────────── */

.frzkb-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 2147483000;
    background: #fff; box-shadow: -10px 0 40px rgba(0, 0, 0, .18); display: flex; flex-direction: column;
    transform: translateX(105%); transition: transform .25s ease; visibility: hidden;
}
.frzkb-ai-open .frzkb-drawer { transform: none; visibility: visible; }
.admin-bar .frzkb-drawer { top: 32px; }
.frzkb-drawer-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
    background: var(--kb-dark); color: #fff; padding: 16px 18px; border-bottom: 3px solid var(--kb-green);
}
.frzkb-drawer-title { font-weight: 700; font-size: 17px; }
.frzkb-drawer-sub { font-size: 12px; color: #bdbdbd; margin-top: 2px; }
.frzkb-drawer-close {
    background: none; border: 0; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.frzkb-drawer-close:hover { color: var(--kb-green); }
.frzkb-drawer-log { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #fafafa; }
.frzkb-msg { max-width: 92%; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.55; word-wrap: break-word; }
.frzkb-msg p { margin: 0 0 8px; }
.frzkb-msg p:last-child { margin-bottom: 0; }
.frzkb .frzkb-msg ul, .frzkb .frzkb-msg ol { margin: 4px 0 8px 20px; padding: 0; }
.frzkb-msg li { margin: 2px 0; }
.frzkb-msg code { background: var(--kb-soft); padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.frzkb-msg a { color: var(--kb-green-ink); }
.frzkb-msg-user { align-self: flex-end; background: var(--kb-dark); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.frzkb-msg-bot { align-self: flex-start; background: #fff; border: 1px solid var(--kb-line); border-bottom-left-radius: 4px; }
.frzkb-msg-error { border-color: #f3b4b4; background: #fff5f5; }
.frzkb-cite {
    display: inline-block; min-width: 17px; height: 17px; line-height: 17px; text-align: center; font-size: 11px; font-weight: 700;
    background: var(--kb-green-soft); color: var(--kb-green-ink) !important; border-radius: 4px; text-decoration: none !important;
    vertical-align: 1px; margin: 0 1px; padding: 0 3px;
}
.frzkb-cite:hover { background: var(--kb-green); color: var(--kb-ink) !important; }
.frzkb-sources { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--kb-line); }
.frzkb-sources-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--kb-muted); margin-bottom: 4px; }
.frzkb .frzkb-sources ol { margin: 0 0 0 20px; font-size: 13px; }
.frzkb-sources small { display: block; color: var(--kb-muted); font-size: 11px; }
.frzkb-msg-support { margin-top: 8px; font-size: 13px; color: var(--kb-ink-2); }
.frzkb-rate { margin-top: 8px; font-size: 12px; color: var(--kb-muted); display: flex; align-items: center; gap: 4px; }
.frzkb .frzkb-rate button { display: inline-block; background: none; color: inherit; border: 1px solid transparent; border-radius: 6px; cursor: pointer; padding: 1px 5px; font-size: 14px; line-height: 1.3; }
.frzkb .frzkb-rate button:hover { border-color: var(--kb-line); background: #fff; }
.frzkb-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.frzkb-typing { display: flex; gap: 4px; padding: 13px 14px; }
.frzkb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--kb-muted); animation: frzkb-dot 1.2s infinite ease-in-out; }
.frzkb-typing span:nth-child(2) { animation-delay: .15s; }
.frzkb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes frzkb-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.frzkb-drawer-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--kb-line); background: #fff; }
.frzkb-drawer-form textarea {
    flex: 1 1 auto; resize: none; border: 1px solid #cfd3d8; border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 15px; min-height: 44px; margin: 0;
}
.frzkb-drawer-form textarea:focus { outline: 0; border-color: var(--kb-ink); box-shadow: 0 0 0 3px rgba(126, 217, 87, .35); }
.frzkb-drawer-note { font-size: 11px; color: var(--kb-muted); padding: 0 12px 10px; background: #fff; }

.frzkb-launcher {
    position: fixed; left: 20px; bottom: 20px; z-index: 2147482999; display: inline-flex; align-items: center; gap: 8px;
    background: var(--kb-dark); color: #fff; border: 0; border-radius: 999px; padding: 11px 16px; font-weight: 600; font-size: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25); cursor: pointer;
}
.frzkb-launcher svg { color: var(--kb-green); }
.frzkb-launcher:hover { background: #000; }
.frzkb-ai-open .frzkb-launcher { display: none; }
/* Manual pages on wide screens use the button in the sticky sidebar instead */
.frzkb-launcher.is-article { display: none; }
.frzkb-side-ai { width: 100%; }
.frzkb-side-ai svg { color: var(--kb-green); }

.frzkb .screen-reader-text {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ── Small screens ──────────────────────────────────────────────────────── */

@media (max-width: 860px) {
    .frzkb-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .frzkb-side { position: static; max-height: none; overflow: visible; }
    .frzkb-toolbar { flex-wrap: wrap; }
    .frzkb-toolbar .frzkb-search { flex-basis: 100%; }
    .frzkb-toolbar .frzkb-btn { padding: 10px 16px; }
    .frzkb-hero { padding: 26px 16px 22px; }
    .frzkb .frzkb-hero-title { font-size: 24px; }
    .frzkb-ai-card { flex-direction: column; align-items: flex-start; }
    .frzkb-drawer { width: 100vw; }
    .admin-bar .frzkb-drawer { top: 46px; }
    .frzkb-launcher { left: 14px; bottom: 14px; padding: 10px 14px; }
    .frzkb-launcher.is-article { display: inline-flex; }
    .frzkb-ai-open .frzkb-launcher.is-article { display: none; }
    .frzkb-side-ai { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .frzkb-drawer, .frzkb-card { transition: none; }
    .frzkb-flash, tr.frzkb-flash > td { animation-duration: .01s; }
}
