/* =============================================================
   КВІЗ «ПІДБІР АВТО» — стилі (1:1 з квізом на strongauto.in.ua)
     1. Шрифти і кольори
     2. Сторінка
     3. Шапка квізу
     4. Біла частина і картки кузова
     5. Випадаючі списки (бюджет, паливо, рік)
     6. Кнопка «Підібрати авто»
     7. Попап контактів
     8. Екран «Дякуємо»
     9. Планшет (до 991px)
    10. Телефон (до 767px)
   ============================================================= */

/* ---------- 1. Шрифти і кольори ---------- */
@font-face { font-family: "Montserrat SA"; src: url("/fonts/montserrat-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat SA"; src: url("/fonts/montserrat-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Montserrat SA"; src: url("/fonts/montserrat-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Eurostile Med"; src: url("/fonts/eurostile-med.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Eurostile Black"; src: url("/fonts/eurostile-black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --green: #20a84a;
  --green-50: #20a84a80;
  --green-35: #20a84a59;
  --black: #000;
  --white: #fff;
  --error: #e71414;
  --muted: #00000080;
  --shadow: 4px 4px 10px -1px #0003;
  --font: "Montserrat SA", Arial, sans-serif;
  --font-head: "Eurostile Black", Arial, sans-serif;
  --font-btn: "Eurostile Med", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--black); color: #333; font-family: var(--font); font-size: 14px; line-height: 20px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
p { margin: 0; }
.accent { color: var(--green); }

/* ---------- 2. Сторінка: квіз по центру екрана ---------- */
.page {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; padding: 40px 20px;
}
.page-foot { color: #ffffff59; font-size: 12px; text-align: center; }
.page-foot a { color: #ffffff8c; text-decoration: none; }
.page-foot a:hover { color: var(--white); }

/* ---------- 3. Шапка квізу ---------- */
.quiz {
  width: 100%; max-width: 1110px;
  border-radius: 30px; box-shadow: inset 0 0 0 2px var(--white);
  display: flex; flex-direction: column;
}
.quiz-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 30px; }
.quiz-title {
  margin: 0; color: var(--white); font-family: var(--font-head); font-weight: 900;
  font-size: 60px; line-height: 100%; letter-spacing: .01em; text-transform: uppercase;
}
.quiz-lead { margin-top: 24px; color: var(--white); font-size: 20px; font-weight: 500; line-height: 120%; letter-spacing: .01em; }
.quiz-icon { height: 125px; width: auto; flex: none; }

/* ---------- 4. Біла частина і картки кузова ---------- */
.quiz-form {
  display: flex; flex-direction: column; gap: 16px; padding: 16px;
  background: linear-gradient(#ffffff80, #ffffff80), url("/img/quiz-background.png") center / cover, var(--white);
  border-radius: 18px; box-shadow: var(--shadow);
}
.quiz-label { padding-left: 20px; color: var(--black); font-size: 16px; font-weight: 700; }

.body-grid { display: flex; justify-content: space-between; gap: 1%; }
.body-card {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 250px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 5px;
  padding: 16px; border-radius: 15px; background: var(--white); box-shadow: var(--shadow);
  color: var(--black); font-weight: 700; font-size: 14px;
  transition: background .2s ease;
}
.body-card img { width: 100%; height: auto; object-fit: contain; pointer-events: none; }
.body-card span { pointer-events: none; }
.body-card:hover { background: linear-gradient(180deg, var(--white) 21%, var(--green-35)); }
.body-card[aria-pressed="true"] {
  background: url("/img/selected.png") center / cover no-repeat, linear-gradient(180deg, var(--white), var(--green-50));
}
.body-card:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* ---------- 5. Випадаючі списки ---------- */
.dd-row { display: flex; gap: 16px; }
.dd { position: relative; flex: 1 1 0; min-width: 0; }

.dd-toggle {
  position: relative; width: 100%; display: block; text-align: left;
  padding: 20px 46px 20px 20px; border-radius: 12px;
  background: var(--white); border: 1px solid #0000001a; box-shadow: var(--shadow);
  color: var(--black); font-size: 16px; font-weight: 700; line-height: 20px;
}
.dd-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-arrow {
  position: absolute; right: 20px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .2s ease;
}
.dd.is-open .dd-arrow { transform: rotate(180deg); }
/* Обрано значення — зелений відтінок, як на сайті */
.dd-toggle.is-selected {
  background: url("/img/selected.png") right center / 150px no-repeat, linear-gradient(180deg, var(--white), var(--green-50));
  border-color: var(--white);
}

.dd-panel {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  display: flex; flex-direction: column; padding: 16px;
  background: var(--white); border: 1px solid #0000001a; border-radius: 12px; box-shadow: 4px 4px 10px #0003;
  color: var(--black);
}
.dd-panel[hidden] { display: none; }

.dd-apply {
  display: flex; justify-content: center; align-items: center; padding: 16px;
  background: var(--green); color: var(--white); border-radius: 8px;
  font-size: 16px; font-weight: 700; line-height: 20px;
}
.dd-apply:hover { filter: brightness(1.05); }
.dd-reset {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; margin-top: 15px;
  color: var(--muted); font-size: 16px; font-weight: 600; line-height: 100%;
}
.reset-ico {
  width: 15px; height: 12px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 17'%3E%3Cpath d='M19.8182 8.14219L17.0909 11.7211C16.9191 11.9461 16.6497 12.0789 16.3636 12.0789C16.0775 12.0789 15.8081 11.9461 15.6363 11.7211L12.909 8.14219C12.6078 7.74681 12.6893 7.18586 13.0908 6.88965C13.4927 6.59257 14.0625 6.67339 14.3637 7.06833L15.4545 8.5C15.4545 4.7996 12.3959 1.78947 8.63635 1.78947C4.87681 1.78947 1.81818 4.7996 1.81818 8.5C1.81818 12.2004 4.87681 15.2105 8.63635 15.2105C9.13839 15.2105 9.54544 15.6111 9.54544 16.1053C9.54544 16.5994 9.13839 17 8.63635 17C3.87428 17 0 13.1869 0 8.5C0 3.81312 3.87428 0 8.63635 0C13.3984 0 17.2727 3.81312 17.2727 8.5L18.3636 7.06833C18.665 6.67339 19.2351 6.59257 19.6364 6.88965C20.0379 7.18586 20.1194 7.74681 19.8182 8.14219Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 17'%3E%3Cpath d='M19.8182 8.14219L17.0909 11.7211C16.9191 11.9461 16.6497 12.0789 16.3636 12.0789C16.0775 12.0789 15.8081 11.9461 15.6363 11.7211L12.909 8.14219C12.6078 7.74681 12.6893 7.18586 13.0908 6.88965C13.4927 6.59257 14.0625 6.67339 14.3637 7.06833L15.4545 8.5C15.4545 4.7996 12.3959 1.78947 8.63635 1.78947C4.87681 1.78947 1.81818 4.7996 1.81818 8.5C1.81818 12.2004 4.87681 15.2105 8.63635 15.2105C9.13839 15.2105 9.54544 15.6111 9.54544 16.1053C9.54544 16.5994 9.13839 17 8.63635 17C3.87428 17 0 13.1869 0 8.5C0 3.81312 3.87428 0 8.63635 0C13.3984 0 17.2727 3.81312 17.2727 8.5L18.3636 7.06833C18.665 6.67339 19.2351 6.59257 19.6364 6.88965C20.0379 7.18586 20.1194 7.74681 19.8182 8.14219Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.dd-error { margin-top: 10px; color: var(--error); font-weight: 700; }

/* 5.1 Бюджет: два поля з «$» */
.price-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.price-field { position: relative; display: flex; align-items: center; border: 1px solid #00000059; border-radius: 12px; overflow: hidden; }
.price-field input {
  width: 100%; height: 44px; padding: 0 34px 0 14px; border: 0; outline: 0;
  font: 500 16px var(--font); color: var(--black); background: transparent;
}
.price-field span { position: absolute; right: 12px; color: var(--muted); font-weight: 700; font-size: 16px; }
.price-field:focus-within { border-color: var(--green); }

/* 5.2 Паливо: рядки з квадратиком праворуч */
.check-list { display: flex; flex-direction: column; gap: 10px; min-height: 150px; margin-bottom: 10px; }
.check { position: relative; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 16px; font-weight: 500; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check i { width: 16px; height: 16px; border: 1px solid var(--black); border-radius: 3px; flex: none; }
.check input:checked + i { background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; border-color: var(--green); }
.check input:focus-visible + i { outline: 2px solid var(--green); outline-offset: 2px; }

/* 5.3 Рік: дві колонки зі скролом */
.year-cols { display: flex; gap: 10px; margin-bottom: 10px; }
.year-col { flex: 1 1 0; min-width: 0; }
.year-caption { margin-bottom: 10px; color: var(--muted); font-size: 16px; font-weight: 500; }
.year-list { max-height: 150px; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.year-opt { text-align: left; padding: 3px 6px; border-radius: 6px; font-size: 16px; font-weight: 500; color: var(--black); }
.year-opt:hover { background: #20a84a1a; }
.year-opt[aria-checked="true"] { background: var(--green); color: var(--white); }

/* ---------- 6. Кнопка «Підібрати авто» ---------- */
.quiz-submit {
  width: 100%; padding: 20px 0; border-radius: 15px;
  border: 2px solid var(--green); background: var(--white); color: var(--green);
  font-family: var(--font-btn); font-size: 19px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  cursor: not-allowed; transition: background .2s ease, color .2s ease;
}
.quiz-submit.is-active { background: var(--green); color: var(--white); cursor: pointer; }

/* ---------- 7. Попап контактів ---------- */
body.is-locked { overflow: hidden; }
.popup {
  position: fixed; inset: 0; z-index: 9999; display: flex; justify-content: center; align-items: center;
  padding: 16px; background: #00000059; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  overflow-y: auto;
}
.popup[hidden] { display: none; }
.popup-box {
  position: relative; width: 100%; max-width: 550px; margin: auto; padding: 30px;
  background: var(--white) url("/img/popup-bg.jpg") center / cover; border-radius: 30px; color: var(--black);
}
.popup-close {
  position: absolute; top: 24px; right: 24px; width: 25px; height: 25px; z-index: 2; color: var(--black);
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M.56 14.58a1.5 1.5 0 010-2.12L12.58.44a1.5 1.5 0 112.12 2.12L2.68 14.58a1.5 1.5 0 01-2.12 0z'/%3E%3Cpath d='M.44.58a1.5 1.5 0 012.12 0l12.02 12.02a1.5 1.5 0 11-2.12 2.12L.44 2.7a1.5 1.5 0 010-2.12z'/%3E%3C/svg%3E") center / 20px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M.56 14.58a1.5 1.5 0 010-2.12L12.58.44a1.5 1.5 0 112.12 2.12L2.68 14.58a1.5 1.5 0 01-2.12 0z'/%3E%3Cpath d='M.44.58a1.5 1.5 0 012.12 0l12.02 12.02a1.5 1.5 0 11-2.12 2.12L.44 2.7a1.5 1.5 0 010-2.12z'/%3E%3C/svg%3E") center / 20px no-repeat;
  transition: color .2s ease;
}
.popup-close:hover { color: var(--green); }

.popup-form, .popup-done { display: flex; flex-direction: column; gap: 24px; }
.popup-form[hidden], .popup-done[hidden] { display: none; }
.popup-title { display: flex; flex-direction: column; gap: 16px; padding-right: 40px; }
.popup-h { font-family: var(--font-btn); font-size: 26px; font-weight: 500; line-height: 110%; letter-spacing: .03em; text-transform: uppercase; }
.popup-sub { font-size: 20px; font-weight: 700; line-height: 130%; }
.popup-group { display: flex; flex-direction: column; gap: 16px; }
.popup-label { font-size: 18px; font-weight: 600; line-height: 100%; }

.messengers { display: flex; gap: 16px; }
.messenger { flex: 1 1 0; position: relative; cursor: pointer; }
.messenger input { position: absolute; opacity: 0; pointer-events: none; }
.messenger span {
  display: flex; justify-content: center; align-items: center; padding: 13px 0;
  border: 2px solid var(--black); border-radius: 8px; color: #0006;
  font-size: 12px; font-weight: 700; text-transform: uppercase; transition: all .2s ease;
}
.messenger input:checked + span { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 600; }
.messenger input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

.field {
  display: flex; align-items: center; width: 100%; height: 60px; overflow: hidden;
  background: var(--white); border-radius: 12px; box-shadow: inset 0 0 0 2px var(--black);
}
.field input {
  width: 100%; height: 60px; padding: 0 12px; border: 0; outline: 0; background: transparent;
  color: var(--black); text-align: center; font: 500 18px var(--font);
}
.field input::placeholder { color: #0000004d; }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--green); }
.field.is-invalid { box-shadow: inset 0 0 0 2px var(--error); }
.field-code {
  flex: none; width: 25%; height: 60px; display: flex; justify-content: center; align-items: center; gap: 10px;
  box-shadow: 0 2px 5px #0003; font-size: 18px; font-weight: 500; color: var(--black);
}
.field-code img { width: 20px; height: auto; }
.field-error { color: var(--error); font-weight: 700; text-align: center; }
.field-error[hidden] { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.popup-submit {
  width: 100%; height: 60px; border-radius: 12px;
  background: var(--white); color: var(--green); box-shadow: inset 0 0 0 2px var(--green);
  font-family: var(--font-btn); font-size: 18px; letter-spacing: .1em; text-transform: uppercase;
  cursor: not-allowed; transition: background .2s ease, color .2s ease;
}
.popup-submit.is-active { background: var(--green); color: var(--white); cursor: pointer; box-shadow: inset -4px -4px 4px #00000026; }
.popup-submit.is-sending { opacity: .7; cursor: progress; }

/* ---------- 8. Екран «Дякуємо» ---------- */
.popup-done .popup-h { padding-right: 40px; }
.social {
  display: flex; flex-direction: column; gap: 24px; margin-top: -8px; padding: 24px;
  background: var(--white); border-radius: 12px; box-shadow: inset 0 0 0 2px var(--black);
}
.social-icons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.social-icons img { width: 100%; height: auto; transition: transform .2s ease; }
.social-icons a:hover img { transform: translateY(-2px); }

/* ---------- 9. Планшет (до 991px) ---------- */
@media (max-width: 991px) {
  .quiz-title { font-size: 46px; }
  .quiz-lead { font-size: 16px; }
  .quiz-icon { height: 90px; }
  .body-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .body-card { max-width: none; }
}

/* ---------- 10. Телефон (до 767px) ---------- */
@media (max-width: 767px) {
  .page { justify-content: flex-start; padding: 16px 12px 24px; }
  .quiz { border-radius: 15px; align-items: center; }
  .quiz-header { padding: 16px; width: 100%; }
  .quiz-title { font-size: 26px; line-height: 110%; }
  .quiz-lead { margin-top: 10px; font-size: 14px; line-height: 125%; }
  .quiz-icon { height: 75px; }
  .quiz-form { width: 100%; align-items: center; }
  .quiz-label { align-self: stretch; padding-left: 4px; }
  .body-grid { grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 360px; }
  .body-card { padding: 12px; font-size: 12px; }
  .dd-row { flex-direction: column; width: 100%; max-width: 360px; }
  .dd-toggle { font-size: 14px; }
  .quiz-submit { max-width: 360px; font-size: 17px; }

  .popup { padding: 12px; align-items: flex-start; }
  .popup-box { max-width: 400px; padding: 15px; border-radius: 15px; }
  .popup-close { top: 12px; right: 12px; }
  .popup-form, .popup-done { gap: 16px; }
  .popup-title { gap: 10px; }
  .popup-h { font-size: 20px; }
  .popup-sub { font-size: 16px; font-weight: 600; line-height: 110%; }
  .popup-group { gap: 10px; }
  .popup-label { font-size: 16px; }
  .messengers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .messenger span { padding: 12px 0; }
  .field input { font-size: 16px; }
  .field-code { width: 30%; font-size: 16px; }
  .social { gap: 16px; padding: 12px; margin-top: 0; }
}

/* Менше руху для тих, хто так налаштував систему */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
