/**
 * @file Top Side Bar component styles (Inline User-Section Tasks).
 * Слой 3: Компоненты (ADR-002)
 */

/* ==========================================================================
   1. Базовая разметка панели (3 колонки: лого | меню | юзер)
   ========================================================================== */
.topsidebar {
  background-color: var(--color-slate-50, #f8fafc);
  border-bottom: 1px solid var(--color-slate-200, #e2e8f0);
  width: 100%;
  height: 3.5rem; /* ~56px */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  display: flex;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topsidegrid {
  display: grid;
  grid-template-columns: 15rem 1fr auto; /* Меню занимает всю середину, юзер справа */
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 2rem;
  gap: 1.5rem;
}

/* ==========================================================================
   2. Брендинг (Оптимальный размер ячейки 40px + 100% логотип)
   ========================================================================== */
.logo-section {
  display: flex;
  align-items: center;
  padding: 0;
  overflow: hidden;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  height: 40px;
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon, .brand-icon-box img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.brand-text-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-ui, 'Golos UI', sans-serif);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-slate-900, #0f172a);
  white-space: nowrap;
}

.brand-subtitle {
  font-family: var(--font-ui, 'Golos UI', sans-serif);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-slate-400, #94a3b8);
  white-space: nowrap;
}

/* ==========================================================================
   3. Главная навигация (Строго по центру)
   ========================================================================== */
.main-navigation {
  display: flex;
  align-items: center;
  justify-content: center; /* Меню всегда идеально по центру шапки */
  height: 100%;
}

.main-navigation ul,
.main-navigation li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-navigation ul,
.main-navigation .nav-list {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem;
  height: 3.5rem !important;
}

.main-navigation .nav-item {
  display: flex !important;
  align-items: center !important;
  height: 100% !important;
}

.nav-link {
  height: 3.5rem !important;
  font-family: var(--font-ui, 'Golos UI', sans-serif);
  color: var(--color-slate-600, #475569);
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  align-items: center;
  padding: 0 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  display: flex;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover { color: var(--color-slate-900, #0f172a); }
.nav-link--active {
  color: var(--color-sber, #21a038);
  border-bottom-color: var(--color-sber, #21a038);
}

/* ==========================================================================
   5. Секция пользователя + Хитрый Фикс Табсов (Tasks)
   ========================================================================== */
.user-section {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

/* Выстраиваем внутренний регион как строку: табы встанут ЛЕВЕЕ меню */
.user-section .region-user-menu {
  display: flex !important;
  flex-direction: row-reverse !important; 
  align-items: center !important;
  gap: 1.5rem !important;
  height: 100% !important;
}

/* Сброс стилей для списков пользователя */
.user-section ul, .user-section li {
  list-style: none;
  margin: 0;
  padding: 0;
}

.user-section ul:not(.primary) {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.user-section .nav-link {
  height: auto !important;
  border-bottom: none !important;
  font-size: 0.875rem;
  color: var(--color-slate-600, #475569);
  padding: 0;
}

/* ---- ПРЕВРАЩАЕМ СИНИЙ СПИСОК ТАБСОВ В ПАНЕЛЬ КНОПОК ---- */
.user-section ul.tabs.primary,
.user-section ul.primary {
  display: flex !important;
  flex-direction: row !important; /* Строго в один горизонтальный ряд */
  gap: 4px !important;
  margin: 0 !important;
  padding: 4px !important;
  list-style: none !important;
  background-color: var(--color-slate-100, #f1f5f9) !important; /* Серый фон переключателя */
  border-radius: 6px !important;
  border: none !important;
}

.user-section ul.primary li {
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
}

/* Оформление ссылок («Просмотр», «Редактировать») */
.user-section ul.primary li a {
  font-family: var(--font-ui, 'Golos UI', sans-serif) !important;
  font-size: 0.75rem !important; /* Компактный размер для шапки */
  font-weight: 600 !important;
  color: var(--color-slate-600, #475569) !important;
  text-decoration: none !important; /* Убираем синее подчеркивание */
  padding: 4px 10px !important;
  border-radius: 4px !important;
  transition: all 0.1s ease-in-out !important;
  display: inline-block !important;
  white-space: nowrap !important;
}

.user-section ul.primary li a:hover {
  color: var(--color-slate-900, #0f172a) !important;
}

/* Активное состояние вкладки текущей страницы */
.user-section ul.primary li.is-active a {
  background-color: var(--color-white, #ffffff) !important;
  color: var(--color-slate-900, #0f172a) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Скрываем служебные заголовки и Devel блоки */
.user-section h2.visually-hidden,
.user-section .visually-hidden {
  display: none !important;
}
