/* ===== Documentation Siview — adapté au style KScada ===== */

.docs-toolbar {
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 72px;
  z-index: 500;
}
.docs-toolbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.docs-menu-btn {
  display: none;
  border: 1px solid #e2e8f0;
  background: var(--white);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--dark);
  font-size: 1rem;
}
.docs-search {
  position: relative;
  margin-left: auto;
  width: min(380px, 100%);
}
.docs-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.85rem;
}
.docs-search input {
  width: 100%;
  padding: 10px 70px 10px 38px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #f8fafc;
  color: var(--dark);
}
.docs-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(245,130,32,.15);
}
.docs-search kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: inherit;
  font-size: 0.7rem;
  color: #94a3b8;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 7px;
}
.docs-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,.25);
  overflow: hidden;
  display: none;
  z-index: 600;
  max-height: 380px;
  overflow-y: auto;
}
.docs-search-results.open { display: block; }
.docs-search-results a {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.85rem;
}
.docs-search-results a:hover { background: #fff7ed; }
.docs-search-results a strong { display: block; color: var(--dark); font-size: 0.88rem; }
.docs-search-results a span { color: #94a3b8; font-size: 0.75rem; }

.docs-layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

/* ---------- Sidebar ---------- */
.docs-sidebar {
  position: sticky;
  top: 129px;
  height: calc(100vh - 129px);
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid #eef2f7;
  padding: 26px 18px 40px 20px;
}
.docs-product-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin: 24px 0 4px;
  padding: 8px 10px 6px;
  border-bottom: 2px solid #ffedd5;
}
.docs-product-title:first-child { margin-top: 0; }
.docs-product-title i { font-size: 0.8rem; }
.docs-product-title { cursor: pointer; }
.docs-product-title:hover { color: var(--primary-hover); }
.docs-product-title .chev {
  margin-left: auto;
  font-size: 0.65rem;
  color: #94a3b8;
  transition: transform .2s;
}
.docs-product-title.open .chev { transform: rotate(90deg); color: var(--primary); }
.hero-doc-btn {
  padding: 8px 20px;
  border: 2px solid #334155;
  background: #000;
  color: #94a3b8;
}
.hero-doc-btn:hover {
  color: #fff;
  border-color: #64748b;
}
.hero-doc-btn.hero-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.hero-doc-btn.hero-active:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}
.docs-section-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--dark);
  margin: 22px 0 6px;
}
.docs-section-title:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; }
.docs-nav li { list-style: none; }
.docs-children {
  border-left: 1px solid #e8eef5;
  margin-left: 6px;
  padding-left: 6px;
}
.docs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.87rem;
  color: #64748b;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.35;
}
.docs-item:hover { background: #f8fafc; color: var(--dark); }
.docs-item .chev {
  margin-left: auto;
  font-size: 0.65rem;
  color: #94a3b8;
  transition: transform .2s;
  flex-shrink: 0;
}
.docs-item.open .chev { transform: rotate(90deg); color: var(--primary); }
.docs-item.group { font-weight: 500; }
.docs-item.page { position: relative; }
.docs-item.page.active {
  color: var(--primary);
  font-weight: 600;
  background: #fff7ed;
}
.docs-item.page.active::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}
.docs-empty { font-size: .85rem; color: #94a3b8; padding: 10px; }

/* ---------- Content ---------- */
.docs-content { padding: 36px 44px 80px; min-width: 0; }
.docs-breadcrumb {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.docs-breadcrumb .sep { color: #cbd5e1; }
.docs-article {
  background: var(--white);
  border: 1px solid #eef2f7;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 42px 46px;
  max-width: 860px;
}
.docs-article h1 {
  font-size: 2rem;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}
.docs-article h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.8rem;
  padding-top: 0.4rem;
}
.docs-article h3 { font-size: 1.1rem; margin: 1.6rem 0 0.6rem; }
.docs-article h4 { font-size: 1rem; margin: 1.2rem 0 0.5rem; }
.docs-article p { margin: 0.7rem 0; color: var(--text); font-size: 0.96rem; }
.docs-article ul, .docs-article ol { margin: 0.7rem 0 0.7rem 1.4rem; color: var(--text); font-size: 0.95rem; }
.docs-article ul { list-style: disc; }
.docs-article ol { list-style: decimal; }
.docs-article li { margin: 0.3rem 0; }
.docs-article a { color: var(--primary); font-weight: 500; }
.docs-article a:hover { color: var(--primary-hover); text-decoration: underline; }
.docs-article img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.25);
  margin: 14px auto;
  cursor: zoom-in;
  transition: transform .2s, box-shadow .2s;
}
.docs-article img:hover {
  transform: scale(1.01);
  box-shadow: 0 12px 28px -8px rgba(245,130,32,.45);
}
.docs-article figure { margin: 16px 0; text-align: center; }
.docs-article figure img { margin: 0 auto; }
.docs-article table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 16px 0; }
.docs-article th {
  background: var(--dark);
  color: #fff;
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
}
.docs-article th:first-child { border-radius: 8px 0 0 0; }
.docs-article th:last-child { border-radius: 0 8px 0 0; }
.docs-article td { border: 1px solid #e2e8f0; padding: 9px 14px; color: var(--text); vertical-align: top; }
.docs-article tr:nth-child(even) td { background: #f8fafc; }
.docs-article th p { color: #fff; margin: 0; }
.docs-article th a { color: #ffd9b3; }
.docs-article td p { margin: 0.25rem 0; }
.docs-article td p:first-child { margin-top: 0; }
.docs-article td p:last-child { margin-bottom: 0; }
.docs-article .sd-callout p { color: inherit; }
.table-wrapper { overflow-x: auto; margin: 8px 0; border-radius: 8px; }
.docs-article code {
  font-family: Consolas, 'Courier New', monospace;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.85em;
  color: #b45309;
}
.docs-article pre {
  background: var(--dark);
  color: #e2e8f0;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 0.83rem;
  line-height: 1.55;
}
.docs-article pre code { background: none; color: inherit; padding: 0; }

/* ---------- Blocs de code : coloration + barre langage/copie ---------- */
.codeblock {
  margin: 16px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #1e293b;
  box-shadow: var(--shadow);
}
.codeblock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  padding: 6px 8px 6px 14px;
}
.codeblock-lang {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.codeblock-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
}
.codeblock-copy:hover { border-color: var(--primary); color: #fff; }
.codeblock-copy.copy-ok { border-color: #22c55e; color: #4ade80; }
.codeblock-copy.copy-fail { border-color: #ef4444; color: #f87171; }
.codeblock pre { margin: 0; border-radius: 0; box-shadow: none; }
.tok-k { color: #569CD9; }
.tok-s { color: #CE9178; }
.tok-c { color: #6A9955; font-style: italic; }
.tok-n { color: #B5CEA8; }
.tok-d { color: #C586C0; }
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  margin: 18px 0;
  box-shadow: var(--shadow);
  background: #000;
}
.video-wrapper iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.docs-article iframe[src*="youtube"] {
  width: 100%;
  aspect-ratio: 16/9;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 16px 0;
}

/* Callouts snazzyDocs */
.sd-callout {
  border-radius: 10px;
  padding: 14px 16px 14px 48px;
  margin: 16px 0;
  font-size: 0.9rem;
  position: relative;
  border: 1px solid;
  line-height: 1.55;
}
.sd-callout::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 16px; top: 15px;
  font-size: 1rem;
}
.sd-callout[data-callout-type="tip"] { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.sd-callout[data-callout-type="tip"]::before { content: "\f0eb"; color: #16a34a; }
.sd-callout[data-callout-type="info"] { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.sd-callout[data-callout-type="info"]::before { content: "\f05a"; color: #2563eb; }
.sd-callout[data-callout-type="warning"], .sd-callout[data-callout-type="danger"] { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.sd-callout[data-callout-type="warning"]::before, .sd-callout[data-callout-type="danger"]::before { content: "\f071"; color: var(--primary); }

.docs-meta {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
  font-size: 0.78rem;
  color: #94a3b8;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 860px;
  margin-top: 18px;
}
.docs-pager a {
  background: var(--white);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 0.88rem;
  display: block;
  transition: .2s;
}
.docs-pager a:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.docs-pager small { display: block; color: #94a3b8; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; }
.docs-pager strong { color: var(--dark); }
.docs-pager .next { text-align: right; }

.docs-video-fallback {
  margin: 10px 0 18px;
  font-size: 0.85rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 10px 14px;
  line-height: 1.5;
}
.docs-video-fallback a { color: var(--primary); font-weight: 600; }
.docs-video-fallback a:hover { color: var(--primary-hover); }
.docs-video-fallback i { color: #ff0000; margin-right: 6px; }

/* ---------- Lightbox (zoom plein écran au clic) ---------- */
.docs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15,23,42,.93);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.docs-lightbox.open { opacity: 1; pointer-events: auto; }
.docs-lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  background: #fff;
}
.docs-lightbox figcaption {
  color: #cbd5e1;
  font-size: 0.85rem;
  max-width: 80ch;
  text-align: center;
}
.docs-lightbox .docs-lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  color: #fff;
  font-size: 1.6rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.docs-lightbox .docs-lightbox-close:hover { color: var(--primary); }

/* Overlay mobile */
.docs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 800;
}
.docs-overlay.show { display: block; }

@media (max-width: 960px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-menu-btn { display: inline-flex; align-items: center; gap: 8px; }
  .docs-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(340px, 88vw);
    height: 100vh;
    z-index: 900;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.3);
  }
  .docs-sidebar.open { transform: none; }
  .docs-content { padding: 22px 16px 60px; }
  .docs-article { padding: 26px 20px; }
  .docs-article h1 { font-size: 1.6rem; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-toolbar { top: 70px; }
}
