/* static/home/home.css */
:root {
  --bg: #0f141a;
  --panel: #121a22;
  --card: #16212b;
  --card-2: #172432;
  --text: #e6edf3;
  --muted: #9fb0bf;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #5aa7ff;
  --danger: #ff5d5d;

  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 720px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;

  --topbar-h: 64px;
  --footbar-h: 64px;
  --globalplayer-h: 100px;

  --nav-btn: 44px; /* добавили: размер кнопок в футере */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: radial-gradient(1000px 600px at 50% -150px, rgba(90,167,255,0.18), transparent 60%),
              var(--bg);
  color: var(--text);
}

.topbar {
  /* было sticky — заменяем на fixed, чтобы не зависеть от скролл-контейнеров */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: var(--topbar-h);          /* важно: фиксируем высоту */
  z-index: 1000;

  background: rgba(18, 26, 34, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: calc(var(--maxw) + 48px);
  margin: 0 auto;
  height: 100%;                     /* чтобы внутренности жили в высоте topbar */
  padding: 0 16px;                  /* вертикальные отступы убрали, чтобы не ломать высоту */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
  flex-shrink: 1;
}

.channel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(90,167,255,0.95), rgba(120,255,214,0.65));
  box-shadow: 0 8px 18px rgba(90,167,255,0.18);

  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.channel-avatar::before {
  content: "UT";
  display: block;
  color: rgba(15, 20, 26, 0.95);
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-family: inherit;
  transform: translateY(-0.5px);
  text-transform: uppercase;
}

.channel-name {
  font-weight: 700;
  line-height: 1.1;
}

.channel-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.topbar__actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: visible;
  flex-shrink: 0;
}

/* ВАЖНО: всё ограничиваем .topbar, чтобы не ломать auth pages */
.topbar .user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  overflow: visible;
}

.topbar .user-chip,
.topbar .user-chip--button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;

  width: auto;
  max-width: none;

  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;

  padding: 8px 12px;
  border-radius: 999px;
  box-sizing: border-box;
  white-space: nowrap;

  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.topbar .user-chip:hover,
.topbar .user-chip--button:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(90, 167, 255, 0.30);
}

.topbar .user-chip:active,
.topbar .user-chip--button:active {
  transform: translateY(1px);
}

.topbar .user-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #3be477;
  box-shadow: 0 0 0 3px rgba(59,228,119,0.12);
  flex: 0 0 auto;
}

.topbar .user-chip__text {
  font-size: 13px;
  color: rgba(230, 237, 243, 0.96);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.topbar .user-chip__chevron {
  font-size: 12px;
  line-height: 1;
  opacity: 0.85;
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}

.topbar .user-menu.is-open .user-chip__chevron {
  transform: rotate(180deg);
}

.topbar .user-menu__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  box-sizing: border-box;
  z-index: 5000;

  background: rgba(18, 26, 34, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.topbar .user-menu__dropdown[hidden] {
  display: none !important;
}

.topbar .user-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;

  padding: 10px 12px;
  border: 0;
  background: transparent;

  text-align: left;
  font: inherit;
  color: var(--text);
  text-decoration: none;

  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.topbar .user-menu__item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.topbar .user-menu__item--danger {
  color: #ff8f8f;
}

.topbar .user-menu__item--danger:hover {
  background: rgba(255, 93, 93, 0.12);
  color: #ffd0d0;
}

.topbar .user-menu__form {
  margin: 0;
}

.topbar .topbar__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.topbar .topbar__btn--primary {
  border-color: rgba(90,167,255,0.45);
  background: rgba(90,167,255,0.12);
  color: rgba(230,237,243,0.98);
}

.topbar .topbar__btn:hover {
  filter: brightness(1.06);
}

.empty {
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: var(--radius);
  padding: 18px 14px;
  background: rgba(255,255,255,0.03);
  text-align: center;
}
.empty__title { font-weight: 800; }
.empty__text { margin-top: 6px; color: var(--muted); font-size: 13px; }

.page {
  max-width: calc(var(--maxw) + 48px);
  margin: 0 auto;

  padding: 18px 16px 40px;
  padding-top: calc(var(--topbar-h) + 5px);

  /* важно: чтобы лента не уходила под нижнее меню */
  padding-bottom: calc(var(--footbar-h) + 5px);
}

/* Нижняя панель навигации */
.footbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  height: var(--footbar-h);
  z-index: 1000;

  background: rgba(18, 26, 34, 0.90);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}

.footbar__inner {
  max-width: calc(var(--maxw) + 48px);
  height: 100%;
  margin: 0 auto;
  padding: 10px 12px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footbar__left,
.footbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Кнопки как channel-avatar (градиент + тень) */
.footbar__btn {
  width: var(--nav-btn);
  height: var(--nav-btn);
  border-radius: 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
  user-select: none;
  cursor: pointer;

  background: linear-gradient(135deg, rgba(90,167,255,0.95), rgba(120,255,214,0.65));
  box-shadow: 0 8px 18px rgba(90,167,255,0.16);
  border: 1px solid rgba(255,255,255,0.08);

  color: rgba(15, 20, 26, 0.95);
  font-weight: 900;
  letter-spacing: 0.2px;
  padding: 0;
}

.footbar__btn-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  border-radius: 18px;
  padding: 20px 18px 18px;
  background: rgba(18, 26, 34, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal__header {
  align-items: center;
  gap: 12px;
  padding-right: 44px;
  margin-bottom: 14px;
}

.modal__icon {
  height: 44px;
  flex: 0 0 auto;
}

.modal__title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.modal__subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal__text {
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.5;
}

.modal__meta {
  display: grid;
  gap: 8px;
}

.modal__version,
.modal__contact {
  margin: 0;
  color: var(--muted);
}

.modal__contact a {
  color: var(--accent);
  text-decoration: none;
}

.modal__contact a:hover {
  text-decoration: underline;
}

.footbar__btn:hover {
  filter: brightness(1.06);
}

.footbar__btn:active {
  transform: translateY(1px);
}

/* Текст-заглушка (потом заменишь на пиктограммы) */
.footbar__btn-text {
  font-size: 12px;
  line-height: 1;
}

/* Активная кнопка — подсветка */
.footbar__btn.is-active {
  box-shadow:
    0 10px 22px rgba(90,167,255,0.22),
    0 0 0 3px rgba(90,167,255,0.18);
  border-color: rgba(90,167,255,0.35);
}

/* Song Base чуть “важнее” */
.footbar__btn--songbase {
  background: linear-gradient(135deg, rgba(90,167,255,1), rgba(90,167,255,0.45));
  color: rgba(230,237,243,0.98);
}

/* Новый media query для маленьких экранов */
@media (max-width: 480px) {
  .topbar__inner {
    padding: 0 8px; /* Уменьшаем отступы для экономии места */
    gap: 8px;
  }
  .topbar__title {
    min-width: auto; /* Позволяем сжиматься */
    gap: 8px;
    flex-shrink: 1; /* Новое:允许 title сжиматься, чтобы дать место actions */
  }
  .channel-avatar {
    width: 32px;
    height: 32px;
  }
  .channel-name {
    font-size: 14px;
    white-space: nowrap; /* Новое: не даём имени канала переноситься */
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .channel-sub {
    font-size: 11px;
  }
  .topbar__actions {
    flex-wrap: nowrap; /* Запрещаем перенос, чтобы не выходить по высоте */
    gap: 6px;
    flex-shrink: 1; /* Новое:允许 actions сжиматься при нехватке места */
    justify-content: flex-end; /* Подтверждаем выравнивание вправо */
    /* Убираем overflow-x: auto, чтобы избежать обрезки; вместо этого полагаемся на сжатие */
  }
  .user-chip {
    padding: 6px 8px;
    gap: 6px;
    flex-shrink: 1; /* Новое:允许 чипу сжиматься */
  }
  .user-chip__text {
    font-size: 12px;
    white-space: nowrap; /* Не даём тексту переноситься */
    overflow: hidden;
    text-overflow: ellipsis; /* Обрезаем длинный текст с ... */
    max-width: 100px; /* Уменьшаем max-width для большего сжатия (было 120px) */
  }
  .btn {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap; /* Новое: кнопка не переносится */
  }
}