/* IdleBuster Documentation - Frontend Styles
   Apple Light Theme — matches OrientMinds landing page */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

body:has(.ib-docs-wrapper) {
  background-color: #F2F2F7;
}

:root {
  --ib-primary: #0A84FF;
  --ib-primary-hover: #0071E3;
  --ib-primary-glow: rgba(10, 132, 255, 0.08);
  --ib-bg: #FFFFFF;
  --ib-bg-secondary: rgba(246, 246, 250, 0.95);
  --ib-bg-tertiary: rgba(60, 60, 67, 0.06);
  --ib-border: rgba(60, 60, 67, 0.12);
  --ib-border-light: rgba(60, 60, 67, 0.08);
  --ib-text: #1C1C1E;
  --ib-text-secondary: #3C3C43;
  --ib-text-muted: #8E8E93;
  --ib-sidebar-width: 300px;
  --ib-radius: 14px;
  --ib-radius-sm: 10px;
  --ib-transition: 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  --ib-sep: rgba(60, 60, 67, 0.12);
}

/* Wrapper — seamless, no shadow */
.ib-docs-wrapper {
  display: flex;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  min-height: 80vh;
  border-radius: var(--ib-radius);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--ib-border);
  line-height: 1.6;
  font-size: 15px;
  color: var(--ib-text);
  background: var(--ib-bg);
  -webkit-font-smoothing: antialiased;
}

.ib-docs-wrapper * { box-sizing: border-box; }

/* ── Sidebar ── */
.ib-docs-sidebar {
  width: var(--ib-sidebar-width);
  min-width: var(--ib-sidebar-width);
  background: var(--ib-bg-secondary);
  border-right: 1px solid var(--ib-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ib-docs-sidebar-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ib-docs-sidebar-close { display: none; background: none; border: none; color: var(--ib-text-muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.ib-docs-sidebar-close:hover { color: var(--ib-text); background: var(--ib-bg-tertiary); }

.ib-docs-logo { display: flex; align-items: center; gap: 12px; }
.ib-docs-logo-icon svg { width: 36px; height: 36px; }
.ib-docs-logo-title { display: block; font-weight: 700; font-size: 1rem; color: var(--ib-text); }
.ib-docs-logo-sub { display: block; font-size: 0.7rem; color: var(--ib-text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }

/* Search */
.ib-docs-search {
  position: relative;
  padding: 16px 20px 0;
}
.ib-docs-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--ib-border);
  border-radius: var(--ib-radius-sm);
  padding: 10px 36px 10px 36px;
  color: var(--ib-text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ib-docs-search input:focus {
  border-color: var(--ib-primary);
  box-shadow: 0 0 0 3px var(--ib-primary-glow);
}
.ib-docs-search input::placeholder { color: var(--ib-text-muted); }
.ib-docs-search-icon {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%) translateY(8px);
  width: 16px;
  height: 16px;
  color: var(--ib-text-muted);
  pointer-events: none;
}
.ib-docs-search-clear {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%) translateY(8px);
  cursor: pointer;
  color: var(--ib-text-muted);
  padding: 2px;
  border-radius: 4px;
  background: none;
  border: none;
}
.ib-docs-search-clear:hover { color: var(--ib-text); }

/* Search results dropdown */
.ib-docs-search-results {
  margin: 8px 20px 0;
  background: #FFFFFF;
  border: 1px solid var(--ib-border);
  border-radius: var(--ib-radius-sm);
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.ib-docs-search-result {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--ib-border);
  transition: background 0.2s;
}
.ib-docs-search-result:last-child { border-bottom: none; }
.ib-docs-search-result:hover { background: var(--ib-bg-tertiary); }
.ib-docs-search-result-title { font-weight: 600; font-size: 0.85rem; color: var(--ib-text); margin-bottom: 2px; }
.ib-docs-search-result-cat { font-size: 0.7rem; color: var(--ib-primary); font-weight: 500; }
.ib-docs-search-result-excerpt { font-size: 0.78rem; color: var(--ib-text-muted); margin-top: 3px; }
.ib-docs-search-result-excerpt mark { background: rgba(10,132,255,0.12); color: var(--ib-text); border-radius: 2px; padding: 0 2px; }
.ib-docs-search-empty { padding: 20px; text-align: center; color: var(--ib-text-muted); font-size: 0.85rem; }

/* Navigation */
.ib-docs-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--ib-bg-tertiary) transparent;
}
.ib-docs-nav::-webkit-scrollbar { width: 4px; }
.ib-docs-nav::-webkit-scrollbar-track { background: transparent; }
.ib-docs-nav::-webkit-scrollbar-thumb { background: rgba(60,60,67,0.15); border-radius: 4px; }

.ib-docs-nav-category { margin-bottom: 4px; }

.ib-docs-nav-cat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 20px;
  background: none;
  border: none;
  color: var(--ib-text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: color 0.2s, background 0.2s;
  border-radius: 0;
}
.ib-docs-nav-cat-btn:hover { color: var(--ib-text); background: rgba(60, 60, 67, 0.04); }

/* Active/expanded category — subtle highlight, NOT full blue */
.ib-docs-nav-cat-btn[aria-expanded="true"] {
  color: var(--ib-text);
  background: rgba(60, 60, 67, 0.06);
}

.ib-docs-nav-cat-icon { font-size: 0.9rem; }
.ib-docs-nav-cat-label { flex: 1; }
.ib-docs-nav-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  color: var(--ib-text-muted);
}
.ib-docs-nav-cat-btn[aria-expanded="false"] .ib-docs-nav-chevron { transform: rotate(-90deg); }

.ib-docs-nav-articles {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.ib-docs-nav-cat-btn[aria-expanded="false"] + .ib-docs-nav-articles { max-height: 0 !important; }

.ib-docs-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px 7px 32px;
  color: var(--ib-text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  border-left: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}
.ib-docs-nav-link:hover { color: var(--ib-text); background: rgba(60, 60, 67, 0.04); }

/* Active link — dark text on subtle bg, blue left border */
.ib-docs-nav-link.active {
  color: var(--ib-primary);
  border-left-color: var(--ib-primary);
  background: rgba(10, 132, 255, 0.06);
  font-weight: 600;
}
.ib-docs-nav-article-icon { font-size: 0.8rem; flex-shrink: 0; }

/* ── Main Content ── */
.ib-docs-content {
  flex: 1;
  padding: 32px 48px 48px;
  overflow-y: auto;
  min-width: 0;
  background: #FFFFFF;
}

/* Breadcrumb */
.ib-docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ib-text-muted);
  margin-bottom: 24px;
}
.ib-docs-breadcrumb-sep { width: 14px; height: 14px; flex-shrink: 0; }
.ib-docs-breadcrumb-current { color: var(--ib-text-secondary); font-weight: 500; }

/* Article */
.ib-docs-article-title {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--ib-text);
  margin: 0 0 28px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ib-docs-article-body {
  color: var(--ib-text-secondary);
  line-height: 1.75;
}

.ib-docs-article-body h2 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ib-text);
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ib-border);
}

.ib-docs-article-body h3 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ib-text);
  margin: 28px 0 12px;
}

.ib-docs-article-body h4 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ib-text);
  margin: 20px 0 10px;
}

.ib-docs-article-body p { margin: 0 0 16px; }

.ib-docs-article-body a {
  color: var(--ib-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.ib-docs-article-body a:hover { color: var(--ib-primary-hover); text-decoration: underline; }

.ib-docs-article-body ul,
.ib-docs-article-body ol {
  padding-left: 24px;
  margin: 0 0 16px;
}
.ib-docs-article-body li { margin-bottom: 6px; }

.ib-docs-article-body code {
  background: var(--ib-bg-tertiary);
  color: var(--ib-text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.ib-docs-article-body pre {
  background: #F8F8FA;
  border: 1px solid var(--ib-border);
  border-radius: var(--ib-radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 0 0 16px;
}
.ib-docs-article-body pre code { background: none; padding: 0; font-size: 0.85rem; }

.ib-docs-article-body strong { color: var(--ib-text); font-weight: 600; }

.ib-docs-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--ib-radius-sm);
  border: 1px solid var(--ib-border);
  margin: 16px 0;
}

.ib-docs-article-body kbd {
  background: #F0F0F5;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.82em;
  font-family: inherit;
  font-weight: 600;
  color: var(--ib-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Tables */
.ib-docs-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border-radius: var(--ib-radius-sm);
  overflow: hidden;
  border: 1px solid var(--ib-border);
}
.ib-docs-article-body th {
  background: #F6F6FA;
  color: var(--ib-text);
  font-weight: 600;
  font-size: 0.85rem;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ib-border);
}
.ib-docs-article-body td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--ib-border);
  font-size: 0.88rem;
}
.ib-docs-article-body tr:last-child td { border-bottom: none; }
.ib-docs-article-body tr:hover td { background: rgba(60, 60, 67, 0.02); }

/* Blockquotes / alerts — LIGHT THEME with proper contrast */
.ib-docs-article-body blockquote {
  margin: 16px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--ib-primary);
  background: rgba(10, 132, 255, 0.06);
  border-radius: 0 var(--ib-radius-sm) var(--ib-radius-sm) 0;
  color: var(--ib-text-secondary);
}
.ib-docs-article-body blockquote p:last-child { margin-bottom: 0; }

/* Custom alert classes — dark text on light tinted backgrounds */
.ib-doc-alert {
  padding: 16px 20px;
  border-radius: var(--ib-radius-sm);
  margin: 16px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}
.ib-doc-alert-tip { background: rgba(48, 209, 88, 0.08); border-left: 4px solid #30D158; color: var(--ib-text-secondary); }
.ib-doc-alert-warning { background: rgba(255, 159, 10, 0.08); border-left: 4px solid #FF9F0A; color: var(--ib-text-secondary); }
.ib-doc-alert-danger { background: rgba(255, 55, 95, 0.08); border-left: 4px solid #FF375F; color: var(--ib-text-secondary); }
.ib-doc-alert-info { background: rgba(10, 132, 255, 0.06); border-left: 4px solid var(--ib-primary); color: var(--ib-text-secondary); }
.ib-doc-alert strong { color: var(--ib-text); }

/* Hotkey grid */
.ib-doc-hotkey-grid {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.ib-doc-hotkey-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #F6F6FA;
  border-radius: var(--ib-radius-sm);
  border: 1px solid var(--ib-border);
}
.ib-doc-hotkey-row kbd { min-width: 90px; text-align: center; }

/* Feature comparison */
.ib-doc-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
.ib-doc-compare-card {
  background: #F6F6FA;
  border: 1px solid var(--ib-border);
  border-radius: var(--ib-radius-sm);
  padding: 20px;
}
.ib-doc-compare-card h4 { margin-top: 0; }

/* Steps */
.ib-doc-steps { counter-reset: step; list-style: none; padding: 0; margin: 16px 0; }
.ib-doc-steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ib-border);
}
.ib-doc-steps li:last-child { border-bottom: none; }
.ib-doc-steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: var(--ib-primary);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Article navigation — no "Next"/"Previous" label */
.ib-docs-article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--ib-border);
}
.ib-docs-nav-spacer { flex: 1; }
.ib-docs-nav-prev,
.ib-docs-nav-next {
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  background: #F6F6FA;
  border: 1px solid var(--ib-border);
  border-radius: var(--ib-radius-sm);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  min-width: 180px;
}
.ib-docs-nav-prev:hover,
.ib-docs-nav-next:hover {
  border-color: rgba(60, 60, 67, 0.22);
  background: rgba(60, 60, 67, 0.06);
}
/* Hide Next/Previous label completely */
.ib-docs-nav-label { display: none; }
.ib-docs-nav-title { font-size: 0.9rem; color: var(--ib-text); font-weight: 600; }
.ib-docs-nav-prev { text-align: left; }
.ib-docs-nav-next { text-align: right; }

/* Empty state */
.ib-docs-empty { text-align: center; padding: 80px 20px; }
.ib-docs-empty h2 { color: var(--ib-text); font-size: 1.5rem; margin-bottom: 8px; }
.ib-docs-empty p { color: var(--ib-text-muted); }

/* Mobile toggle */
.ib-docs-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--ib-primary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(10,132,255,0.3);
  align-items: center;
  gap: 8px;
}
.ib-docs-mobile-toggle svg { flex-shrink: 0; }

/* Loading */
.ib-docs-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.ib-docs-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--ib-border);
  border-top-color: var(--ib-primary);
  border-radius: 50%;
  animation: ibDocsSpin 0.7s linear infinite;
}
@keyframes ibDocsSpin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 900px) {
  .ib-docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
    background: #F6F6FA;
  }
  .ib-docs-sidebar.open { transform: translateX(0); }
  .ib-docs-sidebar-close { display: block; }
  .ib-docs-mobile-toggle { display: flex; }
  .ib-docs-content { padding: 24px 20px 80px; }
  .ib-docs-article-title { font-size: 1.5rem; }
  .ib-doc-comparison { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .ib-docs-article-nav { flex-direction: column; }
  .ib-docs-nav-prev, .ib-docs-nav-next { min-width: auto; }
}
