/* =====================================================================
   X-HOST — інтеграція дизайну v2 у білінг.

   Цей файл НЕ перезаписується оновленнями білінгу (на відміну від
   theme.*.css і rootpanel.css) і підключається останнім, тож може
   перекривати і тему, і Bootstrap.

   Правила гри:
   1. Класи нашої шапки/підвалу мають префікс xh- і не перетинаються
      з Bootstrap 4 (.container, .btn, .badge, .nav-link, .card, .lead).
   2. У блоці перефарбування білінгу правимо ТІЛЬКИ color / background /
      border-color. Ніяких display, padding, margin, width — інакше
      поїде верстка форм і таблиць.

   Зміст: Tokens → Fonts → Header → Mobile nav → Footer →
          Responsive → Recolour білінгу
   ===================================================================== */

/* ===== TOKENS ===== */
:root {
  --xh-primary: #12496A;
  --xh-primary-dark: #0B2F45;
  --xh-accent: #2C7BE5;
  --xh-accent-soft: #56C7EF;
  --xh-success: #23B26D;
  --xh-success-dark: #189257;
  --xh-bg-alt: #F7F9FA;
  --xh-bg-card: #EEF2F4;
  --xh-border: #E1E7EA;
  --xh-text: #2B3138;
  --xh-text-muted: #6B7580;
  --xh-heading: #101418;
  --xh-on-dark: #EAF2F6;
  --xh-on-dark-muted: #9FB4C2;
  --xh-gradient: linear-gradient(135deg, #12496A 0%, #2C7BE5 100%);
  --xh-gradient-dark: linear-gradient(160deg, #0B2F45 0%, #0E3A54 60%, #12496A 100%);
  --xh-font: "Inter", "Open Sans", "Segoe UI", Arial, sans-serif;
  --xh-header-h: 76px;
  --xh-shadow-sm: 0 2px 8px rgba(16, 20, 24, 0.06);
  --xh-shadow-md: 0 12px 32px rgba(16, 20, 24, 0.10);
}

/* ===== FONTS =====
   Підключаємо Inter, але застосовуємо ТІЛЬКИ до .xh-header / .xh-nav-mobile /
   .xh-footer — типографіку самого білінгу (Open Sans) не чіпаємо. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/Inter-Latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/Inter-Cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ===== СПІЛЬНЕ ДЛЯ НАШОЇ ХРОМИ ===== */
.xh-header,
.xh-nav-mobile,
.xh-footer {
  font-family: var(--xh-font);
  line-height: 1.6;
  box-sizing: border-box;
}
.xh-header *,
.xh-nav-mobile *,
.xh-footer * { box-sizing: border-box; }

.xh-container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 24px;
  display: flex;
  align-items: center;
}

/* ===== HEADER =====
   Один рядок, як на основному сайті: лого | меню | телефон + CTA + бургер.

   position: static, а НЕ sticky (на відміну від сайту). Причина: дропдауни
   Bootstrap мають z-index 1000, а липка шапка була 1020 — на прокрученій
   сторінці меню користувача (…/ Вийти) розкривалось ПІД шапкою, і клік по
   верхньому пункту влучав у кнопку «Вийти з білінгу». Статична шапка
   прибирає це перекриття фізично. */
.xh-header {
  position: static;
  height: var(--xh-header-h);
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--xh-border);
}

.xh-header .xh-container { justify-content: space-between; gap: 24px; }
.xh-brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.xh-brand img { height: 32px; width: auto; display: block; }

.xh-nav ul {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.xh-nav a {
  position: relative;
  display: block;
  padding: 6px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--xh-text);
  text-decoration: none;
  white-space: nowrap;
}
.xh-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  background: var(--xh-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}
.xh-nav a:hover { color: var(--xh-primary); text-decoration: none; }
.xh-nav a:hover::after { transform: scaleX(1); }

.xh-header-actions { display: flex; align-items: center; gap: 24px; flex-shrink: 0; }

.xh-header-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--xh-primary);
  text-decoration: none;
  white-space: nowrap;
}
.xh-header-phone:hover { color: var(--xh-accent); text-decoration: none; }
.xh-header-phone svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Кнопки — власні класи, щоб не чіпати .btn Bootstrap */
.xh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 21px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.xh-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.xh-btn-primary { background: var(--xh-success); color: #fff; }
.xh-btn-primary:hover { background: var(--xh-success-dark); color: #fff; text-decoration: none; }
.xh-btn-outline { background: transparent; color: var(--xh-primary); border-color: var(--xh-border); }
.xh-btn-outline:hover { border-color: var(--xh-primary); background: var(--xh-bg-alt); color: var(--xh-primary); text-decoration: none; }
.xh-btn-sm { padding: 8px 18px; font-size: 13px; }
.xh-btn-block { width: 100%; }

.xh-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.xh-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin-inline: auto;
  background: var(--xh-primary);
  border-radius: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}
.xh-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.xh-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.xh-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== MOBILE NAV =====
   z-index 1035: вище за fixed-top Bootstrap (1030), але нижче за
   modal-backdrop (1040) — модалки й тултипи білінгу лишаються зверху. */
.xh-nav-mobile { display: none; }

/* ===== FOOTER ===== */
.xh-footer {
  background: var(--xh-gradient-dark);
  color: var(--xh-on-dark);
  padding-top: 48px;
  margin-top: 48px;
}
.xh-footer .xh-container { display: block; }
.xh-footer a { color: var(--xh-on-dark-muted); text-decoration: none; }
.xh-footer a:hover { color: #fff; text-decoration: none; }

.xh-footer-top {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 48px;
  padding-bottom: 40px;
}
.xh-footer-brand img { height: 30px; width: auto; margin-bottom: 16px; display: block; }
.xh-footer-phone { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.xh-footer-brand p { color: var(--xh-on-dark-muted); font-size: 15px; max-width: 34ch; }

.xh-footer-social { display: flex; gap: 11px; margin-top: 24px; }
.xh-footer-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 200ms ease;
}
.xh-footer-social a:hover { background: rgba(255,255,255,0.18); }
.xh-footer-social svg { width: 17px; height: 17px; color: #fff; }

.xh-footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.xh-footer-col h4 {
  color: #fff;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 16px;
}
.xh-footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.xh-footer-col a { font-size: 15px; }

.xh-footer-payments {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 32px;
}
.xh-footer-payments-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--xh-on-dark-muted);
}
.xh-footer-payments-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
/* Білі «чіпи»: логотипи платіжок кольорові й на темному фоні зливались би */
.xh-pay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding-inline: 11px;
  background: #fff;
  border-radius: 8px;
}
.xh-pay img { height: 18px; width: auto; display: block; }

.xh-footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-block: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--xh-on-dark-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
  .xh-footer-top { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  /* Як на сайті: меню й текст телефону ховаємо, іконка телефону лишається,
     кнопка білінгу переїжджає в мобільну панель. */
  .xh-nav,
  .xh-header-phone span,
  .xh-header-actions .xh-btn-outline { display: none; }
  .xh-nav-toggle { display: flex; }

  .xh-nav-mobile {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: #fff;
    /* Верхнього відступу під шапку більше не треба — його роль виконує
       .xh-nav-mobile-head із логотипом і хрестиком. */
    padding: 0 24px 32px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 200ms ease, transform 200ms ease, visibility 200ms ease;
    font-family: var(--xh-font);
  }
  .xh-nav-mobile.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

  /* Власна шапка панелі: логотип + хрестик */
  .xh-nav-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--xh-header-h);
    margin-inline: -24px;
    padding-inline: 24px;
    border-bottom: 1px solid var(--xh-border);
    margin-bottom: 8px;
  }
  .xh-nav-mobile-head img { height: 32px; width: auto; display: block; }
  .xh-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--xh-primary);
    cursor: pointer;
  }
  .xh-nav-close svg { width: 22px; height: 22px; }

  .xh-nav-mobile ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
  .xh-nav-mobile a {
    display: block;
    padding: 16px 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--xh-text);
    text-decoration: none;
    border-bottom: 1px solid var(--xh-border);
  }
  .xh-mobile-cta { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
}

@media (max-width: 575.98px) {
  .xh-footer-cols { grid-template-columns: 1fr; }
  .xh-container { padding-inline: 16px; }
}

/* =====================================================================
   ПЕРЕФАРБУВАННЯ БІЛІНГУ ПІД ПАЛІТРУ v2

   Лише кольори. Геометрію (display/padding/margin/width) не чіпаємо,
   щоб не поїхали форми, таблиці й дропдауни.
   ===================================================================== */

/* --- Смуга акаунта: заголовок ліворуч, баланс/користувач праворуч --- */
.mai-top-header > .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}
/* Хлібні крихти, а не заголовок: ту саму назву білінг друкує ще раз у
   контенті (pageTitle у card-header 41 файлу та в <h2> сторінок замовлення).
   Дрібний нежирний текст читається як навігація, а не як дубль. */
.xh-account-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--xh-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.xh-account-title-sep { color: rgba(255, 255, 255, 0.35); font-weight: 400; }
.xh-account-title-page { color: #fff; }

/* Гостьове «Реєстрація» праворуч у смузі (сам пункт лишився в розмітці один) */
.mai-top-header .mai-user-nav .nav-link {
  font-family: var(--xh-font);
}

/* --- Смуга вкладок ---
   У розмітці лишилась одна група без батьківського <a>, тож правила
   однакові для всіх ширин (мобільний бургер із navbar-collapse працює,
   як у темі — його не чіпаємо).

   Тема кладе під-меню position:absolute у білу смугу 70px знизу і
   резервує під верхній рядок padding-top: 42px. Верхнього рядка більше
   немає, тож переводимо під-меню в потік і прибираємо резерв. */
.mai-nav-tabs > .nav > .nav-item > .mai-nav-tabs-sub {
  position: static;
  display: flex;
  width: auto;
}

/* Смуга вкладок повністю біла — так вона тягнеться на всю ширину сама,
   без трюків із 100vw (вони через смугу прокрутки дають горизонтальний
   оверфлоу). Темною лишається тільки смуга заголовка. */
.mai-sub-header {
  padding-bottom: 0;
  background-color: #fff !important;
  background-image: none !important;
}
.mai-sub-header:before { display: none; }
.mai-sub-header .navbar { padding-top: 0; padding-bottom: 0; min-height: 0; }

/* theme.*.css → .mai-sub-header > .container { padding-top: 42px }
   Перекриваємо тут, а НЕ правкою theme.default.css: той файл
   перезаписується оновленнями, і той самий рядок є в усіх 8 темах.
   position: relative з теми не чіпаємо. */
.mai-sub-header > .container { padding-top: 0; }

/* Темні смуги білінгу */
.mai-top-header {
  background-color: var(--xh-primary-dark) !important;
  background-image: var(--xh-gradient-dark) !important;
}
/* .mai-sub-header темним НЕ робимо — це біла смуга вкладок (див. нижче) */

/* Вкладки на білому тлі */
.mai-nav-tabs .nav-link { color: var(--xh-text-muted) !important; }
.mai-nav-tabs .nav-link.active { color: var(--xh-accent) !important; }
.mai-nav-tabs .nav-link:hover { color: var(--xh-primary) !important; }

/* Первинні кнопки білінгу — зелений CTA, як на сайті */
.btn-primary {
  background-color: var(--xh-success) !important;
  border-color: var(--xh-success) !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
  background-color: var(--xh-success-dark) !important;
  border-color: var(--xh-success-dark) !important;
}
.btn-outline-primary {
  color: var(--xh-accent) !important;
  border-color: var(--xh-accent) !important;
}
.btn-outline-primary:hover {
  background-color: var(--xh-accent) !important;
  border-color: var(--xh-accent) !important;
  color: #fff !important;
}

/* Посилання в контенті білінгу */
.main-content a:not(.btn):not(.nav-link):not(.dropdown-item) { color: var(--xh-accent); }
.main-content a:not(.btn):not(.nav-link):not(.dropdown-item):hover { color: var(--xh-primary); }

/* Акценти */
.text-primary { color: var(--xh-accent) !important; }
.bg-primary { background-color: var(--xh-accent) !important; }
