/**
 * Task Sidebar — сворачиваемая навигационная панель заданий ЕГЭ
 * Push-layout: контент сдвигается вправо при открытой панели
 */

:root {
  --sidebar-width: 260px;
}

.task-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 900;
  display: flex;
  pointer-events: none;
}

.task-sidebar__toggle {
  position: fixed;
  top: 0.55rem;
  left: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.68rem;
  height: 2.68rem;
  background: rgba(22, 26, 30, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(79, 70, 229, 0.55);
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s ease;
  pointer-events: auto;
  z-index: 901;
  box-shadow: 0 10px 26px rgba(79, 70, 229, 0.25), 0 2px 10px rgba(6, 182, 212, 0.2);
  padding: 0.2rem;
}

.task-sidebar__toggle:hover {
  transform: translateY(-1px) scale(1.02);
  background: rgba(26, 31, 44, 0.96);
  border-color: rgba(6, 182, 212, 0.9);
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.32), 0 3px 14px rgba(6, 182, 212, 0.3);
}

.task-sidebar__toggle-icon {
  width: 2.12rem;
  height: 2.12rem;
  overflow: visible;
}

.task-sidebar--open .task-sidebar__toggle {
  display: none;
}

[data-theme="light"] .task-sidebar__toggle {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.16), 0 2px 10px rgba(6, 182, 212, 0.14);
}

[data-theme="light"] .task-sidebar__toggle:hover {
  background: rgba(245, 248, 255, 0.98);
  border-color: rgba(6, 182, 212, 0.75);
}

/* Panel */
.task-sidebar__panel {
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(22, 26, 30, 0.97);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  pointer-events: auto;
}

.task-sidebar--open .task-sidebar__panel {
  transform: translateX(0);
}

[data-theme="light"] .task-sidebar__panel {
  background: rgba(248, 248, 250, 0.98);
  border-right-color: rgba(0, 0, 0, 0.08);
}

/* Page content shift */
.task-solve-page,
.neuroege-hf-task-root {
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              padding-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.task-sidebar--open ~ .page.task-solve-page,
.task-sidebar--open ~ .neuroege-hf-task-root {
  margin-left: var(--sidebar-width);
}

/* Кнопка ≡ fixed в углу — не перекрывать бейдж «назад» в шапке страницы */
.task-sidebar:not(.task-sidebar--open) ~ .page.task-solve-page > .header.header--task,
.task-sidebar:not(.task-sidebar--open) ~ .neuroege-hf-task-root > .header.header--task {
  padding-left: 4.4rem;
}

/* На страницах HF-задач бейдж "назад" держим немного правее и одинаково */
body.neuroege-hyperformula-page .header.header--task .header__task-badge,
body.neuroege-python-task2-page .header.header--task .header__task-badge {
  margin-left: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  padding: 0.36rem 0.72rem 0.38rem 0.66rem;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(5, 184, 125, 0.3);
  background: linear-gradient(140deg, rgba(22, 28, 34, 0.9) 0%, rgba(15, 19, 24, 0.86) 100%);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body.neuroege-hyperformula-page .header.header--task .header__task-badge:hover,
body.neuroege-python-task2-page .header.header--task .header__task-badge:hover {
  transform: translateY(-1px);
  border-color: rgba(5, 184, 125, 0.55);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(5, 184, 125, 0.16);
}

body.neuroege-hyperformula-page .header.header--task .header__task-arrow,
body.neuroege-python-task2-page .header.header--task .header__task-arrow {
  font-size: 1rem;
  line-height: 1;
  color: rgba(5, 184, 125, 0.95);
  transform: translateY(-1px);
}

body.neuroege-hyperformula-page .header.header--task .header__task-num,
body.neuroege-python-task2-page .header.header--task .header__task-num {
  display: inline-flex;
  flex-direction: column;
  gap: 0.08rem;
  line-height: 1.15;
}

body.neuroege-hyperformula-page .header.header--task .header__task-num-meta,
body.neuroege-python-task2-page .header.header--task .header__task-num-meta {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
  color: rgba(236, 245, 242, 0.86);
}

body.neuroege-hyperformula-page .header.header--task .header__task-num-title,
body.neuroege-python-task2-page .header.header--task .header__task-num-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.012em;
  color: rgba(246, 252, 250, 0.98);
}

[data-theme="light"] body.neuroege-hyperformula-page .header.header--task .header__task-badge,
[data-theme="light"] body.neuroege-python-task2-page .header.header--task .header__task-badge {
  border-color: rgba(5, 184, 125, 0.28);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 250, 248, 0.95) 100%);
  box-shadow: 0 4px 14px rgba(26, 36, 48, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

[data-theme="light"] body.neuroege-hyperformula-page .header.header--task .header__task-badge:hover,
[data-theme="light"] body.neuroege-python-task2-page .header.header--task .header__task-badge:hover {
  border-color: rgba(5, 184, 125, 0.48);
  box-shadow: 0 7px 16px rgba(26, 36, 48, 0.12), 0 0 0 1px rgba(5, 184, 125, 0.14);
}

[data-theme="light"] body.neuroege-hyperformula-page .header.header--task .header__task-num-meta,
[data-theme="light"] body.neuroege-python-task2-page .header.header--task .header__task-num-meta {
  color: rgba(25, 35, 46, 0.68);
}

[data-theme="light"] body.neuroege-hyperformula-page .header.header--task .header__task-num-title,
[data-theme="light"] body.neuroege-python-task2-page .header.header--task .header__task-num-title {
  color: rgba(14, 24, 33, 0.95);
}

/* Header */
.task-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

[data-theme="light"] .task-sidebar__header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.task-sidebar__title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.task-sidebar__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.task-sidebar__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .task-sidebar__close {
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .task-sidebar__close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.8);
}

/* Nav list */
.task-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.task-sidebar__nav::-webkit-scrollbar {
  width: 4px;
}

.task-sidebar__nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

[data-theme="light"] .task-sidebar__nav {
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

[data-theme="light"] .task-sidebar__nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

.task-sidebar__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.75);
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.task-sidebar__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.95);
}

.task-sidebar__item--active {
  background: rgba(5, 184, 125, 0.12);
  color: var(--green, #05b87d);
  border-left-color: var(--green, #05b87d);
}

.task-sidebar__item--active:hover {
  background: rgba(5, 184, 125, 0.18);
  color: var(--green, #05b87d);
}

.task-sidebar__item--locked {
  opacity: 0.45;
}

.task-sidebar__item--locked:hover {
  opacity: 0.65;
}

[data-theme="light"] .task-sidebar__item {
  color: rgba(0, 0, 0, 0.65);
}

[data-theme="light"] .task-sidebar__item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.9);
}

[data-theme="light"] .task-sidebar__item--active {
  background: rgba(5, 184, 125, 0.08);
  color: var(--green, #05b87d);
}

.task-sidebar__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.task-sidebar__item--active .task-sidebar__num {
  background: rgba(5, 184, 125, 0.2);
  color: var(--green, #05b87d);
}

[data-theme="light"] .task-sidebar__num {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .task-sidebar__item--active .task-sidebar__num {
  background: rgba(5, 184, 125, 0.15);
}

.task-sidebar__text {
  min-width: 0;
}

.task-sidebar__task-title {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-sidebar__task-sub {
  font-size: 0.65rem;
  opacity: 0.55;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
