/* Layout */

body { margin: 0; font-family: 'SP-Light', Verdana, sans-serif; font-size: 0.875rem;}

h1 {font-weight: 500;}

.kb-header{
  padding: 12px 16px 0px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

a{
  text-decoration: none;
  font-weight: 400;
  color: rgb(26, 71, 214);
}

a:visited {
  color: rgb(26, 71, 214);
}

p{font-family: 'SP-Light', Verdana, sans-serif}

ol{
  padding-inline-start: 20px;
}

ol li{
  padding-bottom: 10px;
  line-height: 1.3em;
}

h1{
  line-height: 1.2em;
}

strong {
  /* last one wins */
  color: rgb(96, 71, 154);
}

a {
  font-weight: 700;
}

.kb-header-left{
  display: flex;
  align-items: center;
  gap: 16px;
}

.kb-brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  font-size: 18px;
}

.kb-brand-logo{
  height: 44px;     /* adjust to taste */
  width: auto;
  display: block;
  position: relative;
  top: -4px;
}

.kb-brand-text{
  white-space: nowrap;
  position: relative;
  top: -4px;
}

@media (max-width: 768px){
  .kb-brand-text{
    display: none;
  }
}

[hidden] { display: none !important; }

/* Layout: single column now (desktop grid will override in media query) */
.kb-layout { display: block; min-height: calc(100vh - 60px); }

.kb-main { padding: 6px 18px 18px; }
.kb-main-top { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }


/* Platform switcher */
/* Platform container defaults (large screens): to the right of search */
.kb-header-platform{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Platform dropdown (custom button + ul) */
#kb-platform { position: relative; display: inline-block; font-family: 'SP-SemiBold';}

#kb-platform-btn{
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
  color: #333;
  font-family: 'SP-SemiBold';
}

#kb-platform-btn:focus-visible{
  outline: 2px solid rgba(0,0,0,0.25);
  border-radius: 8px;
}

.kb-platform-caret { margin-left: 6px; font-size: 12px; color: #666; }

#kb-platform-menu{
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  font-family: 'SP-SemiBold';
  margin: 0;
  padding: 6px;
  list-style: none;

  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  z-index: 1000;
}

#kb-platform-menu button{
  width: 100%;
  text-align: left;

  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: 'SP-SemiBold' !important;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  font-weight: 400;
}

#kb-platform-menu button:hover,
#kb-platform-menu button:focus-visible{
  background: #f3f3f3;
  outline: none;
}

/* Platform content visibility (scope ONLY to kb-content) */
#kb-content .kb-platform { display: none; }
#kb-content .kb-platform-web { display: block; } /* default */

body[data-platform="sd"] #kb-content .kb-platform { display: none; }
body[data-platform="sd"] #kb-content .kb-platform-sd { display: block; }

body[data-platform="sdp"] #kb-content .kb-platform { display: none; }
body[data-platform="sdp"] #kb-content .kb-platform-sdp { display: block; }

body[data-platform="tls"] #kb-content .kb-platform { display: none; }
body[data-platform="tls"] #kb-content .kb-platform-tls { display: block; }

/* Search */
.kb-search { flex: 1; min-width: 260px; }
#kb-search-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #ddd; }
.kb-search-status { font-size: 12px; color: #666; margin-top: 6px; }
.kb-search-results { list-style: none; padding: 0; margin: 8px 0 0 0; border: 1px solid #eee; border-radius: 10px; overflow: hidden; }
#kb-search-results { display: none; }
.kb-search-item a { display: block; padding: 10px 12px; text-decoration: none; color: inherit; font-weight: 600; border-top: 1px solid #eee; }
.kb-search-item:first-child a { border-top: none; }
.kb-search-snippet { margin: -6px 0 0 0; padding: 0 12px 10px 12px; color: #555; font-size: 13px; }
.kb-search-empty { padding: 10px 12px; color: #666; }
mark { background: #fff3b0; }


/* Nav buttons */
.kb-navbtn{
  border: 1px solid #eee;
  background: #fff;
  padding: 6px;
  border-radius: 10px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kb-navbtn svg{
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.kb-navbtn:hover{ background: #f6f6f6; }

.kb-navbtn:disabled{
  opacity: 0.4;
  cursor: default;
}


/* Notices / errors */
.kb-platform-notice { padding: 12px 14px; border-radius: 10px; background: #fff4d0; margin-bottom: 14px; }
.kb-error { padding: 12px 14px; border-radius: 10px; background: #ffe3e3; }


/* Small screens: platform sits on the same line as brand, aligned right */
@media (max-width: 768px){
  .kb-header-left{
    flex: 1;
    min-width: 0;
  }

  .kb-header-platform{
    margin-left: auto;   /* push to the far right */
    order: 0;            /* stays up top */
  }

  .kb-search{
    order: 1;            /* search drops below */
    flex-basis: 100%;
    min-width: 0;
  }
}


/* menu items */
.kb-topic-menu{ margin-top: 25px; }

.kb-topic-menu p{
  border: 1px solid #ccc;
  padding: 15px 15px;
  border-radius: 10px;
  position: relative;
  width: calc(100% - 35px);
  cursor: pointer;
}

.kb-topic-menu p a{
  display: block;
  width: 100%;
  color: inherit;
}

.kb-topic-menu p a::after{
  content: "\2192";
  position: absolute;
  right: 15px;
  color: rgb(96, 71, 214);
}

.kb-menu{ margin-top: 25px; }

.kb-menu p{
  border: 1px solid #ccc;
  padding: 15px 15px;
  border-radius: 10px;
  position: relative;
  width: calc(100% - 35px);
  cursor: pointer;
}

.kb-menu p a{
  display: block;
  width: 100%;
  color: inherit;
}

.kb-menu p a::after{
  content: "\2192";
  position: absolute;
  right: 15px;
  color: rgb(96, 71, 214);
}



/* =========================================================
   Sidebar (IMPORTANT FIX)
   - Visual styles apply on ALL screen sizes.
   - Desktop: grid + sticky behaviour.
   - Mobile: overlay slide-in behaviour.
   ========================================================= */

/* Default: sidebar hidden (desktop and overlay rules will override) */
.kb-sidebar { display: none; }

.kb-sidebar{
  background: #f8f9fa;
  height: 100%;
}

/* Sidebar visuals (apply on all sizes) */
.kb-sidebar-inner{
  border-radius: 12px;
  padding: 12px;
}

.kb-sidebar-title{
  margin-bottom: 10px;
}

/* Sidebar links */
#kb-sidebar-nav a{
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: #333;
}

#kb-sidebar-nav a:hover{
  background: #f6f6f6;
}

/* Active page */
#kb-sidebar-nav a[aria-current="page"]{
  background: rgba(96, 71, 214, 0.10);
  color: rgb(96, 71, 214);
}

/* Optional: active section / active child */
#kb-sidebar-nav a[aria-current="location"]{
  color: rgb(96, 71, 214);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Child list (also applies on mobile overlay) */
.kb-side-children{
  margin: 6px 0 10px 0;
  padding-left: 10px;
  border-left: 2px solid #eee;
}

.kb-side-child{
  display: block;
  padding: 6px 10px;
  border-radius: 10px;
  color: #333;
  font-size: 13px;
}

.kb-side-child:hover{
  background: #f6f6f6;
}

.kb-side-child[aria-current="location"]{
  color: rgb(96, 71, 214);
  background: rgba(96, 71, 214, 0.08);
}


/* Desktop (large screens): grid + sticky sidebar */
@media (min-width: 1024px){
  .kb-layout{
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
    align-items: start;
  }

  .kb-sidebar{
    display: block;
  }

  .kb-sidebar-inner{
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: auto;
  }

  /* Hide the overlay toggle on desktop */
  #kb-sidebar-toggle{ display: none; }
}


/* Mobile overlay */
.kb-sidebar-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9998;
  display: none; /* controlled by body class */
}

@media (max-width: 1023px){
  /* Sidebar becomes an off-canvas panel */
  .kb-sidebar{
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 86vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    z-index: 9999;
    padding: 12px;
  }

  .kb-sidebar-inner{
    position: relative;
    height: calc(100vh - 24px);
    overflow: auto;     /* key for mobile */
    max-height: none;
  }

  body.kb-sidebar-open .kb-sidebar{
    transform: translateX(0);
  }

  body.kb-sidebar-open .kb-sidebar-backdrop{
    display: block;
  }

  /* Ensure mobile layout doesn't reserve sidebar space */
  .kb-layout{
    display: block;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  .kb-sidebar{ transition: none; }
}

/* Sidebar header (mobile close button row) */
.kb-sidebar-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* Close button */
#kb-sidebar-close{
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  position: relative;
  top: -6px;
  right: -6px;
}

#kb-sidebar-close:hover{
  background: #f3f3f3;
}

/* Hide close button on desktop */
@media (min-width: 1024px){
  #kb-sidebar-close{
    display: none;
  }
}
