/* ============================================================
   Weatmood API Platform — стили.
   Тёмная тема, профессиональный дизайн.
   ============================================================ */

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --panel: #161616;
  --elev: #1c1c1c;
  --line: rgba(255,255,255,.07);
  --text: #ededed;
  --dim: #a0a0a0;
  --faint: #5a5a5a;
  --accent: #5b8cff;
  --accent-hover: #4a7af0;
  --green: #34c77b;
  --red: #ff5c5c;
  --orange: #f0a030;
  --radius: 10px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
}

.sidebar__top {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand__name {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--dim);
}

.brand__platform {
  color: var(--text);
  font-weight: 600;
}

.nav {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
  width: 100%;
  text-align: left;
}

.nav__item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav__item:hover { background: var(--elev); color: var(--text); }
.nav__item.is-active { background: rgba(91,140,255,.1); color: var(--accent); }
.nav__link { margin-top: 2px; }

.sidebar__bottom {
  padding: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Main ── */
.main {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px;
  position: sticky;
  top: 0;
  background: rgba(10,10,10,.85);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__email {
  font-size: 13px;
  color: var(--dim);
}

.topbar__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--elev);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
}

/* ── Pages ── */
.page {
  display: none;
  padding: 32px 32px 60px;
  max-width: 960px;
  width: 100%;
}

.page.is-active { display: block; }

.page__head { margin-bottom: 28px; }
.page__head h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.page__sub {
  margin-top: 6px;
  color: var(--dim);
  font-size: 15px;
}

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.card--accent {
  border-color: rgba(91,140,255,.25);
  grid-column: 1 / -1;
}

.card__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--elev);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.card__icon svg { width: 20px; height: 20px; color: var(--accent); }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--dim); line-height: 1.55; }

/* ── Code blocks ── */
.code-block {
  margin-top: 14px;
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

.code-block code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  color: #c8d0e0;
}

code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  background: var(--elev);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* ── Balance / Usage top ── */
.usage-top {
  display: flex;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.balance-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 200px;
  min-width: 0;
}

.spent-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 240px;
  min-width: 0;
}

.balance-label { font-size: 12.5px; color: var(--faint); }
.balance-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.balance-hint { font-size: 12px; color: var(--faint); }
.spent-value { font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }

.spent-rows { display: flex; gap: 14px; margin-top: 2px; flex-wrap: wrap; }
.spent-row { font-size: 12px; color: var(--faint); }
.spent-row b { color: var(--dim); font-weight: 600; }

.usage-top .btn-primary { align-self: center; flex-shrink: 0; }

/* ── Графики ── */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 14px;
}

.chart-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.chart-card__head h3 { font-size: 14px; font-weight: 600; }

.chart-box {
  position: relative;
  height: 180px;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Tables ── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head h2 { font-size: 18px; font-weight: 600; }
.hint { font-size: 13px; color: var(--faint); }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 500;
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.empty-cell { text-align: center; color: var(--faint); padding: 32px !important; }
.cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* Status badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
}

.status--ok { background: rgba(52,199,123,.12); color: var(--green); }
.status--err { background: rgba(255,92,92,.12); color: var(--red); }
.status--active { background: rgba(91,140,255,.12); color: var(--accent); }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.pagination button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
}

.pagination button:hover { background: var(--elev); color: var(--text); }
.pagination button.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: .35; cursor: not-allowed; }

/* ── Buttons ── */
.btn-primary {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.btn-ghost:hover { background: var(--elev); color: var(--text); }

.btn-danger {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover { opacity: .85; }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ── Docs ── */
.doc-section {
  margin-bottom: 32px;
}

.doc-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

.doc-section p {
  font-size: 14px;
  color: var(--dim);
  line-height: 1.6;
  margin-bottom: 10px;
}

.endpoint {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.method {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.method--get { background: rgba(52,199,123,.15); color: var(--green); }
.method--post { background: rgba(91,140,255,.15); color: var(--accent); }
.path { font-family: "JetBrains Mono", monospace; font-size: 13.5px; color: var(--text); }
.endpoint p { width: 100%; margin: 4px 0 0; font-size: 13px; }

/* ── Modals ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.is-hidden { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 440px;
  width: 90%;
}

.modal__panel--confirm { max-width: 380px; }
.modal__title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.modal__text { font-size: 14px; color: var(--dim); margin-bottom: 16px; line-height: 1.5; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; color: var(--faint); font-weight: 500; }
.field__input {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  width: 100%;
}
.field__input:focus { border-color: var(--accent); }
select.field__input { cursor: pointer; }
.field__hint { font-size: 11.5px; color: var(--faint); }

/* ── Переключатель валюты ── */
.currency-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}

.currency-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
  font-family: inherit;
}

.currency-btn:hover { color: var(--text); }
.currency-btn.is-active { background: var(--elev); color: var(--text); }

.auth__error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
}
.auth__error.is-hidden { display: none; }

.key-result {
  background: #0d0d0d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  word-break: break-all;
  color: var(--accent);
  user-select: all;
}

.topup-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.topup-opt {
  padding: 12px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: center;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .12s, background .12s;
  font-family: inherit;
}

.topup-opt:hover { border-color: var(--accent); background: rgba(91,140,255,.06); }
.topup-opt.is-active { border-color: var(--accent); background: rgba(91,140,255,.12); }

/* ── Страница документации ── */

.docs-body { display: block; }

.docs-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10,10,10,.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.docs-top__in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.docs-top__nav { display: flex; gap: 20px; flex-shrink: 0; }
.docs-top__nav a {
  color: var(--dim);
  text-decoration: none;
  font-size: 13.5px;
  white-space: nowrap;
}
.docs-top__nav a:hover { color: var(--text); }

.docs-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}

.docs-toc {
  position: sticky;
  top: 82px;
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.docs-toc__group { display: flex; flex-direction: column; gap: 2px; }

.docs-toc__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--faint);
  margin-bottom: 6px;
  font-weight: 600;
}

.docs-toc a {
  color: var(--dim);
  text-decoration: none;
  font-size: 13.5px;
  padding: 5px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
}

.docs-toc a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.docs-toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(91,140,255,.07);
}

.docs-content { padding: 32px 0 80px; min-width: 0; }

.docs-content .doc-section { margin-bottom: 44px; scroll-margin-top: 90px; }
.docs-content h1 { font-size: 30px; font-weight: 700; letter-spacing: -.025em; margin-bottom: 14px; }
.docs-content h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -.015em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.docs-content h3 { font-size: 15.5px; font-weight: 600; margin: 20px 0 8px; }
.docs-content p { font-size: 14.5px; color: var(--dim); line-height: 1.65; margin-bottom: 10px; }
.docs-content a { color: var(--accent); }
.docs-content .code-block { margin: 12px 0; }
.docs-content .table-wrap { margin: 14px 0; }
.docs-content .endpoint { margin: 12px 0 16px; }

.callout {
  padding: 14px 16px;
  border-radius: 10px;
  margin: 16px 0;
  border: 1px solid var(--line);
  background: var(--panel);
}
.callout strong { display: block; font-size: 13.5px; margin-bottom: 4px; }
.callout p { margin: 0; font-size: 13.5px; }
.callout--info { border-color: rgba(91,140,255,.3); background: rgba(91,140,255,.06); }
.callout--info strong { color: var(--accent); }
.callout--warn { border-color: rgba(240,160,48,.3); background: rgba(240,160,48,.06); }
.callout--warn strong { color: var(--orange); }

@media (max-width: 1000px) {
  .docs-layout { grid-template-columns: 1fr; gap: 0; }
  .docs-toc {
    position: static;
    padding: 20px 0 8px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 18px;
    border-bottom: 1px solid var(--line);
  }
  .docs-toc__group { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 4px; }
  .docs-toc__label { width: 100%; margin-bottom: 2px; }
  .docs-toc a { border-left: none; padding: 4px 8px; }
  .docs-content { padding: 24px 0 60px; }
}

@media (max-width: 640px) {
  .docs-top__in { padding: 0 16px; }
  .docs-top__nav { gap: 12px; }
  .docs-top__nav a { font-size: 12.5px; }
  .docs-layout { padding: 0 16px; }
}

/* ── Responsive ── */
@media (max-width: 768px) {

  .sidebar { width: 60px; }
  .sidebar .brand__name,
  .sidebar .nav__item span,
  .sidebar .brand__tag { display: none; }
  .sidebar .nav__item { justify-content: center; padding: 10px; }
  .main { margin-left: 60px; }
  .page { padding: 20px 16px 40px; }
  .cards { grid-template-columns: 1fr; }
  .balance-row { flex-direction: column; align-items: stretch; }
  .balance-card { max-width: 100%; }
  .topup-grid { grid-template-columns: repeat(2, 1fr); }
}
