/* ============================================================
   SmartElektroHub Docs — stylesheet  (GitHub-inspired light theme)
   ============================================================ */

/* --- Reset & base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 14px;
  line-height: 1.7;
  color: #1f2328;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Language defaults ------------------------------------- */
.lang-ru { display: none !important; }
html.show-ru .lang-ru { display: revert !important; }
html.show-ru .lang-en { display: none !important; }

/* --- Header ----------------------------------------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid #d0d7de;
  z-index: 200;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 6px;
}

.header-logo {
  font-weight: 600;
  font-size: 15px;
  color: #1f2328;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-version {
  font-size: 11px;
  font-weight: 500;
  background: #dafbe1;
  color: #1a7f37;
  padding: 2px 8px;
  border-radius: 20px;
}

.header-nav {
  display: flex;
  gap: 2px;
  margin-left: 12px;
}

.header-nav a {
  color: #57606a;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.12s, color 0.12s;
}

.header-nav a:hover,
.header-nav a.active-nav {
  color: #1f2328;
  background: #f6f8fa;
}

.header-search {
  flex: 1;
  max-width: 280px;
  margin-left: auto;
}

.header-search input {
  width: 100%;
  padding: 5px 12px 5px 32px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #f6f8fa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2357606a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center;
  font-size: 13px;
  color: #57606a;
  cursor: default;
  outline: none;
}

.lang-toggle {
  display: flex;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  overflow: hidden;
  margin-left: 12px;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #57606a;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.lang-btn.active {
  background: #0969da;
  color: #ffffff;
}

/* --- Page layout ------------------------------------------ */
.page-layout {
  display: flex;
  flex: 1;
  padding-top: 56px;
}

/* --- Sidebar ---------------------------------------------- */
.sidebar {
  width: 252px;
  flex-shrink: 0;
  border-right: 1px solid #d0d7de;
  padding: 20px 0 40px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  background: #ffffff;
}

.nav-section { margin-bottom: 20px; }

.nav-section-title {
  display: block;
  padding: 4px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #57606a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}

.nav-list { list-style: none; }

.nav-list a {
  display: block;
  padding: 5px 16px;
  color: #57606a;
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: background 0.1s, color 0.1s;
}

.nav-list a:hover {
  color: #0969da;
  background: #f0f7ff;
}

.nav-list a.active {
  color: #0969da;
  border-left-color: #0969da;
  background: #f0f7ff;
  font-weight: 500;
}

/* --- Content area ----------------------------------------- */
.content-area {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 72px;
}

/* --- Typography ------------------------------------------- */
.content-area h1 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d0d7de;
  color: #1f2328;
  line-height: 1.3;
}

.content-area h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: #1f2328;
  scroll-margin-top: 72px;
}

.content-area h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: #1f2328;
}

.content-area h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 6px;
  color: #1f2328;
}

.content-area p { margin-bottom: 14px; }

.content-area ul,
.content-area ol {
  margin: 0 0 16px 20px;
}

.content-area li { margin-bottom: 6px; }

.content-area a { color: #0969da; text-decoration: none; }
.content-area a:hover { text-decoration: underline; }

.content-area hr {
  border: none;
  border-top: 1px solid #d0d7de;
  margin: 32px 0;
}

/* --- Inline code ------------------------------------------ */
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
    "Courier New", monospace;
  font-size: 85%;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  padding: 1px 6px;
  color: #1f2328;
}

/* --- Code blocks ------------------------------------------ */
.code-block {
  position: relative;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  margin: 14px 0;
  overflow: hidden;
}

.code-block pre {
  padding: 16px;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
    "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #1f2328;
  margin: 0;
}

.code-block pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ffffff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #57606a;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  font-family: inherit;
}

.copy-btn:hover {
  background: #f6f8fa;
  color: #0969da;
  border-color: #0969da;
}

.copy-btn.copied {
  color: #1a7f37;
  border-color: #1a7f37;
}

/* --- Tables ----------------------------------------------- */
.table-wrapper { overflow-x: auto; margin: 14px 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead th {
  background: #f6f8fa;
  text-align: left;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 2px solid #d0d7de;
  color: #57606a;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #d0d7de;
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f6f8fa; }

/* --- Badges ----------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green  { background: #dafbe1; color: #1a7f37; }
.badge-yellow { background: #fff8c5; color: #9a6700; }
.badge-red    { background: #ffebe9; color: #cf222e; }
.badge-blue   { background: #ddf4ff; color: #0550ae; }
.badge-gray   { background: #f6f8fa; color: #57606a; border: 1px solid #d0d7de; }
.badge-purple { background: #fbefff; color: #8250df; }

/* --- HTTP method labels ----------------------------------- */
.method {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.method-get    { background: #ddf4ff; color: #0550ae; }
.method-post   { background: #dafbe1; color: #1a7f37; }
.method-patch  { background: #fff8c5; color: #9a6700; }
.method-delete { background: #ffebe9; color: #cf222e; }

/* --- Endpoint row ----------------------------------------- */
.endpoint-row {
  display: flex;
  align-items: flex-start;
  padding: 10px 14px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  margin: 6px 0;
  background: #ffffff;
  gap: 8px;
}

.endpoint-path {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  color: #1f2328;
  flex: 1;
}

.endpoint-desc { font-size: 13px; color: #57606a; }

/* --- Callouts --------------------------------------------- */
.callout {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px 0;
  font-size: 14px;
  border-left: 4px solid;
  line-height: 1.6;
}

.callout-info    { background: #ddf4ff; border-color: #54aeff; color: #0550ae; }
.callout-warning { background: #fff8c5; border-color: #d4a72c; color: #7d4e00; }
.callout-danger  { background: #ffebe9; border-color: #ff8182; color: #82071e; }
.callout-success { background: #dafbe1; border-color: #4ac26b; color: #116329; }

.callout a { color: inherit; font-weight: 600; }

/* --- Param table (API) ------------------------------------ */
.param-table { margin: 12px 0 20px; }
.param-name {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
}
.param-type { font-size: 12px; color: #8250df; }
.param-required { font-size: 11px; color: #cf222e; font-weight: 600; }
.param-optional { font-size: 11px; color: #57606a; }

/* --- Changelog -------------------------------------------- */
.changelog-entry {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid #d0d7de;
}
.changelog-entry:last-child { border-bottom: none; }

.changelog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.changelog-version {
  font-size: 18px;
  font-weight: 600;
  color: #1f2328;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.changelog-date { font-size: 13px; color: #57606a; }

.changelog-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #57606a;
  margin: 14px 0 5px;
}

.changelog-list { list-style: none; margin: 0; }

.changelog-list li {
  padding: 3px 0 3px 16px;
  position: relative;
  font-size: 14px;
}

.changelog-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: #57606a;
}

/* --- 404 -------------------------------------------------- */
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  padding: 48px 24px;
}

.code-404 {
  font-size: 88px;
  font-weight: 700;
  color: #d0d7de;
  line-height: 1;
  margin-bottom: 20px;
}

.page-404 h1 {
  font-size: 22px;
  border: none;
  margin-bottom: 10px;
}

.page-404 p {
  color: #57606a;
  max-width: 400px;
  margin-bottom: 4px;
}

.btn {
  display: inline-block;
  padding: 8px 20px;
  background: #0969da;
  color: #ffffff !important;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  margin-top: 20px;
  transition: background 0.15s;
}

.btn:hover { background: #0860ca; text-decoration: none !important; }

/* --- Footer ----------------------------------------------- */
.site-footer {
  border-top: 1px solid #d0d7de;
  padding: 18px 24px;
  background: #ffffff;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #57606a;
  max-width: 1280px;
  margin: 0 auto;
}

.footer-inner nav { display: flex; gap: 16px; }
.footer-inner nav a { color: #57606a; text-decoration: none; }
.footer-inner nav a:hover { color: #0969da; }

/* --- Responsive ------------------------------------------- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content-area { padding: 24px 20px 56px; }
  .header-search { display: none; }
  .header-nav { display: none; }
}
