/* ===========================================================================
   Universal Cassino — neutral admin-driven theme.

   Scope rules:
     * .universal-* classes are isolated by prefix — no global selectors.
     * .universal-content is intentionally minimal: only width container +
       safe responsive img/video/iframe rule. We do NOT style headings,
       paragraphs, lists, tables, links inside CMS body — managers paste
       complete HTML with their own <style> blocks, which scope_inline_styles
       scopes under .universal-content automatically.
   =========================================================================== */

:root {
  --uc-bg: #f7f8fb;
  --uc-ink: #1a2233;
  --uc-ink-soft: #4a5468;
  --uc-muted: #6b7689;
  --uc-line: #e2e6ee;
  --uc-accent: #f0a500;
  --uc-accent-ink: #1a1100;
  --uc-header-bg: #121826;
  --uc-header-ink: #e9ecf3;
  --uc-header-ink-soft: #aeb6c5;
  --uc-footer-bg: #0f1422;
  --uc-footer-ink: #c6cbd6;
  --uc-footer-ink-soft: #8e95a4;
  --uc-radius-sm: 6px;
  --uc-container: 1120px;
  --uc-font: "Inter", "Helvetica Neue", Arial, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body.universal-body {
  margin: 0;
  font-family: var(--uc-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--uc-ink);
  background: var(--uc-bg);
  -webkit-text-size-adjust: 100%;
}

.universal-container {
  width: 100%;
  max-width: var(--uc-container);
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.universal-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--uc-accent);
  color: var(--uc-accent-ink);
  padding: 8px 14px;
  z-index: 1000;
  border-radius: var(--uc-radius-sm);
  font-weight: 600;
}

.universal-skip:focus {
  left: 16px;
  top: 16px;
}

/* ---------- Header ------------------------------------------------------- */

.universal-header {
  background: var(--uc-header-bg);
  color: var(--uc-header-ink);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  /* Длинный бренд не должен создавать горизонтальный скролл. */
  max-width: 100%;
  overflow: hidden;
}

.universal-header__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 12px 16px;
  box-sizing: border-box;
}

.universal-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--uc-header-ink);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  /* Бренд слева по ширине контента: не растёт, чтобы nav стоял рядом с ним,
     но может сжиматься (длинный бренд переносится — см. mobile-правила). */
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
}

.universal-header__brand-mark {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--uc-accent);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.18);
}

.universal-header__brand-text {
  min-width: 0;
  overflow-wrap: anywhere;
  /* На десктопе допускаем до двух строк, дальше — многоточие. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Навигация и CTA не сжимаются и не перекрываются длинным брендом. */
.universal-header__nav,
.universal-header__right {
  flex: 0 0 auto;
}

.universal-header__nav {
  display: flex;
  gap: 4px;
  /* nav стоит сразу за брендом; вправо уходит только CTA-группа. */
  margin-left: 8px;
}

.universal-header__nav a {
  color: var(--uc-header-ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: var(--uc-radius-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.universal-header__nav a:hover,
.universal-header__nav a:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: var(--uc-header-ink);
  outline: none;
}

.universal-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
  /* CTA-группа (Login/Register) прижата к правому краю шапки. */
  margin-left: auto;
}

.universal-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--uc-accent);
  color: var(--uc-accent-ink);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: var(--uc-radius-sm);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.universal-cta:hover,
.universal-cta:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

/* Register — основная accent-кнопка (наследует базовый accent-стиль). */
.universal-cta--register {
  background: var(--uc-accent);
  color: var(--uc-accent-ink);
}

/* Login — вторичная outline-кнопка на тёмном header. */
.universal-cta--login {
  background: transparent;
  color: var(--uc-header-ink);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.universal-cta--login:hover,
.universal-cta--login:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.45);
}

.universal-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 9px 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--uc-radius-sm);
  cursor: pointer;
  box-sizing: border-box;
}

.universal-burger span {
  display: block;
  height: 2px;
  background: var(--uc-header-ink);
  border-radius: 2px;
}

/* ---------- Mobile drawer ------------------------------------------------ */

.universal-mobile {
  position: fixed;
  inset: 0;
  background: var(--uc-header-bg);
  color: var(--uc-header-ink);
  padding: 64px 24px 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.universal-mobile[hidden] {
  display: none;
}

.universal-mobile__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--uc-radius-sm);
  color: var(--uc-header-ink);
  font-size: 1.4rem;
  cursor: pointer;
}

.universal-mobile__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.universal-mobile__nav a {
  color: var(--uc-header-ink);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 12px 8px;
  border-radius: var(--uc-radius-sm);
  border: 1px solid transparent;
}

.universal-mobile__nav a:hover,
.universal-mobile__nav a:focus-visible {
  border-color: rgba(255, 255, 255, 0.18);
  outline: none;
}

.universal-mobile__ctas {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.universal-mobile__cta {
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
  font-weight: 700;
  padding: 14px 18px;
  border-radius: var(--uc-radius-sm);
  box-sizing: border-box;
}

.universal-mobile__cta--register {
  background: var(--uc-accent);
  color: var(--uc-accent-ink);
}

.universal-mobile__cta--login {
  background: transparent;
  color: var(--uc-header-ink);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.universal-mobile__cta--login:hover,
.universal-mobile__cta--login:focus-visible {
  border-color: rgba(255, 255, 255, 0.45);
  outline: none;
}

/* ---------- Main / Content wrapper -------------------------------------- */
/*
 * .universal-main and .universal-content are deliberately minimal.
 * No background, no shadow, no padding, no rules for headings/text/lists/
 * tables/links. The CMS body controls its own typography and layout.
 *
 * scope_inline_styles:".universal-content" rewrites any manager <style>
 * block so its selectors only match inside .universal-content. That keeps
 * manager CSS isolated from .universal-header / .universal-footer / popup.
 */

.universal-main {
  padding: 0;
}

.universal-content {
  width: 100%;
  max-width: var(--uc-container);
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* Safe responsive rule for media library / pasted media — keeps images and
   embedded videos from overflowing the viewport. Does NOT set color,
   border-radius, margins, or display, so manager layouts stay intact. */
.universal-content img,
.universal-content video,
.universal-content iframe {
  max-width: 100%;
  height: auto;
}

/* Empty body placeholder — only renders when there is no CMS content,
   so it cannot collide with manager HTML. */
.universal-empty {
  max-width: 720px;
  margin: 48px auto;
  padding: 32px 24px;
  background: #ffffff;
  border: 1px solid var(--uc-line);
  border-radius: 10px;
  text-align: center;
  box-sizing: border-box;
}

.universal-empty__title {
  margin: 0 0 12px;
  font-size: 1.5rem;
  color: var(--uc-ink);
}

.universal-empty__text {
  margin: 0;
  color: var(--uc-ink-soft);
  font-size: 1rem;
}

.universal-empty__text--alt {
  margin-top: 10px;
  color: var(--uc-muted);
  font-size: 0.92rem;
}

/* ---------- Contact form (/contacts/) ----------------------------------- */
/* Светлая карточка в стиле universal. Классы префиксованы .universal-contact*
   — не пересекаются с CMS-контентом и другими темами. Форма переиспользует
   общий include casino_reviews/_contact_form.html (form_class="universal-contact-form",
   with_name=True). Поля: Name, Email, Message. */

.universal-contact {
  margin: 40px 0;
}

.universal-contact__card {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px;
  background: #ffffff;
  border: 1px solid var(--uc-line);
  border-radius: 12px;
  box-sizing: border-box;
}

.universal-contact__title {
  margin: 0 0 8px;
  font-size: 1.4rem;
  color: var(--uc-ink);
}

.universal-contact__lead {
  margin: 0 0 20px;
  color: var(--uc-ink-soft);
  font-size: 0.98rem;
}

.universal-contact-form__group {
  margin-bottom: 16px;
}

.universal-contact-form__label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--uc-ink);
}

.universal-contact-form__req {
  color: #c0392b;
}

.universal-contact-form__input,
.universal-contact-form__textarea {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: 1rem;
  color: var(--uc-ink);
  background: #fbfcfe;
  border: 1px solid var(--uc-line);
  border-radius: var(--uc-radius-sm);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.universal-contact-form__textarea {
  resize: vertical;
  min-height: 140px;
}

.universal-contact-form__input:focus,
.universal-contact-form__textarea:focus {
  outline: none;
  border-color: var(--uc-accent);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.18);
}

.universal-contact-form__actions {
  margin-top: 4px;
}

.universal-contact-form__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--uc-accent-ink);
  background: var(--uc-accent);
  border: none;
  border-radius: var(--uc-radius-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.universal-contact-form__btn:hover,
.universal-contact-form__btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.universal-contact-form__btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.universal-contact-form__status {
  margin: 16px 0 0;
  font-size: 0.95rem;
}

.universal-contact-form__status.is-success {
  color: #1e7a46;
}

.universal-contact-form__status.is-error {
  color: #c0392b;
}

@media (max-width: 540px) {
  .universal-contact__card {
    padding: 22px 16px;
  }

  .universal-contact-form__btn {
    width: 100%;
  }
}

/* ---------- Footer ------------------------------------------------------- */

.universal-footer {
  background: var(--uc-footer-bg);
  color: var(--uc-footer-ink);
  padding: 40px 0 16px;
  margin-top: 48px;
}

.universal-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.universal-footer__top {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 32px;
}

.universal-footer__brand {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--uc-header-ink);
  word-break: break-all;
}

.universal-footer__note {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--uc-footer-ink-soft);
}

.universal-footer__columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.universal-footer__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.universal-footer__group h2 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--uc-header-ink);
}

.universal-footer__group a {
  color: var(--uc-footer-ink);
  text-decoration: none;
  font-size: 0.94rem;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  width: max-content;
  max-width: 100%;
}

.universal-footer__group a:hover,
.universal-footer__group a:focus-visible {
  color: #ffffff;
  border-bottom-color: var(--uc-accent);
  outline: none;
}

.universal-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

.universal-footer__copy {
  margin: 0;
  font-size: 0.85rem;
  color: var(--uc-footer-ink-soft);
}

/* Keep Trustpilot include left-aligned inside the footer column area. */
.universal-footer .tp-badge {
  align-self: flex-start;
}

/* ---------- 404 ---------------------------------------------------------- */

.universal-body--404 {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.universal-404 {
  max-width: 520px;
  margin: 40px auto;
  padding: 32px 24px;
  text-align: center;
  box-sizing: border-box;
}

.universal-404__code {
  margin: 0 0 8px;
  font-size: 4rem;
  font-weight: 800;
  color: var(--uc-accent);
  letter-spacing: 0.04em;
}

.universal-404__title {
  margin: 0 0 12px;
  font-size: 1.6rem;
  color: var(--uc-ink);
}

.universal-404__text {
  margin: 0 0 24px;
  color: var(--uc-ink-soft);
}

.universal-404__home {
  display: inline-block;
  background: var(--uc-accent);
  color: var(--uc-accent-ink);
  padding: 12px 22px;
  border-radius: var(--uc-radius-sm);
  font-weight: 700;
  text-decoration: none;
}

/* ---------- Responsive --------------------------------------------------- */

@media (max-width: 880px) {
  /* На мобильной версии header не sticky — длинный бренд не должен
     перекрывать контент и занимать пол-экрана. */
  .universal-header {
    position: static;
  }

  .universal-header__nav {
    display: none;
  }

  /* Плотная mobile-шапка как на старом сайте: бренд слева, кнопки справа,
     без пустой зоны и без отдельной широкой строки с CTA.
       col1 — бренд (слева, на всю высоту, переносится в 2 строки);
       col2 — CTA-группа (Entrar/Registrar) справа сверху;
       col2 — burger справа снизу, под кнопками.
     Грид-колонка бренда (minmax(0,1fr)) сжимается и переносит текст,
     CTA/burger справа по размеру контента — горизонтального скролла нет. */
  .universal-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand cta"
      "brand burger";
    align-items: center;
    column-gap: 12px;
    row-gap: 8px;
    min-height: 56px;
    padding: 9px 14px;
  }

  /* Бренд слева, на всю высоту шапки, выровнен по верхнему краю,
     чтобы при переносе в 2 строки текст шёл от верха рядом с кнопками. */
  .universal-header__brand {
    grid-area: brand;
    align-self: center;
    font-size: 1rem;
    /* Разрешаем тексту бренда переноситься внутри своей зоны,
       не обрезаем его родительским overflow. */
    overflow: visible;
  }

  /* burger справа снизу, под CTA-группой. */
  .universal-burger {
    display: inline-flex;
    grid-area: burger;
    justify-self: end;
    margin: 0;
  }

  /* CTA-группа справа сверху — компактная, по размеру контента (НЕ full-width). */
  .universal-header__right {
    grid-area: cta;
    width: auto;
    margin: 0;
    justify-self: end;
    justify-content: flex-end;
    gap: 8px;
  }

  /* Кнопки по размеру контента (не full-width), слим, без тяжёлой тени,
     одинаковая высота (у accent — прозрачная рамка той же толщины,
     что outline-рамка у login). */
  .universal-header__right .universal-cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 7px 14px;
    font-size: 0.84rem;
    line-height: 1.1;
    border-radius: 10px;
    box-shadow: none;
  }

  .universal-header__right .universal-cta--register {
    border: 1px solid transparent;
  }

  /* На мобильном бренд показываем полностью: перенос строк без обрезания
     и многоточия. Register и burger остаются справа (flex:0 0 auto),
     header растёт в высоту при необходимости. Горизонтального скролла нет,
     т.к. текст переносится, а не расширяет шапку. */
  .universal-header__brand-text {
    display: block;
    -webkit-line-clamp: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .universal-footer__top {
    grid-template-columns: 1fr;
  }

  .universal-footer__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .universal-content {
    padding: 0 12px;
  }

  .universal-footer__columns {
    grid-template-columns: 1fr;
  }
}
