/* ═══════════════════════════════════════════════════════════════
   Speak Up Chinese — Signup Modal
   Figma: фон на весь popup, форма — плавающая карточка справа
   ═══════════════════════════════════════════════════════════════ */

/* ── Overlay ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ── Modal wrapper ───────────────────────────────────────────── */
.modal {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 100vh;
  border-radius: 0;
  overflow: hidden;
  background: #CF031D;
  transform: translateY(20px);
  transition: transform 0.38s cubic-bezier(0.34, 1.5, 0.64, 1);
}

.modal-overlay.is-open .modal {
  transform: translateY(0);
}

/* ── Full-width background image ─────────────────────────────── */
.modal__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  display: block;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

/* ── Left transparent spacer (dragon shows through) ──────────── */
.modal__spacer {
  flex: 1;
  align-self: stretch;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* ── Right: floating white form card ─────────────────────────── */
.modal__panel {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: clamp(300px, 30.9vw, 600px);
  background: #fff;
  border-radius: 16px;
  padding: clamp(28px, 4.17vw, 80px);
  margin: auto clamp(20px, 19.2vw, 400px) auto 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: calc(100vh - 60px);
}

/* ── Heading section ─────────────────────────────────────────── */
.modal__heading {
  position: relative;
  margin-bottom: 28px;
}

.modal__title {
  position: relative;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 2.67vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.4px;
  color: #0C3249;
  margin: 0 0 0;
}

.modal__title-brand {
  display: block;
  color: #CF031D;
}

/* "Запись" badge */
.modal__title-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.modal__title-badge-bg {
  position: absolute;
  left: -20px;
  top: 60%;
  transform: translateY(-50%) rotate(178.6deg) scaleY(-1);
  width: 216.479px;
  height: 62.166px;
  pointer-events: none;
  z-index: 0;
}

.modal__title-badge-text {
  position: relative;
  z-index: 1;
  color: #fff;
}

/* Arrow decoration */
.modal__title-arrow {
  position: absolute;
  left: 12vw;
  top: 3.67vw;
  width: clamp(26px, 3.41vw, 66px);
  height: clamp(17px, 2.23vw, 43px);
  transform: rotate(15.34deg) scaleY(-1);
  pointer-events: none;
}

/* ── Description ─────────────────────────────────────────────── */
.modal__desc {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 20px;
  color: #6A7282;
  margin: 0 0 24px;
}

/* ── Inputs ──────────────────────────────────────────────────── */
.modal__inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.modal__input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: #F3F9FF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.modal__input::placeholder {
  color: #717182;
}

.modal__input:focus {
  border-color: #9CD2FF;
  background: #ebf4ff;
}

.modal__input.is-error {
  border-color: #CF031D;
  background: #fff8f8;
}

/* ── Messengers ──────────────────────────────────────────────── */
.modal__messengers-wrap {
  margin-bottom: 18px;
}

.modal__messengers-label {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 20px;
  color: #6A7282;
  margin-bottom: 8px;
}

.modal__messengers {
  display: flex;
  gap: 12px;
}

.modal__messenger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  overflow: hidden;
}

.modal__messenger:hover,
.modal__messenger.is-active {
  background: #CF031D;
  border-color: #CF031D;
  transform: scale(1.08);
}

.modal__messenger:hover svg *[fill]:not([fill="none"]),
.modal__messenger.is-active svg *[fill]:not([fill="none"]) {
  fill: #fff !important;
}

.modal__messenger:hover svg stop,
.modal__messenger.is-active svg stop {
  stop-color: #fff !important;
}

/* ── Submit button ───────────────────────────────────────────── */
.modal__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 48px;
  padding: 0 20px;
  background: #CF031D;
  border: none;
  border-radius: 44px;
  font-family: 'Inter Tight', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  margin-bottom: 10px;
}

.modal__submit:hover {
  background: #a80217;
  box-shadow: 0 4px 18px rgba(207, 3, 29, 0.4);
}

.modal__submit:active {
  background: #8c0113;
  box-shadow: none;
}

/* ── Privacy text ────────────────────────────────────────────── */
.modal__privacy {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 300;
  font-size: 12px;
  line-height: 16px;
  color: #6A7282;
  text-align: center;
}

.modal__privacy a {
  color: #6A7282;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal__privacy a:hover {
  color: #0C3249;
}

/* ── Close button ────────────────────────────────────────────── */
.modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.55);
  transform: scale(1.06);
}

.modal__close:active {
  background: rgba(255, 255, 255, 0.7);
  transform: scale(0.96);
}

/* ── Tablet (≤960px) ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .modal {
    min-height: 100%;
  }

  .modal__panel {
    width: 300px;
    padding: 36px;
    margin: auto 28px auto 0;
  }

  .modal__title {
    font-size: 24px;
  }

  .modal__title-badge-bg {
    width: 120px;
    height: 35px;
    left: -10px;
  }

  .modal__title-arrow {
    width: 28px;
    height: 18px;
    left: 110px;
    top: 34px;
  }
}

/* ── Tablet portrait / large mobile (≤768px) ─────────────────── */
@media (max-width: 768px) {
  .modal__panel {
    width: 100%;
    max-width: 400px;
    padding: 28px 24px;
    margin: auto 20px auto 0;
  }

  .modal__heading {
    margin-bottom: 20px;
  }

  .modal__title {
    font-size: 22px;
  }

  .modal__title-badge-bg {
    max-width: 100px;
    height: 32px;
    left: -8px;
    top: 65%;
  }

  .modal__title-badge-text{
    margin-top: 5px;
  }

  .modal__title-arrow {
    width: 24px;
    height: 16px;
    left: 100px;
    top: 30px;
  }

  .modal__desc {
    font-size: 13px;
    margin-bottom: 18px;
  }

  .modal__inputs {
    gap: 12px;
    margin-bottom: 12px;
  }

  .modal__messengers-wrap {
    margin-bottom: 14px;
  }

  .modal__submit {
    height: 44px;
    font-size: 13px;
  }
}

/* ── Mobile (≤640px): bottom sheet ──────────────────────────── */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    flex-direction: column;
    border-radius: 24px 24px 0 0;
    max-width: 100%;
    min-height: unset;
    transform: translateY(40px);
  }

  .modal-overlay.is-open .modal {
    transform: translateY(0);
  }

  .modal__spacer {
    flex: none;
    width: 100%;
    height: 180px;
    background-image: url('../assets/modal-bg.png');
    background-size: cover;
    background-position: center 60%;
    position: relative;
    z-index: 1;
  }

  .modal__bg {
    display: none;
  }

  .modal__panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    margin: 0;
    padding: 24px 20px 32px;
    max-height: calc(100vh - 180px);
  }

  .modal__close {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.4);
  }

  .modal__heading {
    margin-bottom: 18px;
  }

  .modal__title {
    font-size: 22px;
  }

  .modal__title-badge-bg {
    max-width: 80px;
    height: 35px;
    left: -8px;
    top: 65%;
  }

  .modal__title-badge-text{
    margin-top: 10%;
  }

  .modal__title-arrow {
    width: 24px;
    height: 16px;
    left: 90px;
    top: 40px;
  }

  .modal__desc {
    font-size: 13px;
    margin-bottom: 18px;
  }

  .modal__inputs {
    gap: 12px;
    margin-bottom: 12px;
  }

  .modal__messengers-wrap {
    margin-bottom: 14px;
  }

  .modal__submit {
    height: 44px;
    margin-bottom: 8px;
  }
}

/* ── Small mobile (≤480px) ──────────────────────────────────── */
@media (max-width: 480px) {
  .modal__spacer {
    height: 160px;
  }

  .modal__panel {
    padding: 22px 18px 28px;
    max-height: calc(100vh - 160px);
  }


  .modal__title-badge-bg {
    max-width: 90px;
    height: 31px;
  }


}

/* ── iPhone Pro / Android mid (≤390px) ──────────────────────── */
@media (max-width: 390px) {
  .modal__spacer {
    height: 150px;
  }

  .modal__panel {
    padding: 20px 16px 24px;
    max-height: calc(100vh - 150px);
  }

  .modal__title {
    font-size: 18px;
  }

  .modal__title-badge-bg {
    width: 96px;
    height: 28px;
  }

  .modal__title-arrow {
    left: 86px;
    top: 24px;
    width: 20px;
    height: 13px;
  }

  .modal__input {
    height: 40px;
    font-size: 13px;
  }

  .modal__submit {
    height: 42px;
    font-size: 13px;
  }

  .modal__privacy {
    font-size: 11px;
  }
}

/* ── Sticker (discount variant) ──────────────────────────────── */
.modal__sticker {
  display: none;
  position: absolute;
  top: 24px;
  right: 20px;
  z-index: 6;
  pointer-events: none;
  align-items: center;
  gap: 6px;
}

.modal-overlay.has-sticker .modal__sticker {
  display: flex;
}

.modal__sticker-label {
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #CF031D;
  line-height: 1;
}

.modal__sticker-img {
  width: 68px;
  height: auto;
}

@media (max-width: 640px) {
  .modal-overlay.has-sticker .modal__sticker {
    display: none;
  }
}

/* ── Very small phones (≤360px) ─────────────────────────────── */
@media (max-width: 360px) {
  .modal__panel {
    padding: 18px 14px 22px;
  }

  .modal__title {
    font-size: 17px;
  }

  .modal__title-badge-bg {
    width: 88px;
    height: 26px;
  }

  .modal__title-arrow {
    left: 78px;
    top: 22px;
    width: 18px;
    height: 12px;
  }

  .modal__desc {
    font-size: 12px;
  }
}
