/* ==========================================================================
   Messenger skin — визуальная тема лендинга в стиле мессенджера.
   Подключается последним и переопределяет style.min.css / style.css / doors.css
   ========================================================================== */

:root {
  --mg-accent: #008069;
  --mg-accent-dark: #017561;
  --mg-bar: #008069;
  --mg-chat: #efe7de;
  --mg-page: #d1d7db;
  --mg-in: #ffffff;
  --mg-out: #d9fdd3;
  --mg-text: #111b21;
  --mg-meta: #667781;
  --mg-line: rgba(11, 20, 26, 0.08);
  --mg-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --mg-col: 600px;
  --mg-bar-h: 60px;
  --mg-pin-h: 42px;
  --mg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Roboto, Arial, sans-serif;
}

/* --------------------------------------------------------------- страница */

html,
body {
  background: var(--mg-page);
}

body {
  margin: 0;
  /* перебиваем `font-family: sans-serif !important` из style.min.css */
  font-family: var(--mg-font) !important;
  font-size: 16px;
  line-height: 1.4;
  color: var(--mg-text);
  -webkit-font-smoothing: antialiased;
}

/* Колонка «окна чата»: .wrap (переписка) и #orderForm (заказ) идут встык */
.wrap,
#orderForm {
  width: 100%;
  max-width: var(--mg-col);
  margin: 0 auto;
  background-color: var(--mg-chat);
  background-image: url("3c15c35dcf0d5b9dd4a9a90cf10323f4c2f5a88d.svg");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* пока переписка короткая — окно чата всё равно занимает экран целиком */
.wrap {
  min-height: 100vh;
}

@media (min-width: 601px) {
  .wrap {
    box-shadow: -1px 0 0 var(--mg-line), 1px 0 0 var(--mg-line);
  }

  #orderForm {
    box-shadow: -1px 0 0 var(--mg-line), 1px 0 0 var(--mg-line),
      0 14px 28px rgba(11, 20, 26, 0.12);
  }
}

/* ----------------------------------------------------------------- шапка */

.chat-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--mg-col);
  height: auto;
  max-height: none;
  z-index: 9999;
  background: var(--mg-bar);
  box-shadow: 0 1px 3px rgba(11, 20, 26, 0.16);
  animation: mg-drop 0.45s ease both;
}

@keyframes mg-drop {
  from {
    transform: translateY(-100%);
  }

  to {
    transform: translateY(0);
  }
}

.chat-header-container.down .chat-header-container-wrapper,
.chat-header-container-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--mg-bar-h);
  padding: 0 10px;
  margin: 0;
  font-family: var(--mg-font);
  font-size: 16px;
  font-weight: 400 !important;
  text-align: left;
  justify-content: flex-start;
}

.mg-back {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  fill: #fff;
  opacity: 0.9;
}

/* аватар собеседника */
.chat-header-container-image-left {
  position: static;
  transform: none;
  padding: 0;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.chat-header-container-image {
  display: block;
  line-height: 0;
}

.chat-header-container-image img,
.chat-header-container-image .chat-content-desc-image {
  width: 40px;
  height: 40px;
  max-width: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
}

.mg-contact {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.mg-contact__name {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mg-contact__status {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12.5px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mg-contact__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ee787;
  box-shadow: 0 0 0 0 rgba(126, 231, 135, 0.7);
  animation: mg-pulse 2s infinite;
}

@keyframes mg-pulse {
  70% {
    box-shadow: 0 0 0 6px rgba(126, 231, 135, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(126, 231, 135, 0);
  }
}

.mg-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 4px;
}

.mg-actions svg {
  width: 21px;
  height: 21px;
  fill: #fff;
  opacity: 0.85;
}

/* закреплённое сообщение — сюда вынесен заголовок оффера */
.mg-pinned {
  height: var(--mg-pin-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 12px 0 14px;
  background: #f0f2f5;
  border-left: 4px solid #06cf9c;
  box-shadow: 0 1px 2px rgba(11, 20, 26, 0.1);
}

.mg-pinned__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #06cf9c;
  text-transform: uppercase;
  line-height: 1.3;
}

.mg-pinned .header-text,
.header-text {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  color: #3b4a54;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  display: block;
}

/* ------------------------------------------------------------ лента чата */

.chat-container {
  position: static;
  padding-top: calc(var(--mg-bar-h) + var(--mg-pin-h));
  background: transparent;
}

.container2 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin-top: 0;
  padding: 12px 9px 18px;
}

/* служебные плашки */
.mg-day,
.mg-lock {
  align-self: center;
  max-width: 90%;
  margin: 10px auto 4px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #ffffffcc;
  box-shadow: var(--mg-shadow);
  color: var(--mg-meta);
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
}

.mg-lock {
  background: #ffeecdcc;
  color: #7d6641;
  margin-bottom: 2px;
}

.mg-lock::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 5px;
  vertical-align: -1px;
  background: url("af1101ca31206171358b4ef99afea77f93d8defd.svg")
    no-repeat center / contain;
}

/* ---------------------------------------------------------------- пузыри */

.box {
  display: block;
  position: relative;
  width: auto;
  max-width: 82%;
  margin: 0 0 10px 8px;
  padding: 7px 12px 20px;
  background: var(--mg-in);
  border-radius: 8px;
  border-top-left-radius: 0;
  box-shadow: var(--mg-shadow);
  font-family: var(--mg-font);
  font-size: 16.5px;
  line-height: 23px;
  font-weight: 400;
  color: var(--mg-text);
  text-align: left;
  word-wrap: break-word;
  animation: mg-in 0.22s ease-out both;
}

@keyframes mg-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* хвостик входящего пузыря */
.box::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  background: none;
  border-radius: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent var(--mg-in) transparent transparent;
  transform: none;
}

/* время сообщения */
.box::after {
  content: attr(data-time);
  position: absolute;
  top: auto;
  left: auto;
  right: 10px;
  bottom: 5px;
  width: auto;
  height: auto;
  border: 0;
  transform: none;
  font-size: 11px;
  line-height: 1;
  color: var(--mg-meta);
  white-space: nowrap;
}

/* исходящее сообщение — ответ пользователя */
.box.answer-big {
  align-self: flex-end;
  margin: 0 8px 10px 0;
  background: var(--mg-out);
  color: var(--mg-text);
  text-align: left;
  border-radius: 8px;
  border-top-right-radius: 0;
}

.box.answer-big::before {
  left: auto;
  right: -8px;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent var(--mg-out);
  background: none;
}

.box.answer-big::after {
  top: auto;
  left: auto;
  right: 10px;
  bottom: 5px;
  transform: none;
  border: 0;
  padding-right: 20px;
  background: url("")
    no-repeat right center / 16px 11px;
}

.quest {
  display: block;
  font-weight: 500;
}

/* картинки как вложения */
.box-img {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 8px 0 2px;
  border-radius: 8px;
}

.box-img-product {
  display: block;
  width: 62%;
  max-width: 210px;
  margin: 10px auto 2px;
}

/* индикатор набора текста */
.box.mg-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  width: auto;
  max-width: 70px;
  padding: 14px 14px;
  min-height: 0;
}

.box.mg-typing::after {
  content: none;
}

.box.mg-typing i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa6ac;
  animation: mg-dot 1.2s infinite ease-in-out;
}

.box.mg-typing i:nth-child(2) {
  animation-delay: 0.18s;
}

.box.mg-typing i:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes mg-dot {

  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* -------------------------------------------------- варианты ответа */

.answers {
  display: flex;
  flex-direction: column;
  width: auto;
  position: relative;
  z-index: 1;
  margin: 9px -12px -20px;
  padding: 0;
  background: var(--mg-in);
  border-top: 1px solid var(--mg-line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.answers.answered {
  display: none;
}

.answer {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 11px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--mg-accent);
  font-family: var(--mg-font);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.answer + .answer {
  border-top: 1px solid var(--mg-line);
}

.answer::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 7px;
  vertical-align: -2px;
  background: url("40cfc14556b1733d525b7b7dc24cf0885ed8650f.svg")
    no-repeat center / contain;
}

.answer:hover,
.answer:active {
  background: rgba(0, 128, 105, 0.07);
}

.answer.active {
  background: rgba(0, 128, 105, 0.12);
  color: var(--mg-accent-dark);
}

/* ---------------------------------------------------- блок «двери» + заказ */

#orderForm {
  padding: 0 9px 24px;
}

#goToForm {
  display: block;
  scroll-margin-top: calc(var(--mg-bar-h) + var(--mg-pin-h) + 8px);
}

/* поп-ап должен перекрывать фиксированную шапку */
.spin-result-wrapper {
  z-index: 10000;
}

#form-block {
  padding-top: 4px;
}

.door__head {
  display: none;
}

.door__wrapper {
  background: var(--mg-in);
  border-radius: 8px;
  border-top-left-radius: 0;
  box-shadow: var(--mg-shadow);
  padding: 12px 12px 16px;
  margin: 0 0 12px 8px;
  max-width: calc(100% - 8px);
  animation: mg-in 0.22s ease-out both;
}

.door__title {
  background: transparent !important;
  color: var(--mg-text) !important;
  font-family: var(--mg-font);
  font-size: 16.5px !important;
  line-height: 22px;
  font-weight: 600;
  text-transform: none;
  text-align: center;
  border-radius: 0;
  padding: 0 0 12px !important;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--mg-line);
}

.door__container {
  gap: 8px;
}

.door_box,
.door {
  box-shadow: none;
  border-radius: 8px;
  background-color: #f0f2f5;
}

.door_box {
  overflow: visible;
  box-shadow: inset 0 0 0 1px var(--mg-line);
}

.door__sales {
  font-family: var(--mg-font);
  color: var(--mg-accent) !important;
  box-shadow: none;
  background: transparent;
  padding: 10px 5px !important;
}

.product {
  margin: 0 0 12px 8px;
  padding: 10px;
  background: var(--mg-in);
  border-radius: 8px;
  box-shadow: var(--mg-shadow);
  max-width: 60%;
}

.product__img {
  max-width: 100%;
  border-radius: 6px;
}

/* карточка заказа = пузырь чата */
#order {
  width: auto;
  max-width: calc(100% - 8px);
  margin: 0 0 12px 8px;
  padding: 14px 14px 4px;
  background: var(--mg-in);
  border-radius: 8px;
  border-top-left-radius: 0;
  box-shadow: var(--mg-shadow);
  text-align: left;
}

.prices_block {
  font-family: var(--mg-font);
  font-size: 15.5px;
  line-height: 22px;
  color: var(--mg-text);
  text-align: left;
  padding: 0;
}

.prices_block > div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-top: 12px !important;
  padding: 10px;
  background: var(--mg-out);
  border-radius: 8px;
}

.orderForm,
.x_order_form {
  max-width: 100% !important;
  width: 100%;
  margin: 0;
  padding-bottom: 6px;
}

.order_form {
  margin-top: 14px;
}

.block_form {
  margin-bottom: 12px;
}

.block_form_label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mg-meta);
  margin-bottom: 6px;
  text-align: left;
  display: block;
}

.block_form input,
input.form_input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--mg-line);
  border-radius: 24px;
  background: #f0f2f5 no-repeat 14px center / 18px 18px;
  font-family: var(--mg-font);
  font-size: 16px;
  color: var(--mg-text);
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.block_form input:focus,
input.form_input:focus {
  border-color: var(--mg-accent);
  background-color: #fff;
}

input.form_input::placeholder {
  color: #8696a0;
}

input.form_input[name="fullName"] {
  background-image: url("12f9b265497598493c3e22b010e16acd93f686b2.svg");
}

input.form_input.phone_n {
  background-image: url("6e0f9316b331541334d1c27f22fcb56ce43e068b.svg");
}

#order button,
.order-btn,
.ifr_button {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 4px 0 12px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 0;
  border-radius: 26px;
  background: var(--mg-accent);
  color: #fff;
  font-family: var(--mg-font);
  font-size: 17px;
  font-weight: 600 !important;
  line-height: 22px;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 128, 105, 0.35);
  transition: background 0.15s ease, transform 0.1s ease;
}

#order button:hover,
.order-btn:hover {
  background: var(--mg-accent-dark);
}

#order button:active,
.order-btn:active {
  transform: translateY(1px);
}

#order button::after,
.order-btn::after {
  content: "";
  display: inline-block;
  width: 17px;
  height: 17px;
  margin-left: 9px;
  vertical-align: -3px;
  background: url("725e59f9d607fc6cd74cda9f7765c41a99eba7f7.svg")
    no-repeat center / contain;
}

.ring-loading {
  border-color: var(--mg-accent);
}

/* ------------------------------------------------------------ поп-ап скидки */

.pop-up-window {
  border-radius: 14px;
  padding-top: 74px !important;
  font-family: var(--mg-font);
}

.pop-up-window::before {
  background-color: var(--mg-accent);
}

.popup-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--mg-text);
  margin: 0 0 8px;
}

.pop-up-text,
.ruletka-p {
  font-size: 16.5px !important;
  line-height: 24px;
  color: var(--mg-text);
  font-weight: 400;
}

.danger-text {
  color: var(--mg-accent);
}

.pop-up-button {
  display: inline-block;
  padding: 12px 34px;
  border-radius: 24px;
  background-color: var(--mg-accent);
  font-size: 16px;
  font-weight: 600;
  text-transform: none;
  box-shadow: 0 2px 6px rgba(0, 128, 105, 0.35);
}

/* -------------------------------------------------------------- адаптив */

@media (max-width: 600px) {
  :root {
    --mg-bar-h: 56px;
    --mg-pin-h: 40px;
  }

  .box {
    width: auto;
    max-width: 85%;
    margin: 0 0 9px 8px;
    font-size: 15.5px;
    line-height: 22px;
    padding: 7px 10px 20px;
  }

  .box.answer-big {
    margin: 0 8px 9px 0;
  }

  .answers {
    margin: 9px -10px -20px;
  }

  .container2 {
    padding: 10px 7px 16px;
  }

  .mg-actions {
    gap: 14px;
  }

  .chat-header-container-image img,
  .chat-header-container-image .chat-content-desc-image {
    width: 36px;
    height: 36px;
    max-width: 36px;
  }

  .mg-contact__name {
    font-size: 15.5px;
  }

  #orderForm {
    padding: 0 7px 20px;
  }

  #order {
    width: auto;
    max-width: calc(100% - 8px);
    padding: 14px 12px 4px;
    margin: 0 0 12px 8px;
  }

  .prices_block {
    font-size: 15px;
    line-height: 21px;
  }
}

@media (max-width: 420px) {
  .mg-actions svg:first-child {
    display: none;
  }

  .header-text {
    font-size: 12px;
  }

  .door__title {
    font-size: 15.5px !important;
  }
}

/* -------------------------------------------------- поддержка RTL (ар. локали) */

html[dir="rtl"] .box {
  margin: 0 8px 10px 0;
  border-radius: 8px;
  border-top-right-radius: 0;
  text-align: right;
}

html[dir="rtl"] .container2 {
  align-items: flex-end;
}

html[dir="rtl"] .box::before {
  left: auto;
  right: -8px;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent transparent var(--mg-in);
}

html[dir="rtl"] .box::after {
  right: auto;
  left: 10px;
}

html[dir="rtl"] .box.answer-big {
  align-self: flex-start;
  margin: 0 0 10px 8px;
  border-top-right-radius: 8px;
  border-top-left-radius: 0;
}

html[dir="rtl"] .box.answer-big::before {
  right: auto;
  left: -8px;
  border-width: 0 8px 8px 0;
  border-color: transparent var(--mg-out) transparent transparent;
}

html[dir="rtl"] .box.answer-big::after {
  padding-right: 0;
  padding-left: 20px;
  background-position: left center;
}

html[dir="rtl"] .chat-header-container-wrapper,
html[dir="rtl"] .chat-header-container.down .chat-header-container-wrapper {
  flex-direction: row-reverse;
}

html[dir="rtl"] .mg-back {
  transform: scaleX(-1);
}

html[dir="rtl"] .mg-pinned {
  border-left: 0;
  border-right: 4px solid #06cf9c;
  padding: 0 14px 0 12px;
  text-align: right;
}

html[dir="rtl"] .block_form input,
html[dir="rtl"] input.form_input {
  padding: 0 42px 0 14px;
  background-position: right 14px center;
  text-align: right;
}

html[dir="rtl"] .answer::before {
  margin-right: 0;
  margin-left: 7px;
  transform: scaleX(-1);
}
