/* Тех. документация — стили в духе IDE (PhpStorm / New UI) */
body.page-tech-docs {
  --ide-bg: #1e1f22;
  --ide-surface: #2b2d30;
  --ide-elevated: #313335;
  --ide-border: #393b40;
  --ide-text: #bcbec4;
  --ide-muted: #6f737a;
  --ide-hover: #2e3136;
  --ide-select: #2e436e;
  --ide-select-text: #dfe1e5;
  --ide-focus: #3574f0;
  --ide-accent: #6aabf7;
  --ide-tree-indent: 18px;
  --ide-tree-branch: rgba(90, 130, 190, 0.42);
  background: var(--ide-bg);
  color: var(--ide-text);
}

body.page-tech-docs .wrap {
  max-width: 100%;
  padding: 10px 14px 20px;
}

body.page-tech-docs .topbar {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ide-border);
}

body.page-tech-docs .brand-logo {
  height: 52px;
  margin: -6px 8px -6px 0;
}

body.page-tech-docs .brand {
  font-size: 14px;
}

body.page-tech-docs .tabs {
  background: var(--ide-surface);
  border-color: var(--ide-border);
  margin-bottom: 10px;
}

body.page-tech-docs .tab {
  color: var(--ide-muted);
}
body.page-tech-docs .tab:hover {
  color: var(--ide-text);
  background: var(--ide-hover);
}
body.page-tech-docs .tab.active {
  color: var(--ide-select-text);
  background: var(--ide-select);
  border-color: rgba(106, 171, 247, 0.35);
}

.ide-shell {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ide-border);
  border-radius: 8px;
  background: var(--ide-surface);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.ide-bc-item {
  color: var(--ide-muted);
}
.ide-bc button.ide-bc-item {
  background: none;
  border: none;
  font: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}
.ide-bc button.ide-bc-item:hover {
  color: var(--ide-text);
  text-decoration: underline;
}
.ide-bc-item.is-root {
  color: var(--ide-accent);
}
.ide-bc-item.is-current {
  color: var(--ide-text);
  font-weight: 500;
  cursor: default;
}
.ide-bc-item.is-current:hover {
  text-decoration: none;
}
.ide-bc-sep {
  opacity: 0.45;
  margin: 0 4px;
  user-select: none;
}

.ide-tree-root-row {
  margin: 0 2px 8px;
  padding: 2px 8px 2px 2px;
  min-height: 28px;
  gap: 4px;
}

.ide-file-name {
  color: var(--ide-text);
  font-weight: 500;
}
.ide-file-folder {
  color: var(--ide-accent);
  cursor: pointer;
  text-decoration: none;
}
.ide-file-folder:hover {
  text-decoration: underline;
}

.ide-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(106, 171, 247, 0.12);
  color: var(--ide-accent);
  border: 1px solid rgba(106, 171, 247, 0.28);
}
.ide-pill.is-file {
  background: rgba(188, 190, 196, 0.08);
  color: var(--ide-muted);
  border-color: var(--ide-border);
}

.ide-dl {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ide-select-text);
  background: var(--ide-focus);
  text-decoration: none;
  border: 1px solid transparent;
}
.ide-dl:hover {
  filter: brightness(1.08);
}

.ide-empty {
  padding: 24px 12px !important;
  text-align: center;
  color: var(--ide-muted);
  font-size: 13px;
}

.ide-search-path {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--ide-text);
  word-break: break-all;
}

.ide-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 8px 12px;
  background: var(--ide-elevated);
  border-bottom: 1px solid var(--ide-border);
  font-size: 12px;
}

.ide-toolbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.ide-toolbar-search svg {
  flex-shrink: 0;
  opacity: 0.55;
}

.ide-toolbar-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--ide-border);
  background: var(--ide-bg);
  color: var(--ide-text);
  font-size: 12px;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
}

.ide-toolbar-search input:focus {
  outline: none;
  border-color: var(--ide-focus);
  box-shadow: 0 0 0 1px var(--ide-focus);
}

.ide-toolbar-search input::placeholder {
  color: var(--ide-muted);
}

.ide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--ide-border);
  background: var(--ide-surface);
  color: var(--ide-text);
  font-size: 12px;
  cursor: pointer;
}
.ide-btn:hover {
  background: var(--ide-hover);
}
.ide-btn:focus-visible {
  outline: 2px solid var(--ide-focus);
  outline-offset: 1px;
}

.ide-bc {
  flex: 2;
  min-width: 0;
  font-size: 12px;
  color: var(--ide-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ide-bc a {
  color: var(--ide-accent);
  text-decoration: none;
}
.ide-bc a:hover {
  text-decoration: underline;
}
.ide-bc .sep {
  opacity: 0.45;
  margin: 0 2px;
}

.ide-workbench {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: min(72vh, 520px);
  max-height: calc(100vh - 200px);
  min-width: 0;
}

.ide-tree-pane {
  width: 300px;
  min-width: 180px;
  max-width: 55vw;
  display: flex;
  flex-direction: column;
  background: var(--ide-bg);
  border-right: 1px solid var(--ide-border);
}

.ide-pane-title {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ide-muted);
  border-bottom: 1px solid var(--ide-border);
  background: var(--ide-elevated);
}

.ide-tree-scroll {
  flex: 1;
  overflow: auto;
  padding: 4px 0 8px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
}

.ide-gutter {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
}
.ide-gutter:hover,
.ide-gutter.is-dragging {
  background: rgba(106, 171, 247, 0.25);
}

.ide-main-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--ide-surface);
}

.ide-main-head {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ide-muted);
  border-bottom: 1px solid var(--ide-border);
  background: var(--ide-elevated);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ide-main-head strong {
  color: var(--ide-text);
  font-weight: 500;
}

.ide-table-wrap {
  flex: 1;
  overflow: auto;
}

.ide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ide-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ide-muted);
  background: var(--ide-elevated);
  border-bottom: 1px solid var(--ide-border);
}

.ide-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(57, 59, 64, 0.6);
  vertical-align: middle;
}

#tdTable.ide-table--thumbs .ide-th-name {
  width: 30%;
}
#tdTable.ide-table--thumbs .ide-th-thumb {
  width: 96px;
  text-align: center;
}
#tdTable.ide-table--thumbs .ide-td-thumb {
  width: 96px;
  text-align: center;
  vertical-align: middle;
  padding: 4px 8px;
}
.ide-row-thumb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 6px;
  line-height: 0;
}
.ide-row-thumb-btn:focus-visible {
  outline: 2px solid var(--ide-focus);
  outline-offset: 2px;
}
.ide-row-thumb {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: #18191b;
  border-radius: 6px;
  border: 1px solid var(--ide-border);
}
img.ide-row-thumb.ide-row-thumb--pending {
  background: linear-gradient(110deg, #25262a 0%, #2e3136 40%, #25262a 80%);
  background-size: 200% 100%;
  animation: ide-thumb-shimmer 1.1s ease-in-out infinite;
}
img.ide-row-thumb.ide-row-thumb--err {
  opacity: 0.45;
  background: #2a2224;
  border-color: rgba(255, 120, 140, 0.25);
}
@keyframes ide-thumb-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}
.ide-row-thumb-btn:hover .ide-row-thumb {
  border-color: rgba(106, 171, 247, 0.45);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.ide-thumb-empty {
  display: inline-block;
  min-width: 80px;
  text-align: center;
}

.ide-table tbody tr:hover td {
  background: var(--ide-hover);
}

.ide-table tbody tr.is-active td {
  background: var(--ide-select);
  color: var(--ide-select-text);
}

.ide-table tbody tr.is-active .ide-muted {
  color: rgba(223, 225, 229, 0.75);
}

.ide-file-link {
  color: var(--ide-accent);
  text-decoration: none;
  font-weight: 500;
}
.ide-file-link:hover {
  text-decoration: underline;
}

.ide-muted {
  color: var(--ide-muted);
  font-size: 12px;
}

.ide-tree {
  list-style: none;
  margin: 0;
  padding: 2px 2px 8px 4px;
}

/* Не обнулять padding у ul.ide-tree-children — иначе вложенность «схлопывается» в одну колонку */
.ide-tree li {
  margin: 0;
  padding: 0;
  position: relative;
}

.ide-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px 8px 2px 2px;
  cursor: pointer;
  border-radius: 4px;
  margin: 0 2px;
  user-select: none;
}

.ide-tree-row:hover {
  background: var(--ide-hover);
}

.ide-tree-row.is-selected {
  background: var(--ide-select);
  color: var(--ide-select-text);
}

.ide-tree-chev {
  flex: 0 0 20px;
  width: 20px;
  height: 22px;
  flex-shrink: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--ide-muted);
  cursor: pointer;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}

.ide-tree-chev:hover {
  color: var(--ide-text);
  background: rgba(255, 255, 255, 0.06);
}

.ide-tree-chev.is-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.ide-tree-chev.is-open::before {
  content: "▼";
}
.ide-tree-chev:not(.is-open)::before {
  content: "▶";
}

.ide-tree-icon {
  width: 16px;
  margin-right: 4px;
  flex-shrink: 0;
  text-align: center;
  opacity: 0.9;
  font-size: 13px;
}

.ide-tree-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.ide-tree ul.ide-tree-children {
  list-style: none;
  margin: 2px 0 6px 0;
  padding: 4px 0 8px 22px;
  border-left: 1px solid var(--ide-tree-branch);
  position: relative;
  box-sizing: border-box;
}

.ide-tree-loading {
  padding: 8px 12px;
  color: var(--ide-muted);
  font-size: 12px;
}

.ide-error {
  margin: 8px 12px;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 106, 138, 0.45);
  background: rgba(255, 106, 138, 0.08);
  color: #ffb4c4;
  font-size: 12px;
  display: none;
}

.ide-search-dock {
  border-top: 1px solid var(--ide-border);
  background: var(--ide-bg);
  max-height: 38vh;
  display: none;
  flex-direction: column;
}

.ide-search-dock.is-open {
  display: flex;
}

.ide-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ide-muted);
  border-bottom: 1px solid var(--ide-border);
  background: var(--ide-elevated);
}

.ide-search-scroll {
  overflow: auto;
  flex: 1;
}

.ide-kbd-hint {
  font-size: 11px;
  color: var(--ide-muted);
  margin-left: 8px;
}

.ide-file-image {
  color: var(--ide-accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.ide-file-image:hover {
  color: var(--ide-select-text);
  text-decoration-style: solid;
}

.ide-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
}
.ide-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}
.ide-lightbox-stage {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 56px 56px;
  box-sizing: border-box;
}
.ide-lightbox-frame {
  flex: 1;
  min-width: 0;
  max-width: min(96vw, 1200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ide-lightbox-frame img {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
}
.ide-lightbox-cap {
  margin-top: 10px;
  font-size: 13px;
  color: #cfd1d6;
  text-align: center;
  max-width: 100%;
  word-break: break-word;
}
.ide-lightbox-nav {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(40, 42, 46, 0.95);
  color: #dfe1e5;
  font-size: 16px;
  cursor: pointer;
  align-self: center;
}
.ide-lightbox-nav:hover {
  background: rgba(60, 63, 70, 0.98);
}
.ide-lightbox-nav:focus-visible {
  outline: 2px solid var(--ide-focus);
  outline-offset: 2px;
}
.ide-lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(40, 42, 46, 0.95);
  color: #dfe1e5;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ide-lightbox-close:hover {
  background: rgba(80, 50, 55, 0.95);
  border-color: rgba(255, 120, 140, 0.35);
}

@media (max-width: 768px) {
  .ide-workbench {
    flex-direction: column;
    max-height: none;
  }
  .ide-tree-pane {
    width: 100% !important;
    max-width: none;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--ide-border);
  }
  .ide-gutter {
    display: none;
  }
}
