/* sidebar.css - оболочка панели в стиле bsbord: боковое меню + рабочая область.
   Грузится ПОСЛЕ site/console/auth, поэтому переопределяет их layout через
   селектор .shell. Старые header/footer прячем: навигация переехала в сайдбар.

   Палитра тут своя, «bschek-зелёная»: тёмный фон, акцент #16c65a. Держим её в
   переменных, чтобы одним местом перекрасить всю оболочку. */

.shell {
  --sb-w: 224px;
  --sb-bg: #080b12;
  --sb-bg-2: #0d1220;
  --sb-line: rgba(140, 170, 210, 0.10);
  --sb-accent: #4f8cff;
  --sb-accent-bright: #7fb0ff;
  --sb-accent-deep: #2a5bd0;
  --sb-accent-soft: rgba(79, 140, 255, 0.14);
  --sb-text: #e8eefc;
  --sb-muted: #8a97b8;
  --sb-gold: #d9a441;
}

/* ── grid оболочки ─────────────────────────────────────────────────────── */
body.shell {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  min-height: 100dvh;
  background: #05070b;
}
.shell .header,
.shell .footer,
.shell .user-bar {
  display: none !important;
}
.shell__mobile-header {
  display: none;
}

/* ── сайдбар ───────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sb-bg), var(--sb-bg-2));
  border-right: 1px solid var(--sb-line);
  padding: 1.1rem 0.85rem;
  z-index: 40;
}
.sidebar__top {
  padding: 0.35rem 0.6rem 1.1rem;
}
.sidebar .logo {
  gap: 0.6rem;
  font-size: 1.05rem;
}
.sidebar .logo__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 0 22px rgba(22, 198, 90, 0.45);
}
.sidebar .logo__text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  font-weight: 800;
}
.sidebar .logo__text span {
  color: var(--sb-accent);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  overflow-y: auto;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.75rem;
  border-radius: 11px;
  color: var(--sb-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.sidebar__link:hover {
  color: var(--sb-text);
  background: rgba(255, 255, 255, 0.03);
}
.sidebar__link.active {
  color: var(--sb-accent);
  background: var(--sb-accent-soft);
}
.sidebar__link.active .sidebar__icon {
  color: var(--sb-accent);
}
.sidebar__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--sb-muted);
  transition: color 0.15s ease;
}
.sidebar__badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: var(--sb-gold);
  color: #1a1204;
}

.sidebar__bottom {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--sb-line);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sidebar__theme {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.55rem;
  border-radius: 11px;
  border: 1px solid var(--sb-line);
  background: transparent;
  color: var(--sb-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.sidebar__theme:hover {
  color: var(--sb-text);
}
.sidebar__balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 11px;
  border: 1px solid var(--sb-line);
  font-size: 0.9rem;
}
.sidebar__balance b {
  color: var(--sb-accent);
  font-family: var(--mono);
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.sidebar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--sb-accent-soft);
  color: var(--sb-accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar__user-name {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__tier {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.14rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--sb-gold);
  color: var(--sb-gold);
  text-transform: uppercase;
}
.sidebar__tier[data-tier="silver"]   { color: #b9c4d6; border-color: #b9c4d6; }
.sidebar__tier[data-tier="gold"]     { color: #e2b13c; border-color: #e2b13c; }
.sidebar__tier[data-tier="platinum"] { color: #7fd4ff; border-color: #7fd4ff; }
.sidebar__tier[data-tier="free"]     { color: var(--sb-muted); border-color: var(--sb-line); }

/* ── рабочая область ───────────────────────────────────────────────────── */
.shell__main {
  min-width: 0;
  padding: 1.6rem clamp(1rem, 3vw, 2.4rem);
  overflow-x: hidden;
}
.shell .container,
.shell .auth__layout,
.shell .lab__layout {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}

/* ── топ-бар (бургер · уведомления · язык) ─────────────────────────────── */
.shell__topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: -0.4rem 0 1.4rem;
}
.topbar__spacer { flex: 1; }
.topbar__burger {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.topbar__burger span { display:block; width:18px; height:2px; border-radius:2px; background:var(--sb-text); }
.topbar__icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: var(--sb-bg-2);
  color: var(--sb-muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.topbar__icon-btn:hover { color: var(--sb-text); border-color: rgba(140,170,210,.25); }
.topbar__icon-btn svg { width: 19px; height: 19px; }
.topbar__dot { position:absolute; top:8px; right:9px; width:7px; height:7px; border-radius:50%; background:#ff5470; }
.topbar__lang-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0 0.7rem; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: var(--sb-bg-2);
  color: var(--sb-text);
  font: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
}
.topbar__lang-btn svg { width: 14px; height: 14px; color: var(--sb-muted); }
.topbar__flag { font-size: 1rem; }
@media (max-width: 900px) {
  /* На мобилке навигацию несёт статический .shell__mobile-header (его бургер
     #burger открывает сайдбар с оверлеем и авто-закрытием по клику на пункт).
     Инъектируемый topbar дублировал бы бургер - получалось ДВА меню в столбик,
     причём верхнее без оверлея. Поэтому на узких прячем именно топбар-бургер,
     а колокольчик уведомлений в топбаре оставляем. .shell__mobile-header тут
     НЕ трогаем: блок мобильного сайдбара ниже сам ставит ему display:flex. */
  .topbar__burger { display: none; }
}

/* Заголовок раздела как в дизайне: жирный H1 + подпись. */
.page-head {
  margin-bottom: 1.5rem;
}
.page-head h1 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  letter-spacing: -0.02em;
}
.page-head p {
  color: var(--sb-muted);
  margin-top: 0.25rem;
}

/* Анимация появления карточек. */
@keyframes shell-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.shell .auth-card,
.shell .lab-panel,
.shell .scan-card {
  animation: shell-rise 0.35s ease both;
}

/* ── мобильный сайдбар ─────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
}
@media (max-width: 900px) {
  body.shell {
    grid-template-columns: 1fr;
  }
  .shell__mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--sb-line);
    background: rgba(8, 11, 17, 0.85);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, var(--sb-w));
    transform: translateX(-102%);
    transition: transform 0.25s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55);
  }
  .sidebar.open {
    transform: none;
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 39;
  }
  .sidebar.open ~ .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  .shell__main {
    padding: 1rem;
  }
}

/* Бургер (в мобильной шапке). */
.burger {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: transparent;
  display: grid;
  place-items: center;
  gap: 4px;
  cursor: pointer;
}
.burger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--sb-text);
}
