/* =========================
   Universes (OLD layout) + Theme + Background wrap
   ========================= */

/* розтягуємо контейнер як раніше */
main.site-container {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* =========================
   Theme tokens
   ========================= */
:root {
  --text: #111;
  --muted: #555;

  --panel: rgba(255, 255, 255, .84);
  --panel-border: rgba(0, 0, 0, .12);

  --admin-surface: rgba(255, 255, 255, 0.85);

  --input-bg: rgba(255, 255, 255, .90);
  --input-border: #ccc;

  --btn-bg: #333;
  --btn-bg-hover: #000;
  --btn-text: #fff;

  --page-pad: 16px;

  /* fallback bg like part */
  --part-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_LIGHT.webp");
}

/* DARK */
body.theme-dark,
body.dark,
html[data-theme="dark"] body {
  --text: #fff;
  --muted: rgba(255, 255, 255, .78);

  --panel: rgba(15, 15, 15, .66);
  --panel-border: rgba(255, 255, 255, .10);

  --admin-surface: rgba(15, 15, 15, .78);

  --input-bg: rgba(0, 0, 0, .35);
  --input-border: rgba(255, 255, 255, .18);

  --btn-bg: rgba(0, 0, 0, .65);
  --btn-bg-hover: rgba(0, 0, 0, .85);
  --btn-text: #fff;

  --part-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_NIGHT.webp");
}

/* LIGHT explicit */
body.theme-light,
body.light,
html[data-theme="light"] body {
  --part-bg-fallback: url("/static/main_img/NoIMG/NoIMG_bg_LIGHT.webp");
}

html,
body {
  margin: 0;
  color: var(--text);
  font-family: Arial, sans-serif;
}

/* =========================
   Background wrap (як у прикладі)
   ========================= */
.part-bg-wrap {
  min-height: 100vh;
  width: 100%;
  position: relative;

  background-image: var(--part-bg-url, var(--part-bg-fallback));
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;

  overflow-x: hidden;
}

@media (max-width: 900px) {
  .part-bg-wrap {
    background-attachment: scroll;
  }
}

/* =========================
   HEADER (зберігаємо тексти/overlay, але робимо:
   - вужчий блок
   - вищу картинку
   ========================= */
.universe-list-header {
  position: sticky;
  top: 10px;
  /* трохи відлип від верха */
  z-index: 50;

  width: min(1200px, 94vw);
  /* ВУЖЧЕ (було 100%) */
  margin: 12px auto 0;

  border-radius: 18px;
  /* як у part */
  overflow: hidden;
  /* щоб закруглення працювало */
}

/* Щоб зберегти закруглення самої картинки */
.universe-list-header img.bg {
  width: 100%;

  /* ВИЩЕ (було 26vh через height контейнера) */
  height: 42vh;
  min-height: 300px;
  max-height: 520px;

  object-fit: cover;
  display: block;

  /* у світлій темі НЕ затемнюємо, у темній - нижче */
  filter: none;
}

/* затемнення тільки в dark */
body.theme-dark .universe-list-header img.bg,
body.dark .universe-list-header img.bg,
html[data-theme="dark"] body .universe-list-header img.bg {
  filter: brightness(60%);
}

/* =========================
   Universe header overlay
   ========================= */
.universe-list-header .overlay {
  position: absolute;
  bottom: 12%;
  left: 6%;
  right: 6%;

  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;

  font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem);
  line-height: 1.1;
  letter-spacing: 0.02em;

  color: #ffffff;

  /* better wrapping */
  word-break: break-word;
  overflow-wrap: anywhere;

  /* readable + subtle accent */
  text-shadow:
    0 6px 24px rgba(0, 0, 0, 0.5),
    0 0 16px rgba(34, 197, 94, 0.18);
}

/* =========================
   Title
   ========================= */
.universe-list-header h1 {
  margin: 0;

  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;

  font-size: clamp(2rem, 1.4rem + 2.2vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.02em;

  color: #ffffff;

  text-shadow:
    0 6px 24px rgba(0, 0, 0, 0.55),
    0 0 14px rgba(34, 197, 94, 0.15);
}

/* =========================
   Subtitle
   ========================= */
.universe-list-header p.sub {
  margin-top: 6px;

  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 500;

  font-size: clamp(1rem, 0.9rem + 0.6vw, 1.3rem);
  line-height: 1.3;
  letter-spacing: 0.01em;

  color: rgba(255, 255, 255, 0.78);

  text-shadow:
    0 4px 16px rgba(0, 0, 0, 0.45);
}

/* =========================
   DARK THEME
   ========================= */
body.theme-dark .universe-list-header .overlay {
  color: #ffffff;
  text-shadow:
    0 6px 24px rgba(0, 0, 0, 0.65),
    0 0 16px rgba(34, 197, 94, 0.18);
}

body.theme-dark .universe-list-header h1 {
  color: #ffffff;
}

body.theme-dark .universe-list-header p.sub {
  color: rgba(255, 255, 255, 0.75);
}

/* =========================
   LIGHT THEME
   ========================= */
body.theme-light .universe-list-header .overlay {
  color: #111111;
  text-shadow:
    0 4px 16px rgba(255, 255, 255, 0.7),
    0 0 12px rgba(34, 197, 94, 0.12);
}

body.theme-light .universe-list-header h1 {
  color: #111111;
  text-shadow:
    0 4px 14px rgba(255, 255, 255, 0.65);
}

body.theme-light .universe-list-header p.sub {
  color: rgba(0, 0, 0, 0.65);
  text-shadow:
    0 3px 10px rgba(255, 255, 255, 0.6);
}

/* =========================
   Mobile tweaks
   ========================= */
@media (max-width: 640px) {
  .universe-list-header .overlay {
    bottom: 10%;
    left: 5%;
    right: 5%;
  }

  .universe-list-header p.sub {
    margin-top: 4px;
  }
}

/* =========================
   header-admin: прибираємо “дубль-контейнер”
   (залишаємо ТІЛЬКИ позиціювання)
   ========================= */
.header-admin {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 100;

  /* було: padding/bg/border/blur - це і дублювало стиль */
  padding: 0;
  border-radius: 0;
  font-size: inherit;

  background: transparent;
  border: 0;

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ===== СПІЛЬНИЙ USER HEADER ===== */
/* (залишив твої, просто theme-safe) */
.user-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.user-header-role {
  font-weight: 600;
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-menu-toggle {
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  border: none;
  padding: 4px 12px;
  color: #fff;
  cursor: pointer;
  font: inherit;
}

/* dropdown */
.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 4px;

  background: rgba(0, 0, 0, 0.9);
  padding: 6px 0;
  border-radius: 8px;
  min-width: 190px;
  z-index: 50;
}

.user-menu-dropdown a {
  display: block;
  padding: 4px 12px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.user-menu-dropdown a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-menu.open .user-menu-dropdown {
  display: block;
}

/* =========================
   OLD container/toolbars/cards (1:1)
   ========================= */

/* Контейнер списку під хедером */
.universe-list-container {
  max-width: 100%;
  margin: 28px 0;
  padding: 0 var(--page-pad);
}

/* легкий glass-підклад (щоб текст читався на фоні), але без зміни layout */
.universe-list-container::before {
  content: "";
  display: block;
  height: 0;
}

/* toolbar */
.universe-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;

  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 10px 12px;

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.universe-list-toolbar-title {
  font-size: 1rem;
  color: var(--muted);
}

/* search */
.universe-search-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.universe-search-form input[type="text"] {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  min-width: 220px;

  background: var(--input-bg);
  color: var(--text);
  outline: none;
}

.universe-search-form button {
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
}

.universe-search-form button:hover {
  background: var(--btn-bg-hover);
}

/* admin actions row */
.universe-admin-actions {
  margin: 6px 0 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================
   Admin buttons: зробити як у part
   (але без зміни твоєї розмітки)
   ========================= */
.universe-admin-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 12px;
  /* трішки “part-like” */
  border-radius: 999px;

  border: 1px solid var(--panel-border);

  /* було: background var(--panel) + blur, тепер: як pill у part */
  background: rgba(0, 0, 0, .55);
  color: #fff;

  text-decoration: none;
  font-weight: 700;
  font-size: .92rem;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  transition: background-color .2s ease, border-color .2s ease, transform .08s ease;
}

.universe-admin-actions .btn:hover {
  background: rgba(0, 0, 0, .72);
  border-color: rgba(255, 255, 255, .30);
}

.universe-admin-actions .btn:active {
  transform: translateY(1px);
}

/* у світлій темі - світла pill */
body.theme-light .universe-admin-actions .btn,
body.light .universe-admin-actions .btn,
html[data-theme="light"] body .universe-admin-actions .btn {
  background: rgba(255, 255, 255, .70);
  border-color: rgba(0, 0, 0, .18);
  color: #111;
}

body.theme-light .universe-admin-actions .btn:hover,
body.light .universe-admin-actions .btn:hover,
html[data-theme="light"] body .universe-admin-actions .btn:hover {
  background: rgba(255, 255, 255, .88);
}

/* section titles (замість inline) */
.universe-section-title {
  margin: 12px 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* list/cards */
.universe-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
}

.universe-card {
  position: relative;
  display: block;
  background: #000;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.universe-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.universe-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

/* overlay текст як було */
.universe-card-overlay {
  position: absolute;
  left: 24px;
  bottom: 20px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.universe-card-title {
  font-size: 1.6rem;
  font-weight: 700;
}

.universe-card-sub {
  font-size: 0.95rem;
  margin-top: 4px;
  opacity: 0.9;
}

.universe-card-badge {
  font-size: 0.8rem;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.6);
  vertical-align: middle;
}

.universes-empty {
  margin: 10px 0 0;
  color: var(--muted);
}

/* =========================
   Mobile
   ========================= */
@media (max-width: 720px) {
  .universe-list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .universe-search-form input[type="text"] {
    min-width: 0;
    width: 100%;
  }

  .universe-card-overlay {
    left: 16px;
    bottom: 14px;
  }

  .universe-card-title {
    font-size: 1.35rem;
  }
}

/* =========================
   GLASS CONTAINER for EVERYTHING under header
   ========================= */

/* контейнер списку під хедером - тепер це ПАНЕЛЬ */
.universe-list-container {
  max-width: min(1200px, 94vw);
  margin: 18px auto 28px;
  padding: 14px 16px;
  box-sizing: border-box;

  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}

/* якщо ти додала .universe-glass - воно просто дублює те саме */
.universe-glass {
  max-width: min(1200px, 94vw);
  margin: 18px auto 28px;
  padding: 14px 16px;
  box-sizing: border-box;

  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}

/* тулбар більше НЕ має свого “великого” бекграунду,
   бо він вже всередині панелі */
.universe-list-toolbar {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 14px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;

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

/* щоб візуально відділити тулбар - тонка лінія */
.universe-list-toolbar::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--panel-border);
  flex: 1 1 auto;
  margin-left: 12px;
  opacity: .8;
}

/* у мобільному, коли тулбар стає колонкою - не треба лінії */
@media (max-width: 720px) {
  .universe-list-toolbar::after {
    display: none;
  }
}

/* секції/заголовки тепер гарно виглядають всередині панелі */
.universe-section-title {
  margin: 14px 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);

  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

/* (не змінює картки) тільки дає трохи “повітря” всередині панелі */
.universe-list {
  margin-top: 10px;
}

/* мобільні відступи контейнера + хедер висота */
@media (max-width: 720px) {
  .universe-list-container {
    max-width: min(1200px, 94vw);
    padding: 12px 12px;
  }

  .universe-list-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .universe-list-header img.bg {
    height: 38vh;
    min-height: 260px;
  }
}

/* =========================
   Universes: ⚙ buttons - EXACT like part
   ========================= */

.universe-page .universes-actions a.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 10px;
  border-radius: 12px;

  font-weight: 600;
  font-size: .92rem;
  line-height: 1;

  text-decoration: none;
  user-select: none;
  white-space: nowrap;

  background: var(--btn-surface);
  border: 1px solid var(--btn-border);
  color: var(--text);

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  transition:
    background-color .22s ease,
    border-color .22s ease,
    color .22s ease,
    box-shadow .22s ease,
    transform .08s ease;
}

.universe-page .universes-actions a.btn:hover {
  background: var(--btn-surface-hover);
}

.universe-page .universes-actions a.btn:active {
  transform: translateY(1px);
}

.universe-page .universes-actions a.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.universe-list-header img.bg {
  filter: none !important;
}

.universe-category-filters .part-pill-link button {
  min-width: 170px;
}

/* =========================
   Universe category tabs
   ========================= */

.universe-category-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;

  margin: 12px auto 18px;
  padding: 0 6px;
}

.universe-category-link {
  text-decoration: none;
}

.universe-category-link button {
  min-width: 170px;
  padding: 14px 20px;
  border-radius: 12px;

  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2px;

  cursor: pointer;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.08s ease,
    box-shadow 0.2s ease;
}

.universe-category-link button:active {
  transform: translateY(1px);
}

/* DARK */
body.theme-dark .universe-category-link button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.85);
}

body.theme-dark .universe-category-link button:hover {
  background: rgba(255, 255, 255, 0.14);
}

body.theme-dark .universe-category-link button.active {
  background: #ffffff;
  color: #111111;
  border-color: #111111;
}

/* LIGHT */
body.theme-light .universe-category-link button {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.25);
  color: #111111;
}

body.theme-light .universe-category-link button:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.45);
}

body.theme-light .universe-category-link button.active {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

