/* ===== Site fixes - complement Flexbe CSS ===== */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Make navbar menu links clickable */
.menu-item-text {
  cursor: pointer;
  text-decoration: none;
}
.menu-item.root-item {
  cursor: pointer;
}

/* ===== FLEXBE COMPONENT-BUTTON - Apply CSS variables from Flexbe ===== */
/* Flexbe sets CSS vars on .component-button but the bundle that reads them doesn't load */
/* General buttons - exclude quiz buttons which use ::before for backgrounds */
.component-button:not(.quiz-button) {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: var(--justifyContent, center);
  background: var(--bgColor, #1a3a6b) !important;
  color: var(--currentColor, #fff) !important;
  border: none;
  border-radius: var(--topLeftRadius, 25px) var(--topRightRadius, 25px) var(--bottomRightRadius, 25px) var(--bottomLeftRadius, 25px);
  padding: var(--gapY, 12px) var(--gapX, 22px);
  font-size: var(--fontSize, 16px);
  font-weight: var(--fontWeight, 600);
  line-height: var(--lineHeight, 1.47);
  letter-spacing: var(--letterSpacing, 0px);
  text-align: var(--textAlign, center);
  text-decoration: var(--textDecoration, none);
  font-style: var(--fontStyle, normal);
  cursor: pointer;
  transition: background var(--transitionDuration, 0.2s), transform 0.2s, box-shadow 0.3s;
  white-space: nowrap;
  overflow: hidden;
  min-width: 120px;
}
.component-button:not(.quiz-button):hover {
  background: var(--hoverBgColor, #244d8a) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,58,107,0.3);
}
/* Quiz buttons - use ::before for background, don't override */
.component-button.quiz-button {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  border: none;
}
.component-button.quiz-button .btn-text {
  position: relative;
  z-index: 2;
}
/* Button inner elements - keep hidden, we use background on the button itself */
.component-button:not(.quiz-button) .bg-shadow,
.component-button:not(.quiz-button) .bg-fill,
.component-button:not(.quiz-button) .bg-fill-hover,
.component-button:not(.quiz-button) .circle-loader,
.component-button:not(.quiz-button) .success-icon,
.component-button:not(.quiz-button) a[data-action] {
  display: none !important;
}
.component-button:not(.quiz-button) .btn-text {
  position: relative;
  z-index: 1;
  color: inherit !important;
}

/* Lazy loaded images - fade in */
img[data-src], img[data-lazy-src] {
  opacity: 0;
  transition: opacity 0.5s ease;
}
img.loaded, img[src]:not([src=""]) {
  opacity: 1;
}

/* ===== QUIZ ===== */
.component-quiz .quiz-step {
  will-change: opacity, transform;
}
.component-quiz .quiz-step:not(.active) {
  pointer-events: none;
}
/* Hide captcha/submit steps - they don't work locally */
.component-quiz .step[data-id="captcha"],
.component-quiz .step[data-type="captcha"],
.step[data-id="captcha"] {
  display: none !important;
}
/* Ensure quiz radio items are clickable */
.component-quiz .form-field-radio-item,
.component-quiz .variant-item {
  cursor: pointer;
  position: relative;
  z-index: 1;
}

/* Quiz progress bar */
.quiz-progress {
  margin-bottom: 20px;
  position: relative;
  padding-top: 50px;
}
.quiz-progress .progress-loader-bar {
  position: relative;
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
  overflow: visible;
}
.quiz-progress .progress-loader-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.05);
  border-radius: 3px;
}
.quiz-progress .current {
  position: relative;
  height: 100%;
  background: #1a3a6b;
  border-radius: 3px;
  transition: width 0.5s ease;
  min-width: 2px;
}
.quiz-progress .progress-runner {
  position: absolute;
  right: 0;
  top: -46px;
  transform: translateX(50%);
  font-size: 16px;
  font-weight: 700;
  background: #1a3a6b;
  color: #fff;
  padding: 6px 16px;
  border-radius: 6px;
  white-space: nowrap;
  min-width: 48px;
  text-align: center;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(26,58,107,0.3);
}

/* Quiz radio buttons */
.component-quiz .form-field-radio__box {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
  position: relative;
  transition: border-color 0.3s;
  flex-shrink: 0;
}
.component-quiz .form-field-radio__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.component-quiz .form-field-radio__input:checked + .form-field-radio__box {
  border-color: #1a3a6b;
}
.component-quiz .form-field-radio__input:checked + .form-field-radio__box::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  background: #1a3a6b;
  border-radius: 50%;
}
.component-quiz .form-field-radio-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.component-quiz .form-field-radio-item:hover {
  background: rgba(26,58,107,0.06);
}

/* Quiz "Далее" / "Назад" button - let ::before handle background */
.component-quiz .quiz-button {
  position: relative;
  z-index: 1;
  cursor: pointer !important;
  pointer-events: all !important;
}
.component-quiz .quiz-button .btn-text,
.component-quiz .quiz-button .back-icon {
  position: relative;
  z-index: 2;
}
/* Quiz prev button visibility handled by .show-prev in quiz.css */
.component-quiz .quiz-actions .quiz-prev {
  cursor: pointer !important;
}

/* Messenger/phone options - each on separate line (radio AND checkbox) */
.component-quiz .form-field-radio-list,
.component-quiz .form-field-checkbox-list {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}
/* Override quiz.css width:max-content on checkbox/radio fields so they take full width */
.quiz-fields .field[data-type="checkbox"],
.quiz-fields .field[data-type="radio"] {
  width: 100% !important;
  max-width: 100% !important;
}
/* Checkbox items same styling as radio items - each on its own line */
.component-quiz .form-field-checkbox-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.component-quiz .form-field-checkbox-item:hover {
  background: rgba(26,58,107,0.06);
}
/* Quiz text inputs inside quiz (phone number etc.) - proper bordered box, not just a line */
.component-quiz .quiz-fields .form-field-text__input {
  border: 2px solid #e0e0e0 !important;
  border-radius: 8px !important;
  padding: 14px 16px !important;
  background: #fff !important;
  min-height: 48px;
  font-size: 16px;
  box-sizing: border-box;
}
.component-quiz .quiz-fields .form-field-text__input:focus {
  border-color: #1a3a6b !important;
  box-shadow: 0 0 0 3px rgba(26,58,107,0.1);
}
/* Quiz button spacing */
.component-quiz .quiz-actions {
  gap: 12px;
}

/* ===== VANILLA SLIDERS ===== */

/* CRITICAL: Override Flexbe's flex-flow:row wrap that makes slides stack vertically */
.flexbe-cards-slider .flexbe-cards,
.flexbe-cards-slider .swiper-wrapper {
  display: flex !important;
  flex-wrap: nowrap !important;
  flex-flow: row nowrap !important;
  transition: transform 0.5s ease !important;
}

/* Slider container */
.flexbe-cards-slider {
  position: relative;
  overflow: hidden;
}
.flexbe-cards-wrapper.hide-overflow {
  overflow: hidden;
  position: relative;
}
.flexbe-cards-container {
  position: relative;
}

/* Hide ALL old Flexbe slider buttons (removed from DOM too, but just in case) */
.slider-button, .slider-pagination, .swiper-mobile-helper {
  display: none !important;
  pointer-events: none !important;
}

/* Our own simple arrow buttons — matching original Flexbe style */
.my-slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: #1a3a6b;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  user-select: none;
  transition: background 0.2s, opacity 0.2s;
  line-height: 1;
  opacity: 0.85;
  pointer-events: auto !important;
}
.my-slider-btn:hover {
  opacity: 1;
  background: #142d54;
}
.my-slider-btn:active {
  opacity: 0.9;
}
.my-slider-prev {
  left: 8px;
}
.my-slider-next {
  right: 8px;
}
/* Next button: flip arrow to point right */
.my-slider-next svg {
  transform: scaleX(-1);
}

/* ===== SPOILERS / FAQ ===== */

/* Spoiler list layout */
.spoiler-list {
  width: 100%;
}
.spoiler-list-item {
  cursor: pointer;
}

/* Title row — flex so arrow sits on the right */
.spoiler-text-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.spoiler-text-title .element-text {
  flex: 1;
}

/* The toggle button — chevron arrow */
.spoiler-button {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  width: 24px;
  height: 24px;
  min-width: 24px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.35s ease;
}
.spoiler-button::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  position: absolute;
  top: 5px;
  left: 7px;
  transition: transform 0.35s ease;
}
/* Rotate arrow when expanded */
.spoiler-button--active::before {
  transform: rotate(-135deg);
  top: 9px;
}

/* Description area — collapsed by default via JS */
.spoiler-text-desc {
  overflow: hidden;
}
.spoiler-text-desc.collapsed {
  height: 0;
  overflow: hidden;
}
.spoiler-text-desc.collapsed--auto {
  height: auto;
  overflow: visible;
}

/* Separator between items */
.spoiler-text.has-separator {
  position: relative;
}
.spoiler-text .separator {
  display: block;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}
.spoiler-text .separator-top {
  margin-bottom: 0;
}
.spoiler-text .separator-bottom {
  margin-top: 0;
}

/* Spoiler text content padding */
.spoiler-text-content {
  padding: 12px 0;
}
.spoiler-text-desc .element-text--desc {
  padding-top: 8px;
  padding-bottom: 4px;
}

/* ===== FORMS - Complete Flexbe form layout ===== */

/* Form basic structure */
.component-form {
  width: 100%;
}
.component-form .form-info {
  display: none;
}
.component-form .form-fields-advanced {
  display: none;
}

/* Inline form: fields + button side by side */
.component-form.inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}
.component-form.inline .form-fields {
  flex: 1;
  min-width: 200px;
}
.component-form.inline .form-submit {
  flex-shrink: 0;
  margin-left: 15px;
}
.component-form.inline .policy-data-warning {
  width: 100%;
  flex-basis: 100%;
}

/* Form fields layout */
.component-form .form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}
.component-form .form-field {
  flex: 1;
  min-width: 200px;
}

/* Text input wrapper */
.component-form .form-field-text__wrap {
  position: relative;
}
.component-form .form-field-input__wrap {
  position: relative;
}

/* Text input base styles */
.component-form .form-field-text__input {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
  color: #333;
}

/* Underlined style (main form style on this site) */
.component-form.style-underlined .form-field-text__input,
.component-form .form-field-text__input {
  border: none;
  border-bottom: 2px solid #000;
  border-radius: 0;
  padding: 10px 0;
  background: transparent;
  font-size: 16px;
}
.component-form.style-underlined .form-field-text__input:focus,
.component-form .form-field-text__input:focus {
  border-bottom-color: #1a3a6b;
}

/* Floating label */
.component-form .form-field-title {
  position: absolute;
  left: 0;
  top: 10px;
  font-size: 16px;
  color: #666;
  pointer-events: none;
  transition: transform 0.3s ease, font-size 0.3s ease, color 0.3s ease;
}
.component-form .form-field-text__wrap.focused .form-field-title,
.component-form .form-field-text__wrap.filled .form-field-title,
.component-form .form-field-text__input:focus ~ .form-field-title,
.component-form .form-field-text__input:not(:placeholder-shown) ~ .form-field-title {
  transform: translateY(-22px);
  font-size: 12px;
  color: #999;
}

/* Form border span (Flexbe uses this as bottom border decoration) */
.component-form .form-field-text__wrap .border {
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #1a3a6b;
  transition: width 0.3s ease;
}
.component-form .form-field-text__wrap.focused .border {
  width: 100%;
}

/* Error messages */
.component-form .error {
  min-height: 0;
  font-size: 12px;
  color: #e53935;
}
.component-form .error:empty {
  display: none;
}

/* Hidden fields */
.component-form .form-field-hidden {
  display: none;
}

/* Form submit button - inherits from .component-button above */
.component-form .form-submit {
  margin-top: 5px;
}
.component-form .form-submit .component-button {
  width: var(--buttonWide, auto);
}

/* Button inner elements - already hidden globally, reinforce here */
.component-form .form-submit .bg-shadow,
.component-form .form-submit .bg-fill,
.component-form .form-submit .bg-fill-hover,
.component-form .form-submit .circle-loader,
.component-form .form-submit .success-icon,
.component-form .form-submit a[data-action] {
  display: none !important;
}
.component-form .form-submit .btn-text {
  color: #fff !important;
}

/* Captcha placeholder */
.component-form .captcha {
  display: none;
}

/* Policy/consent checkbox */
.component-form .policy-data-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  cursor: pointer;
  font-size: 13px;
  color: #666;
}
.component-form .policy-data-warning__input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: #1a3a6b;
}
.component-form .policy-data-warning__box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid #ccc;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}
.component-form .policy-data-warning__box i {
  display: none;
}
.component-form .policy-data-warning__input:checked + .policy-data-warning__box {
  background: #1a3a6b;
  border-color: #1a3a6b;
}
.component-form .policy-data-warning__input:checked + .policy-data-warning__box i {
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  margin-top: -2px;
}
.component-form .policy-data-warning__name {
  margin: 0;
  line-height: 1.4;
}
.component-form .policy-data-warning .policy-link {
  color: #1a3a6b;
  text-decoration: underline;
}

/* Filled form style (alternate) */
.component-form.style-filled .form-field-text__input {
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  border-bottom: 2px solid #e0e0e0;
}
.component-form.style-filled .form-field-text__input:focus {
  border-color: #1a3a6b;
}
.component-form.style-filled .form-field-text__wrap.focused .form-field-text__input {
  border-color: #1a3a6b;
  box-shadow: 0 0 0 3px rgba(26,58,107,0.1);
}

/* "Остались вопросы?" form */
.component-form textarea.form-field-text__input {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 12px;
  min-height: 100px;
  resize: vertical;
  background: #fff;
  font-family: inherit;
}
.component-form textarea.form-field-text__input:focus {
  border-color: #1a3a6b;
  box-shadow: 0 0 0 3px rgba(26,58,107,0.1);
}
/* Textarea fields take full width so they don't squish next field */
.component-form .form-field[data-type="textarea"] {
  flex-basis: 100% !important;
  min-width: 100% !important;
}

/* Override any remaining green */
.btn--green, .bg-green {
  background-color: #1a3a6b !important;
}

/* Ensure images fill their containers */
.bg-image img, .element-item img {
  max-width: 100%;
  height: auto;
}

/* Mobile text blocks should not capture their own tiny inner scroll */
body.adaptive-mobile .content-zone,
body.adaptive-mobile .content-zone > .elements-list,
body.adaptive-mobile .element-content--static,
body.adaptive-mobile .element-content--explicit-sizing,
body.adaptive-mobile .element-content--free,
body.adaptive-mobile .element-text {
  overflow: visible !important;
}

/* Icon wrap sizing */
.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-wrap svg {
  fill: currentColor;
}

/* ===== Background layers (Flexbe component-bg) ===== */
/* Flexbe inline CSS already handles overlay via --componentBgColor and --componentBgOpacity vars */
/* We only need to ensure image-holder gets the actual image loaded by site-init.js */
section[data-contrast="dark"] {
  position: relative;
}
section[data-contrast="dark"] > :not(.component-bg) {
  position: relative;
  z-index: 1;
}

/* ===== Mobile responsive ===== */
@media (max-width: 768px) {
  .component-form.inline {
    flex-direction: column;
  }
  .component-form.inline .form-submit {
    margin-left: 0;
    margin-top: 15px;
    width: 100%;
  }
  .component-form.inline .form-submit .component-button,
  .component-form.inline .form-submit button[type="submit"] {
    width: 100%;
  }

  /* ===== MOBILE HEADER ===== */
  /* Top header row: logo + phone + burger */
  header[data-b-id="HEADER"] {
    position: sticky !important;
    top: 0;
    z-index: 9999;
  }
  header[data-b-id="HEADER"] .header-wrapper {
    display: block !important;
  }
  /* First zone: logo, text, contacts, button — rearrange */
  header[data-b-id="HEADER"] .content-zone[data-e-id="zone_header"] {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  /* Logo — small */
  header .element-item[data-e-id="header_logo"] {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 50px !important;
    order: 1;
  }
  header .element-item[data-e-id="header_logo"] .component-logo-img {
    max-height: 44px !important;
    width: auto !important;
  }
  /* Subtitle text — hide on mobile */
  header .element-item[data-e-id="header_text"] {
    display: none !important;
  }
  /* Divider — hide */
  header .element-item[data-e-id="header_divider"] {
    display: none !important;
  }
  /* Contacts: phone + hours — compact */
  header .element-item[data-e-id="header_contacts"] {
    flex: 1 1 auto !important;
    width: auto !important;
    order: 2;
    min-width: 0 !important;
  }
  header .element-item[data-e-id="header_contacts"] .element-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }
  header .element-item[data-e-id="header_contacts"] .component-icon {
    display: none !important;
  }
  header .element-item[data-e-id="header_contacts"] .element-text-wrap {
    display: flex !important;
    flex-direction: column !important;
    white-space: nowrap !important;
  }
  header .element-item[data-e-id="header_contacts"] .element-text--contact {
    font-size: 14px !important;
    white-space: nowrap !important;
  }
  header .element-item[data-e-id="header_contacts"] .element-text--contact a {
    white-space: nowrap !important;
    word-break: keep-all !important;
  }
  header .element-item[data-e-id="header_contacts"] .element-text--desc {
    font-size: 11px !important;
    white-space: nowrap !important;
    opacity: 0.7;
  }
  /* "Быстрая консультация" button — hide on mobile, phone is enough */
  header .element-item[data-e-id="header_button"] {
    display: none !important;
  }

  /* Second zone: nav menu — hamburger toggle */
  header .content-zone[data-id="913673347"] {
    display: none !important;
    flex-direction: column !important;
    padding: 0 12px 12px !important;
    background: inherit;
  }
  header .content-zone[data-id="913673347"].mobile-menu-open {
    display: flex !important;
  }
  /* Menu items vertical */
  header .component-menu-list--root {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 0 !important;
  }
  header .component-menu-list--root .menu-item {
    width: 100% !important;
  }
  header .component-menu-list--root .menu-item-text {
    display: block !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-size: 15px !important;
  }
  /* Nested dropdown — show inline */
  header .component-menu-list--nested {
    position: static !important;
    display: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-left: 16px !important;
  }
  header .folder-item.mobile-submenu-open .component-menu-list--nested {
    display: block !important;
  }

  /* Burger button — injected via JS */
  .mobile-burger {
    order: 3;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    z-index: 10;
  }
  .mobile-burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
  }
  .mobile-burger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .mobile-burger.open span:nth-child(2) {
    opacity: 0;
  }
  .mobile-burger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ===== MOBILE GENERAL ===== */
  .flexbe-cards-slider .my-slider-btn {
    width: 32px;
    height: 32px;
  }
  .my-slider-prev { left: 4px; }
  .my-slider-next { right: 4px; }

  /* Buttons — fit inside blocks */
  .component-button:not(.quiz-button) {
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
  }

  /* Reviews slider — 1 per view */
  .flexbe-cards-slider[data-cards] {
    overflow: hidden !important;
  }
  .flexbe-cards-slider .flexbe-card,
  .flexbe-cards-slider .swiper-slide {
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    box-sizing: border-box !important;
  }

  /* 6 причин — single column */
  .flexbe-cards:not(.swiper-wrapper) {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
  }
  .flexbe-cards:not(.swiper-wrapper) .flexbe-card {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }

  /* Content zones — prevent overflow */
  .content-zone, .elements-list, .element-content {
    max-width: 100% !important;
    overflow-x: hidden;
  }
  .element-item {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}
