/* === Header === */
.app-header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 10;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-header__logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  object-fit: contain;
  user-select: none;
}

.app-header__titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  line-height: 1.15;
}

.app-header__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__shift {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-on-surface-secondary);
  opacity: 0.6;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.app-header__shift-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.app-header__notice {
  position: relative;
  height: 40px;
  margin: 0 24px;
  padding: 0 48px 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1.25;
  color: rgba(230, 115, 0, 0.95);
  text-align: center;
  background: transparent;
  border: none;
}

.app-header__notice-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(230, 115, 0, 0.95);
  flex-shrink: 0;
}

[data-theme="dark"] .app-header__notice,
[data-theme="dark"] .app-header__notice-arrow {
  color: #FFB74D;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-header__actions .btn-text + .btn-icon {
  margin-left: 10px;
}

/* Между иконками поддержки, темы и профиля отступ заметно больше, чем
   общий gap: дополнительный margin-left поверх flex-gap, чтобы они не
   «слипались» визуально при уменьшенных размерах кнопок. */
.app-header__actions .btn-icon + .btn-icon {
  margin-left: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-on-surface-secondary);
  font-size: 18px;
  transition: background 0.15s;
}
.btn-icon svg {
  width: 22px;
  height: 22px;
}

.btn-icon:hover {
  background: var(--color-hover);
}

/* ============================================================

   Shared tool components — единая дизайн-система для
   инструментов центральной панели.
   Используйте .tool-toolbar, .tool-tabs, .tool-section,
   .tool-accordion, .tool-modal и .btn вместо тул-специфичных
   BEM-классов. Специфичные расширения допустимы, но базовая
   геометрия и состояния живут тут.
   ============================================================ */

/* === Main Layout === */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
  height: calc(100vh - var(--header-height));
  transition: grid-template-columns 0.25s ease;
}

.app-layout--sidebar-collapsed {
  grid-template-columns: var(--sidebar-left-collapsed-width) 1fr var(--sidebar-right-width);
}

.app-layout--sidebar-right-collapsed {
  grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-collapsed-width);
}

.app-layout--sidebar-collapsed.app-layout--sidebar-right-collapsed {
  grid-template-columns: var(--sidebar-left-collapsed-width) 1fr var(--sidebar-right-collapsed-width);
}


/* === Sidebars === */
.sidebar {
  background: var(--color-surface);
  border-right: none;
  padding: 0;
}

.sidebar-left::-webkit-scrollbar-track {
  background: var(--color-bg);
}

.sidebar-right {
  border-right: none;
  border-left: none;
}


/* === Collapsed Right Sidebar === */
.sidebar-right--collapsed {
  overflow-x: hidden;
}

.sidebar-right--collapsed .sidebar__header-text {
  display: none;
}

.sidebar-right--collapsed .sidebar__header {
  justify-content: center;
  padding: 0 8px;
}

.sidebar-right--collapsed .docs-search-wrap {
  display: none;
}

.sidebar-right--collapsed .docs-list {
  padding: 0 0 16px;
}

.sidebar-right--collapsed .doc-item {
  padding: 10px 4px;
  min-height: 39px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.sidebar-right--collapsed .docs-list .doc-item__short,
.sidebar-right--collapsed .docs-list .doc-item__full {
  display: none;
}

.sidebar-right--collapsed .doc-item__short-collapsed {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-on-surface);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-right--collapsed .doc-item--active .doc-item__short-collapsed {
  color: var(--color-primary);
  font-weight: 700;
}

.sidebar-right--collapsed .doc-section-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar-right--collapsed .doc-section-item__info {
  display: none;
}
.sidebar-right--collapsed .doc-section-item--active,
.sidebar-right--collapsed .doc-section-item--active:hover {
  box-shadow: none;
}

.sidebar-right--collapsed .doc-section-item__icon {
  width: 24px;
  height: 24px;
}

.sidebar__header {
  height: 48px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-on-surface-secondary);
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  /* Свёрнутый вариант = просто surface (старый цвет). Градиент надевается
     поверх через ::before — это даёт плавную анимацию opacity при
     разворачивании / сворачивании. */
  background: var(--color-surface);
  z-index: 5;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  cursor: pointer;
}

/* Градиент от surface к color-mix(primary 20%) поверх базового фона.
   Направление зависит от стороны сайдбара: у левого (инструменты) градиент
   идёт справа налево (primary справа, surface слева); у правого (документы)
   — наоборот, слева направо. При сворачивании прячем через opacity, чтобы
   переход был плавным (linear-gradient ↔ solid сам по себе не анимируется). */
.sidebar__header::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.sidebar .sidebar__header::before {
  background: linear-gradient(to right,
    color-mix(in srgb, var(--color-primary) 20%, var(--color-surface)),
    var(--color-bg));
}
.sidebar-right .sidebar__header::before {
  background: linear-gradient(to left,
    color-mix(in srgb, var(--color-primary) 20%, var(--color-surface)),
    var(--color-bg));
}
.sidebar--collapsed .sidebar__header::before,
.sidebar-right--collapsed .sidebar__header::before {
  opacity: 0;
}
/* Дочерние элементы должны быть над ::before. */
.sidebar__header > * {
  position: relative;
  z-index: 1;
}

.sidebar__toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-on-surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s;
  flex-shrink: 0;
}

.sidebar__toggle svg {
  width: 28px;
  height: 28px;
}

.sidebar--collapsed .sidebar__toggle {
  transform: rotate(180deg);
}

.sidebar-right--collapsed .sidebar__toggle--right {
  transform: rotate(180deg);
}


/* === Collapsed Sidebar === */
.sidebar--collapsed {
  overflow-x: hidden;
}

.sidebar--collapsed .sidebar__header-text {
  display: none;
}

.sidebar--collapsed .sidebar__header {
  justify-content: center;
  padding: 0 8px;
}

.sidebar--collapsed .tool-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar--collapsed .tool-item__info {
  display: none;
}

.sidebar--collapsed .tool-item__icon {
  width: 24px;
  height: 24px;
}


/* === Main Content (Center) === */
.main-content {
  overflow-y: auto;
  padding: 20px 16px;
  background: var(--color-bg);
}


/* === Tool Placeholder === */
.tool-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--color-on-surface-secondary);
}

.tool-placeholder__icon {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  color: var(--color-primary);
}
.tool-placeholder__icon svg {
  width: 100%;
  height: 100%;
}

.tool-placeholder__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-on-surface);
  margin-bottom: 12px;
}

.tool-placeholder__text {
  font-size: 15px;
  max-width: 420px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.tool-placeholder__stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 640px;
  margin-bottom: 36px;
}

.store-link {
  display: block;
  transition: transform 0.15s, filter 0.15s;
}
.store-link:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.store-link__badge {
  height: 56px;
  display: block;
}

.tool-placeholder__socials-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-on-surface-secondary);
  margin-bottom: 14px;
}

.tool-placeholder__socials {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.social-link {
  display: block;
  transition: transform 0.15s, filter 0.15s;
}
.social-link:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.social-link__badge {
  width: 48px;
  height: 48px;
  display: block;
}


/* === Placeholder === */
.placeholder-block {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  color: var(--color-on-surface-secondary);
  font-size: 14px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-sm);
  text-align: center;
  padding: 16px;
}

