/* ══════════════════════════════════════════════════════════════════
   ОБЩИЙ UI-KIT (CSS) — используется и CRM-дашбордом (dashboard.html), и
   дашбордом стримера (streamer_dashboard.html): кастомный select, ресайз
   выезжающих панелей, плашка режима имперсонации, юзер-пилюля в шапке.
   Раньше стили были продублированы в обоих местах по отдельности.
   ══════════════════════════════════════════════════════════════════ */

.view-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.view-btn.active { background: var(--accent); color: #fff; }
.logo-icon { width: 34px; height: 34px; image-rendering: pixelated; }
.user-pill {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 7px;
  }
.user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.mode-switch-pill:hover { background: rgba(167,139,250,0.12); border-color: rgba(167,139,250,0.4); color: var(--text); }

/* ── Section switcher: hover dropdown showing the current dashboard
   section (CRM/Стример/MediaLOG) in the topbar pill, with the other
   accessible sections listed below on hover — same interaction pattern as
   the artist/user switcher on the public queue page (see .user-switcher /
   .user-switcher-dropdown in templates/share.html). Pure-CSS :hover, no JS
   needed; markup comes from templates/partials/_topbar_macros.html. ── */
.section-switcher { position: relative; display: inline-flex; }
.section-switcher-trigger { user-select: none; }
.section-switcher-chevron { margin-left: 1px; font-size: 9px; opacity: .5; transition: transform .2s ease; }
.section-switcher:hover .section-switcher-chevron { transform: rotate(180deg); opacity: 1; }
.section-switcher-dropdown {
  /* No margin-top here on purpose — a real gap between the trigger and the
     dropdown would be a dead zone where the cursor leaves .section-switcher
     entirely before reaching the list, closing it via :hover before the
     user gets there. Starting flush at top:100% and pushing the visible
     content down with top padding instead keeps the hoverable box (and
     thus the whole gap) continuous — same trick as .user-switcher-dropdown
     in templates/share.html. */
  position: absolute; top: 100%; left: 0;
  min-width: 190px;
  background: rgba(18,18,28,0.97);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(16px);
  padding: 10px 6px 6px;
  z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.section-switcher:hover .section-switcher-dropdown,
.section-switcher:focus-within .section-switcher-dropdown {
  opacity: 1; pointer-events: all;
}
.section-switcher-dropdown a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
  white-space: nowrap;
}
.section-switcher-dropdown a:hover { background: rgba(255,255,255,0.08); }
.section-switcher-dropdown a.current { color: var(--accent); pointer-events: none; }
.section-switcher-dropdown a .mode-switch-icon { font-size: 13px; line-height: 1; }
.section-switcher-dropdown a .mode-switch-icon i { font-size: 14px; line-height: 1; vertical-align: -1px; }

.imp-pill {
    display: flex; align-items: center; gap: 6px;
    background: rgba(251,113,133,0.12);
    border: 1px solid rgba(251,113,133,0.4);
    border-radius: 20px;
    padding: 5px 6px 5px 12px;
    font-size: 12px; font-weight: 600;
    color: #fca5a5;
    white-space: nowrap;
  }
.imp-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #fb7185; box-shadow: 0 0 8px #fb7185; flex-shrink: 0; }
.imp-pill-exit {
    background: #fb7185; color: #1a0a0a; border: none; border-radius: 50%;
    width: 20px; height: 20px; font-size: 12px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    transition: background .15s;
  }
.imp-pill-exit i { font-size: 13px; }
.imp-pill-exit:hover { background: #f43f5e; }
.hbtn:hover { background: rgba(255,255,255,0.1); color: var(--text); border-color: rgba(255,255,255,0.15); }

/* ══════════════════════════════════════════════════════════════════
   Выезжающая боковая панель «Настройки» — общая оболочка для CRM
   (#profilePanel), дашборда стримера (#creditsPanel) и MediaLOG
   (#mlSettingsPanel). Раньше каждая панель целиком описывала свою форму
   (позиция/transform/фон/тень) в собственном CSS-файле — теперь это
   здесь, а в файле каждого приложения остаётся только ширина
   (своя CSS-переменная на панель, т.к. у каждой свой запомненный размер).
   Требует на элементе оба класса: например
   class="settings-side-panel profile-panel". ══════════════════════════ */
.settings-side-panel {
  position: fixed; top: calc(60px + var(--imp-banner-h, 0px)); bottom: 0; right: 0; z-index: 250;
  max-width: 100vw;
  overflow-y: auto;
  background: #141418;
  border-left: 1px solid var(--border);
  padding: 24px;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.22,.68,0,.99);
  box-shadow: -20px 0 60px rgba(0,0,0,.5);
}
.settings-side-panel.open { transform: translateX(0); }
.settings-side-panel.resizing { transition: none; }
.settings-side-panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 20px; }

/* Маркер перетаскивания ширины панели — общая механика (позиция/размер/
   курсор), «right» (следует за краем конкретной панели) остаётся в
   CSS каждого приложения, т.к. ссылается на свою CSS-переменную ширины. */
.panel-resize-handle {
  position: fixed; top: calc(60px + var(--imp-banner-h, 0px)); bottom: 0;
  width: 14px; z-index: 252;
  display: flex; align-items: center; justify-content: center;
  cursor: ew-resize; touch-action: none;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}

/* ── Вкладки внутри панели «Настройки» (сегментированный переключатель-
   «таблетка»: «Профиль/Оформление/Ссылки» в CRM и MediaLOG). Работает в
   паре с settingsShowTab() из ui-kit.js, которая ищет ближайший
   .settings-side-panel — поэтому один и тот же набор классов подходит
   любой панели без привязки к конкретному id.
   Раздел «Кредитсы» стримерского дашборда пока использует свой отдельный
   компонент (.panel-tabs/.panel-tab-btn + switchCreditsTab/switchNotifyTab)
   — он устроен иначе (вложенные вкладки по id, не по data-атрибуту) и
   в этот раз не объединялся, чтобы не рисковать уже рабочей логикой. ── */
.settings-tabs {
  display: flex; gap: 6px; flex-wrap: nowrap;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
  margin: -4px 0 22px;
  /* Когда панель узкая и все вкладки не помещаются — вместо того, чтобы
     вылезать за край панели (текст последней вкладки обрезался бордером
     родителя), даём полоске вкладок скроллиться по горизонтали. */
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.settings-tabs::-webkit-scrollbar { height: 4px; }
.settings-tabs::-webkit-scrollbar-track { background: transparent; }
.settings-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.settings-tab-btn {
  flex: 1 1 auto; min-width: max-content; background: transparent; border: none; border-radius: 7px;
  color: var(--muted); font-family: var(--font-main, 'Manrope', sans-serif);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  padding: 8px 10px; text-align: center; cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s;
}
.settings-tab-btn:hover { color: var(--text); }
.settings-tab-btn.active { background: var(--accent); color: #fff; }
.settings-tab-page { display: none; }
.settings-tab-page.active { display: block; animation: settingsTabFadeIn .15s ease; }
@keyframes settingsTabFadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.panel-resize-handle.open { opacity: 1; pointer-events: auto; }
.panel-resize-handle.resizing { transition: none; }
.panel-resize-handle-grip {
    width: 4px; height: 52px; border-radius: 4px;
    background: rgba(255,255,255,0.14);
    transition: background 0.15s, height 0.15s;
  }
.panel-resize-handle:hover .panel-resize-handle-grip,
  .panel-resize-handle.resizing .panel-resize-handle-grip {
    background: var(--accent); height: 68px;
  }
.cs-native-hidden { display: none !important; }
.cs-select.disabled .cs-trigger { opacity: 0.5; cursor: not-allowed; }
.cs-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cs-trigger-label.placeholder { color: var(--muted); }
.cs-select.open .cs-chevron { transform: rotate(180deg); }
.cs-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.cs-panel.flip { transform: translateY(6px) scale(0.98); }
.cs-panel.flip.open { transform: translateY(0) scale(1); }
.cs-panel::-webkit-scrollbar { width: 8px; }
.cs-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.cs-option {
    padding: 9px 12px; border-radius: 8px; font-size: 13px; color: var(--text);
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background 0.12s, color 0.12s;
  }
.cs-panel-empty { padding: 14px 12px; font-size: 12px; color: var(--muted); text-align: center; }
.pf-row { margin-bottom: 16px; }
.btn-profile-save:hover { opacity: 0.9; }
