/* MathLib Explorer — стили виджета */

.mathlib-search {
  display: flex; gap: 8px; align-items: stretch;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  margin-bottom: 12px;
}
.mathlib-search input {
  flex: 1; border: none; outline: none;
  padding: 14px 18px; font-size: 16px; background: transparent;
}
.mathlib-search button {
  border: none; background: var(--ink); color: var(--paper);
  padding: 0 22px; cursor: pointer; font-weight: 500; font-size: 14px;
}
.mathlib-search button:hover { background: var(--integral); }

.mathlib-modes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; }
.mathlib-mode {
  padding: 4px 12px; font-size: 13px;
  background: var(--paper); border: 1px solid var(--rule);
  cursor: pointer; transition: all .12s;
}
.mathlib-mode:hover { border-color: var(--ink); }
.mathlib-mode.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.mathlib-status { font-size: 13px; color: var(--ink-muted); margin: 12px 0; }

.mathlib-result {
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: 16px 20px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .12s;
}
.mathlib-result:hover { border-color: var(--ink); }
.mathlib-result__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.mathlib-result__name { font-family: var(--font-mono); font-weight: 500; color: var(--ink); font-size: 14px; }
.mathlib-result__module {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted);
  background: var(--rule-soft); padding: 1px 8px; letter-spacing: 0.02em;
}
.mathlib-result__score {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  color: var(--verify); border: 1px solid var(--verify-soft); padding: 1px 6px;
}
.mathlib-result__statement { font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.mathlib-result__statement.ru { color: var(--ink-muted); margin-top: 2px; }
.mathlib-result__expand { font-size: 12px; color: var(--ink-muted); margin-top: 8px; }
.mathlib-result__details { display: none; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--rule); }
.mathlib-result.expanded .mathlib-result__details { display: block; }

.mathlib-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px; }
.mathlib-quick a {
  padding: 4px 10px; font-size: 12px; color: var(--ink);
  border: 1px solid var(--rule); background: var(--paper);
  text-decoration: none;
}
.mathlib-quick a:hover { border-color: var(--ink); background: var(--surface); }

.mathlib-empty {
  padding: 64px 24px; text-align: center; color: var(--ink-muted);
  border: 1px dashed var(--rule); background: transparent; font-size: 14px;
}
.mathlib-empty .symbol {
  font-family: var(--font-math); font-style: italic; color: var(--integral);
  font-size: 64px; line-height: 1; margin-bottom: 16px; display:block;
}

/* ──────────────────────────────────────────────────────────────────
   Detail page (карточка теоремы) — широкий layout
   Левая колонка: граф во всю высоту, без рамки.
   Правая: EN / RU / LaTeX / Lean + похожие.
   ────────────────────────────────────────────────────────────────── */

.mathlib-detail-shell {
  max-width: 1640px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}

.mathlib-detail-shell__header {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
}

.mathlib-detail-shell__layout {
  display: grid;
  gap: 36px;
  grid-template-columns: minmax(0, 1.7fr) minmax(360px, 1fr);
  align-items: start;
}
@media (max-width: 1100px) {
  .mathlib-detail-shell__layout { grid-template-columns: 1fr; }
}

.mathlib-detail-shell__graph {
  position: relative;
  min-height: 720px;
  height: calc(100vh - 220px);
}
@media (max-width: 1100px) {
  .mathlib-detail-shell__graph { height: 560px; min-height: 480px; }
}

.mathlib-graph-canvas {
  width: 100%; height: 100%;
  background: transparent;
  border: none;
  position: relative;
}

.mathlib-graph-tooltip {
  position: fixed;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--ink);
  padding: 12px 14px;
  font-family: var(--font-serif);
  font-size: 14px; line-height: 1.5;
  color: var(--ink);
  max-width: 380px;
  box-shadow: 0 10px 24px rgba(26, 28, 30, 0.12);
  /* Не перехватывает клики — критично, иначе блокирует tap по узлу графа. */
  pointer-events: none !important;
}
.mathlib-graph-tooltip[hidden] { display: none !important; }
.mathlib-graph-tooltip__name {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px; color: var(--ink-muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.mathlib-graph-tooltip__text {
  margin: 0;
}

.mathlib-detail-shell__aside { position: relative; }

.mathlib-block {
  background: var(--surface); border: 1px solid var(--rule);
  padding: 18px 22px; margin-bottom: 16px;
}
.mathlib-block__title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--ink-muted); margin: 0 0 10px;
}

.mathlib-detail__lean pre {
  background: var(--paper-warm); border: 1px solid var(--rule);
  padding: 14px 16px; font-size: 13px; font-family: var(--font-mono);
  white-space: pre-wrap; overflow-x: auto; margin: 0;
}

/* ──────────────────────────────────────────────────────────────────
   Поиск по изображению (drag-and-drop)
   ────────────────────────────────────────────────────────────────── */

.image-search-shell { max-width: 720px; }

.image-search-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  border: 1.5px dashed var(--rule);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
  min-height: 220px;
}
.image-search-drop:hover,
.image-search-drop--hover {
  border-color: var(--ink);
  background: var(--paper-warm);
}
.image-search-drop__icon {
  font-family: var(--font-math); font-style: italic;
  font-size: 56px; line-height: 1;
  color: var(--integral);
}
.image-search-drop__hint {
  font-family: var(--font-serif);
  font-size: 16px; color: var(--ink-soft);
  max-width: 460px;
}
.image-search-drop__sub { color: var(--ink-muted); }

.image-search-preview {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--rule);
  background: var(--surface);
  display: flex; gap: 16px; align-items: center;
}
.image-search-preview img {
  max-height: 96px; max-width: 320px;
  border: 1px solid var(--rule);
  background: var(--paper);
}
