/* Стили страницы «Публичная оферта» - общие с terms (юридические страницы) */
@import "terms.css";

/* ===============================
   OFFER PAGE LAYOUT (knowledge-base style)
   =============================== */

/* Как в lesson.css: overflow: visible у предков, иначе sticky не работает */
body:has(.offer-layout),
body:has(.offer-layout) .main,
body:has(.offer-layout) .container,
body:has(.offer-layout) .content-wrapper,
body:has(.offer-layout) .offer-layout {
  overflow: visible !important;
}

/* На юридических страницах - широкий контейнер, чтобы offer-content занимал больше места */
body:has(.offer-layout) .main .container {
  max-width: 1776px;
}

.offer-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 32px;
  padding: 32px 0 56px;
  align-items: stretch;
}

[data-theme="light"] .offer-layout {
  padding-top: 40px;
  padding-bottom: 72px;
}

.offer-content {
  min-width: 0;
  width: 100%;
}

.offer-layout .terms-container {
  max-width: 100%;
  width: 100%;
  border: none;
  outline: none;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease,
    border-color 0.3s ease;
}

/* Колонка сайдбара: тянется по высоте, липкий только внутренний блок (как .lesson-toc и .lesson-toc-sticky) */
body:has(.offer-layout) .offer-sidebar {
  position: relative !important;
  overflow: visible !important;
  align-self: stretch;
}

/* Липкий блок меню - при прокрутке остаётся с нами */
body:has(.offer-layout) .offer-sidebar-inner {
  position: sticky !important;
  top: var(--header-height, 96px);
  min-height: 200px;
  max-height: calc(100vh - var(--header-height, 96px));
  overflow-y: auto;
  box-sizing: border-box;
}

.offer-sidebar-inner {
  border-radius: 18px;
  padding: 28px 20px 20px;
  border: none;
  background: #1f2022;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  transition: background-color 0.3s ease, border-color 0.3s ease,
    box-shadow 0.3s ease, color 0.3s ease;
}

[data-theme="light"] .offer-sidebar-inner {
  background: #ffffff;
  border-color: transparent;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.offer-sidebar__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.8);
}

[data-theme="light"] .offer-sidebar__title {
  color: rgba(15, 23, 42, 0.65);
}

.offer-sidebar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
  flex-shrink: 0;
}

.offer-sidebar__icon i {
  font-size: 15px;
}

.offer-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
}

/* Фиксированная высота строк - при малом числе пунктов ничего не «скачет» при смене активного */
.offer-sidebar__link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: rgba(226, 232, 240, 0.8);
  font-size: 1rem;
  font-weight: 400;
  text-align: left;
  gap: 10px;
  transition: background 0.35s ease, color 0.35s ease;
  box-sizing: border-box;
}

.offer-sidebar__link:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.offer-sidebar__link:hover {
  background: rgba(148, 163, 184, 0.18);
}

.offer-sidebar__link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  color: #e5e7eb;
  flex-shrink: 0;
}

.offer-sidebar__link-icon i {
  font-size: 13px;
}

.offer-sidebar__link-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.offer-sidebar__link--active {
  background: #262729;
  color: #f9fafb;
  font-weight: 500;
}

.offer-sidebar__link--active .offer-sidebar__link-icon {
  background: rgba(255, 255, 255, 0.06);
  color: #facc15;
}

[data-theme="light"] .offer-sidebar__link {
  color: rgba(15, 23, 42, 0.8);
}

[data-theme="light"] .offer-sidebar__link:hover {
  background: rgba(148, 163, 184, 0.1);
}

[data-theme="light"] .offer-sidebar__link--active {
  background: rgba(241, 245, 249, 0.95);
  color: #0f172a;
  font-weight: 500;
}

[data-theme="light"] .offer-sidebar__link--active .offer-sidebar__link-icon {
  background: rgba(15, 23, 42, 0.06);
  color: #111827;
}

/* Главный пункт в конце блока - «На главную» */
.offer-sidebar__link--cta {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  color: rgba(226, 232, 240, 0.9);
  min-height: 46px;
}

.offer-sidebar__link--cta:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #f9fafb;
}

[data-theme="light"] .offer-sidebar__link--cta {
  border-top-color: rgba(15, 23, 42, 0.1);
  background: rgba(15, 23, 42, 0.04);
  color: rgba(15, 23, 42, 0.85);
}

[data-theme="light"] .offer-sidebar__link--cta:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #0f172a;
}

/* Dark theme card style for terms content only на этой странице */
[data-theme="dark"] .offer-layout .terms-container {
  background: #1f2022;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
  padding: 32px 32px 40px 32px;
}

/* Sections highlight */
[data-offer-section] {
  scroll-margin-top: 110px;
}

/* ===============================
   RESPONSIVE
   =============================== */

@media (max-width: 900px) {
  .offer-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .offer-sidebar {
    position: static !important;
    top: auto !important;
    align-self: auto;
  }

  body:has(.offer-layout) .offer-sidebar-inner,
  .offer-sidebar-inner {
    position: static !important;
    top: auto !important;
    max-height: none;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
  }

  .offer-sidebar__nav {
    flex-wrap: wrap;
    flex-direction: row;
    row-gap: 8px;
  }

  .offer-sidebar__link {
    flex: 1 1 calc(50% - 4px);
  }
}

@media (max-width: 720px) {
  .offer-layout {
    padding-top: 24px;
    padding-left: 0;
    padding-right: 0;
  }

  body:has(.offer-layout) .main .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .offer-sidebar__nav {
    flex-direction: column;
  }

  .offer-sidebar__link {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .offer-layout {
    padding-top: 16px;
    padding-bottom: 36px;
  }

  body:has(.offer-layout) .main .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .offer-layout .terms-container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .offer-sidebar {
    padding: 16px 14px;
  }

  .offer-sidebar__title {
    font-size: 0.9rem;
  }

  .offer-sidebar__link {
    padding: 10px 12px;
    min-height: 44px;
    font-size: 0.95rem;
  }
}

@media (max-width: 380px) {
  .offer-layout {
    gap: 14px;
    padding-top: 14px;
    padding-bottom: 32px;
  }

  .offer-sidebar {
    padding: 0;
  }

  .offer-sidebar-inner {
    border-radius: 12px;
    padding: 16px 12px;
  }

  .offer-sidebar__title {
    gap: 8px;
    letter-spacing: 0.08em;
  }

  .offer-sidebar__icon {
    width: 30px;
    height: 30px;
  }

  .offer-sidebar__link {
    gap: 8px;
    padding: 9px 10px;
    font-size: 0.9rem;
  }

  .offer-sidebar__link-text {
    white-space: normal;
  }
}
