/* ==========================================================================
   Knowledge Base Styles — Pakeet.id
   Integrates seamlessly with main styles.css, light & dark theme variables.
   ========================================================================== */

/* -------------------------------------------------------------------------
   Hero Section
   ------------------------------------------------------------------------- */
.kb-hero {
    padding-top: calc(var(--header-height) + 40px);
    padding-bottom: 50px;
    background: linear-gradient(180deg, var(--surface-soft) 0%, var(--page) 100%);
    border-bottom: 1px solid var(--line);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.kb-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 400px;
    background: radial-gradient(circle, color-mix(in srgb, var(--brand) 12%, transparent) 0%, transparent 70%);
    pointer-events: none;
}

.kb-hero-inner {
    max-width: 860px;
    margin-inline: auto;
    position: relative;
    z-index: 1;
}

.kb-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 18px;
}

.kb-hero h1 {
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 850;
    line-height: 1.15;
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.kb-hero-lede {
    font-size: clamp(16px, 1.4vw, 18px);
    color: var(--text-soft);
    line-height: 1.6;
    max-width: 680px;
    margin: 0 auto 32px;
}

/* -------------------------------------------------------------------------
   Search Bar
   ------------------------------------------------------------------------- */
.kb-search-container {
    max-width: 640px;
    margin: 0 auto 20px;
    position: relative;
}

.kb-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-md);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.kb-search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent);
}

.kb-search-box i.search-icon {
    position: absolute;
    left: 18px;
    font-size: 22px;
    color: var(--text-muted);
    pointer-events: none;
}

.kb-search-input {
    width: 100%;
    padding: 16px 54px 16px 52px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--text);
    outline: none;
}

.kb-search-input::placeholder {
    color: var(--text-muted);
}

.kb-search-clear {
    position: absolute;
    right: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
}

.kb-search-clear:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.kb-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 420px;
    overflow-y: auto;
    text-align: left;
    display: none;
}

.kb-search-results.is-open {
    display: block;
}

.kb-search-result-item {
    display: block;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    transition: background-color 150ms ease;
}

.kb-search-result-item:last-child {
    border-bottom: none;
}

.kb-search-result-item:hover,
.kb-search-result-item:focus {
    background: var(--surface-soft);
}

.kb-search-result-cat {
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand);
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kb-search-result-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.kb-search-result-snippet {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.45;
    margin: 0;
}

.kb-search-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-soft);
    font-size: 14px;
}

.kb-popular-tags {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.kb-tag-pill {
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-soft);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 150ms ease;
}

.kb-tag-pill:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 40%, transparent);
}

/* -------------------------------------------------------------------------
   Highlight Highlights Rail
   ------------------------------------------------------------------------- */
.kb-highlights-rail {
    padding-block: 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.kb-highlights-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 992px) {
    .kb-highlights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 540px) {
    .kb-highlights-grid {
        grid-template-columns: 1fr;
    }
}

.kb-highlight-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
}

.kb-highlight-item i {
    font-size: 24px;
    color: var(--brand);
    flex-shrink: 0;
}

.kb-highlight-item div strong {
    display: block;
    font-size: 13px;
    font-weight: 750;
    color: var(--text);
}

.kb-highlight-item div span {
    display: block;
    font-size: 12px;
    color: var(--text-soft);
}

/* -------------------------------------------------------------------------
   Section Titles & Containers
   ------------------------------------------------------------------------- */
.kb-section {
    padding-block: 56px;
}

.kb-section-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 40px;
}

.kb-section-header h2 {
    font-size: clamp(24px, 2.5vw, 32px);
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text);
}

.kb-section-header p {
    font-size: 15px;
    color: var(--text-soft);
    margin: 0;
}

/* -------------------------------------------------------------------------
   Popular Quick Start Cards
   ------------------------------------------------------------------------- */
.kb-popular-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 48px;
}

@media (max-width: 992px) {
    .kb-popular-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .kb-popular-grid {
        grid-template-columns: 1fr;
    }
}

.kb-popular-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 24px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.kb-popular-card:hover {
    transform: translateY(-3px);
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
}

.kb-card-top {
    margin-bottom: 16px;
}

.kb-card-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-soft);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 12px;
}

.kb-popular-card h3 {
    font-size: 17px;
    font-weight: 750;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 8px;
}

.kb-popular-card p {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.5;
    margin: 0;
}

.kb-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-muted);
}

.kb-read-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: var(--brand);
}

/* -------------------------------------------------------------------------
   Categories Grid
   ------------------------------------------------------------------------- */
.kb-category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 992px) {
    .kb-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .kb-category-grid {
        grid-template-columns: 1fr;
    }
}

.kb-category-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
}

.kb-category-card:hover {
    transform: translateY(-3px);
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
}

.kb-cat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-control);
    background: var(--brand-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--brand);
    margin-bottom: 16px;
}

.kb-category-card h3 {
    font-size: 18px;
    font-weight: 750;
    color: var(--text);
    margin-bottom: 6px;
}

.kb-category-card p {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.5;
    margin-bottom: 16px;
    flex-grow: 1;
}

.kb-cat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.kb-cat-count {
    color: var(--text-muted);
    font-weight: 600;
}

/* -------------------------------------------------------------------------
   Article Detail Layout
   ------------------------------------------------------------------------- */
.kb-detail-hero {
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 24px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
}

.kb-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.kb-breadcrumbs a {
    color: var(--text-soft);
    text-decoration: none;
    transition: color 150ms ease;
}

.kb-breadcrumbs a:hover {
    color: var(--brand);
}

.kb-breadcrumbs i {
    font-size: 11px;
}

.kb-detail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
    padding-block: 36px 80px;
}

@media (max-width: 992px) {
    .kb-detail-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

/* -------------------------------------------------------------------------
   Sidebar Navigation
   ------------------------------------------------------------------------- */
.kb-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
}

.kb-sidebar-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kb-sidebar-group {
    margin-bottom: 20px;
}

.kb-sidebar-group-label {
    font-size: 13px;
    font-weight: 750;
    color: var(--text);
    padding: 6px 10px;
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-sidebar-group-label i {
    color: var(--brand);
    font-size: 16px;
}

.kb-sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 10px;
}

.kb-sidebar-links a {
    display: block;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    border-radius: var(--radius-control);
    text-decoration: none;
    line-height: 1.4;
    transition: all 150ms ease;
    border-left: 2px solid transparent;
}

.kb-sidebar-links a:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.kb-sidebar-links a.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
    border-left-color: var(--brand);
}

/* -------------------------------------------------------------------------
   Main Article Reader Panel
   ------------------------------------------------------------------------- */
.kb-article-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: clamp(24px, 4vw, 44px);
    box-shadow: var(--shadow-sm);
}

.kb-article-header {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}

.kb-article-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.kb-article-badge {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 750;
    font-size: 12px;
}

.kb-article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.kb-article-header h1 {
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 850;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 16px;
}

.kb-article-summary {
    font-size: 16px;
    color: var(--text-soft);
    line-height: 1.6;
    margin: 0;
}

.kb-article-overview {
    background: var(--surface-soft);
    border-left: 4px solid var(--brand);
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
    padding: 16px 20px;
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 36px;
}

/* -------------------------------------------------------------------------
   Step-by-Step Roadmap Cards
   ------------------------------------------------------------------------- */
.kb-steps-container {
    margin-bottom: 40px;
}

.kb-steps-header {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kb-step-card {
    position: relative;
    padding-left: 56px;
    margin-bottom: 32px;
}

.kb-step-card:last-child {
    margin-bottom: 0;
}

.kb-step-card::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 44px;
    bottom: -24px;
    width: 2px;
    background: var(--line-strong);
}

.kb-step-card:last-child::before {
    display: none;
}

.kb-step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--brand);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}

.kb-step-content {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    padding: 24px;
}

.kb-step-title {
    font-size: 17px;
    font-weight: 750;
    color: var(--text);
    margin-bottom: 10px;
}

.kb-step-desc {
    font-size: 14.5px;
    color: var(--text-soft);
    line-height: 1.65;
    margin-bottom: 0;
    white-space: pre-line;
}

/* -------------------------------------------------------------------------
   Callout Boxes (Tip, Warning, Info)
   ------------------------------------------------------------------------- */
.kb-callout {
    display: flex;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-control);
    margin-top: 16px;
    font-size: 13.5px;
    line-height: 1.55;
}

.kb-callout i {
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.kb-callout-tip {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--text);
}
.kb-callout-tip i {
    color: var(--success);
}

.kb-callout-warning {
    background: color-mix(in srgb, #f59e0b 12%, transparent);
    border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
    color: var(--text);
}
.kb-callout-warning i {
    color: #f59e0b;
}

.kb-callout-info {
    background: var(--brand-soft);
    border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
    color: var(--text);
}
.kb-callout-info i {
    color: var(--brand);
}

/* -------------------------------------------------------------------------
   Direct Action CTA
   ------------------------------------------------------------------------- */
.kb-portal-cta-banner {
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 15%, var(--surface)) 0%, var(--surface) 100%);
    border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
    border-radius: var(--radius-panel);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-block: 36px;
}

@media (max-width: 640px) {
    .kb-portal-cta-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}

.kb-portal-cta-copy h4 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.kb-portal-cta-copy p {
    font-size: 13.5px;
    color: var(--text-soft);
    margin: 0;
}

/* -------------------------------------------------------------------------
   Accordion FAQs
   ------------------------------------------------------------------------- */
.kb-faq-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

.kb-faq-section h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kb-faq-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface-soft);
    overflow: hidden;
}

.kb-faq-question {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 15px;
    font-weight: 750;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.kb-faq-question i {
    font-size: 18px;
    color: var(--brand);
    transition: transform 180ms ease;
    flex-shrink: 0;
}

.kb-faq-item.is-open .kb-faq-question i {
    transform: rotate(180deg);
}

.kb-faq-answer {
    padding: 0 20px 18px;
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.6;
    display: none;
}

.kb-faq-item.is-open .kb-faq-answer {
    display: block;
}

/* -------------------------------------------------------------------------
   Feedback Widget
   ------------------------------------------------------------------------- */
.kb-feedback-box {
    margin-top: 40px;
    padding: 24px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    text-align: center;
}

.kb-feedback-box h4 {
    font-size: 16px;
    font-weight: 750;
    color: var(--text);
    margin-bottom: 12px;
}

.kb-feedback-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.kb-feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-control);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: all 150ms ease;
}

.kb-feedback-btn:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
}

.kb-feedback-btn.is-active {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
}

.kb-feedback-toast {
    display: none;
    margin-top: 12px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--success);
}

/* -------------------------------------------------------------------------
   Related Tutorials
   ------------------------------------------------------------------------- */
.kb-related-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

.kb-related-section h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 16px;
}

.kb-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .kb-related-grid {
        grid-template-columns: 1fr;
    }
}

.kb-related-card {
    padding: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    text-decoration: none;
    transition: transform 150ms ease, border-color 150ms ease;
    display: block;
}

.kb-related-card:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
}

.kb-related-card h4 {
    font-size: 14px;
    font-weight: 750;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.4;
}

.kb-related-card span {
    font-size: 12px;
    color: var(--brand);
    font-weight: 700;
}

/* -------------------------------------------------------------------------
   Still Need Help Banner
   ------------------------------------------------------------------------- */
.kb-support-banner {
    margin-top: 60px;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-soft) 100%);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-panel);
    padding: clamp(28px, 4vw, 44px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .kb-support-banner {
        flex-direction: column;
        text-align: center;
    }
    .kb-support-actions {
        width: 100%;
        justify-content: center;
    }
}

.kb-support-content h3 {
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}

.kb-support-content p {
    font-size: 14.5px;
    color: var(--text-soft);
    margin: 0;
}

.kb-support-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
