@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital@1&display=swap');

/* ── Overlay ── */
.bra-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 70, 0.55);
  z-index: 2147483647;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.bra-overlay.is-open { display: flex; }

/* ── Popup ── */
.bra-popup {
  background: #fff;
  border: 1px solid #C9B7E8;
  border-radius: 13px;
  width: 100%;
  max-width: 480px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(30, 15, 60, 0.3);
}

/* ── Close button (внутри попапа, верхний правый угол) ── */
.bra-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  background: #F1EAFB;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  color: #9580BC;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 0;
}
.bra-close:hover { background: #E6D9F7; }

/* ── Inner: content sits above the bleeding photo ── */
.bra-popup-inner {
  position: relative;
  z-index: 1;
}

.bra-popup-content {
  padding: 1.17rem 1.33rem 0.83rem 1.33rem;
  min-width: 0;
}

/* ── Title ── */
.bra-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 17px;
  color: #8B6FC4;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}
.bra-title em {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: #8B6FC4;
}

/* ── Intro text ── */
.bra-intro p {
  font-size: 9.3px;
  color: #2A2140;
  line-height: 1.5;
  margin: 0 0 0.67rem;
  max-width: 100%;
}

/* ── How-to box ── */
.bra-howto {
  position: relative;
  border: 1px solid #D9C9F0;
  border-radius: 9px;
  padding: 0.67rem 0.83rem 0.67rem 0.73rem;
  margin-bottom: 0.57rem;
  max-width: 100%;
  background: #fff;
  overflow: hidden;
}
.bra-howto::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 73px;
  background-image: var(--bra-corner-url);
  background-size: cover;
  background-position: top right;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}
.bra-howto-title,
.bra-howto-item {
  position: relative;
  z-index: 1;
}

.bra-howto-title {
  font-size: 9.3px;
  font-weight: 700;
  color: #8B6FC4;
  margin-bottom: 0.47rem;
}

.bra-howto-item {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.bra-howto-item:last-child { margin-bottom: 0; }

.bra-howto-num {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #9580BC;
  color: #fff;
  font-size: 7.3px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.bra-howto-heading {
  font-size: 9.3px;
  font-weight: 700;
  color: #8B6FC4;
  margin-bottom: 0.13rem;
}

.bra-howto-text p {
  font-size: 8.3px;
  color: #2A2140;
  line-height: 1.45;
  margin: 0;
}

/* ── Errors / tips box (purple filled, full width) ── */
.bra-errors {
  display: flex;
  align-items: flex-start;
  gap: 0.37rem;
  background: #8E76BE;
  border-radius: 8px;
  padding: 0.53rem 0.73rem;
  margin-bottom: 0.67rem;
  max-width: 100%;
}

.bra-errors-icon {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.85);
  color: #fff;
  font-size: 7.3px;
  font-style: italic;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.bra-errors-text {
  font-size: 8.3px;
  color: #fff;
  line-height: 1.5;
}
.bra-errors-text strong { color: #fff; }

/* ── Bottom block: form, photo as background on the right (contain, no-repeat) ── */
.bra-bottom-block {
  position: relative;
  background-image: var(--bra-photo-url);
  background-size: contain;
  background-position: right bottom;
  background-repeat: no-repeat;
  padding-right: 127px;
}

/* ── Форма ── */
.bra-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 0.67rem;
  max-width: 100%;
}
.bra-field label {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 9.3px;
  color: #8B6FC4;
  margin-bottom: 4px;
}
.bra-field input {
  width: 100%;
  background: #fff;
  border: 1px solid #D9C9F0;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 9.3px;
  color: #2A2140;
  outline: none;
  box-sizing: border-box;
}
.bra-field input::placeholder { color: #B3A8C9; }
.bra-field input:focus { border-color: #9580BC; }

.bra-err {
  font-size: 8px;
  color: #C0392B;
  min-height: 10px;
  margin-bottom: 0.27rem;
}

/* ── Кнопка «Определить» ── */
.bra-submit {
  background: #B98FC9;
  background-image: linear-gradient(135deg, #C49AD6 0%, #9F78C9 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 9px 19px;
  font-size: 9.3px;
  font-weight: 700;
  cursor: pointer;
  display: block;
  width: 100%;
}
.bra-submit:hover  { filter: brightness(1.05); }
.bra-submit:active { transform: scale(0.98); }

/* ── Результат ── */
.bra-result { display: none; }
.bra-result.is-visible {
  display: flex;
  align-items: center;
  gap: 0.47rem;
  flex-wrap: wrap;
}
.bra-result-label {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 9.3px;
  color: #6A6178;
  border: 0px solid #D9C9F0;
  border-radius: 7px;
  padding: 7px 12px;
  flex: 1;
  min-width: 80px;
}
.bra-size-badge {
  background: #6E4FA3;
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.bra-submit--result {
  width: 100%;
  margin-top: 0.13rem;
}

/* ── Footer ── */
.bra-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 8.7px;
  color: #6A6178;
  border-top: 1px solid rgba(217, 201, 240, 0.5);
  padding: 0.6rem 1rem;
  margin: 0 1.33rem;
}
.bra-footer a {
  color: #8B6FC4;
  text-decoration: none;
  font-weight: 700;
}
.bra-footer a:hover { text-decoration: underline; }

/* ── Кнопка-триггер ── */
.js-bra-calc-open {
  background: #7F77DD;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.js-bra-calc-open:hover  { background: #534AB7; }
.js-bra-calc-open:active { transform: scale(0.98); }

/* ══════════════════ Mobile ══════════════════ */
@media (max-width: 720px) {
  .bra-errors {display: none !important;}
  .bra-overlay { padding: 0.5rem; }

  .bra-popup { border: 1px solid #C9B7E8; border-radius: 16px; max-width: 100%; }

  .bra-close {
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 13px;
  }

  .bra-popup-inner {
    display: block;
  }

  .bra-popup-content {
    padding: 1rem 1.2rem 0.85rem;
  }

  .bra-title { font-size: 22px; margin-bottom: 0.6rem; padding-right: 1.6rem; }

  .bra-intro p { font-size: 12px; margin-bottom: 0.8rem; }

  .bra-howto { padding: 0.85rem 1rem 0.85rem 0.9rem; border-radius: 12px; margin-bottom: 0.65rem; }
  .bra-howto-title { font-size: 12px; margin-bottom: 0.6rem; }
  .bra-howto-num { width: 16px; height: 16px; font-size: 9.2px; }
  .bra-howto-heading { font-size: 12px; }
  .bra-howto-text p { font-size: 10.6px; }
  .bra-howto::after { width: 125px; height: 92px; }

  .bra-errors { padding: 0.65rem 0.9rem; border-radius: 10px; margin-bottom: 0.85rem; }
  .bra-errors-icon { width: 13px; height: 13px; font-size: 9.2px; }
  .bra-errors-text { font-size: 10.6px; }

  .bra-form-row { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0.85rem; }
  .bra-field label { font-size: 12px; margin-bottom: 5px; }
  .bra-field input { padding: 9px 12px; font-size: 12px; border-radius: 8px; }
  .bra-err { font-size: 10px; }
  .bra-submit { padding: 12px 24px; font-size: 12px; }

  .bra-result-label { font-size: 12px; padding: 9px 16px; }
  .bra-size-badge { padding: 9px 13px; font-size: 12.5px; }

  /* На мобиле фото скрыто до результата; bottom-block теряет правый отступ под картинку */
  .bra-bottom-block {
    background-image: none;
    padding-right: 0;
  }

  .bra-state-result .bra-bottom-block {
    background-image: var(--bra-photo-url);
    background-position: center bottom;
    padding-bottom: 250px;
  }

  .bra-intro, .bra-howto, .bra-errors, .bra-form-row {
    max-width: 100%;
  }

  .bra-result.is-visible {
    flex-direction: row;
  }
  .bra-result-label { order: 1; }
  .bra-size-badge { order: 2; }
  .bra-submit--result { order: 3; }

  .bra-footer { padding: 0.85rem 1.2rem; font-size: 11px; margin: 0; }
}

@media (max-width: 380px) {
  .bra-title { font-size: 12px; }
  .bra-howto { padding: 0.45rem 0.55rem; }
}

/* ══════════════════ Large screens (1441px+): крупнее попап и шрифты ══════════════════ */
@media (min-width: 1441px) {
  .bra-popup {
    border-width: 1.5px;
    border-radius: 20px;
    max-width: 800px;
    box-shadow: 0 26px 52px rgba(30, 15, 60, 0.3);
  }

  .bra-close {
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
  }

  .bra-popup-content {
    padding: 1.9rem 2.2rem 1.4rem 2.2rem;
  }

  .bra-title { font-size: 28px; margin-bottom: 0.8rem; }

  .bra-intro p { font-size: 15px; margin-bottom: 1.1rem; }

  .bra-howto {
    border-width: 1.5px;
    border-radius: 15px;
    padding: 1.1rem 1.4rem 1.1rem 1.2rem;
    margin-bottom: 0.95rem;
  }
  .bra-howto::after { width: 165px; height: 120px; }
  .bra-howto-title { font-size: 15px; margin-bottom: 0.8rem; }
  .bra-howto-item { gap: 0.65rem; margin-bottom: 0.65rem; }
  .bra-howto-num { width: 20px; height: 20px; font-size: 12px; }
  .bra-howto-heading { font-size: 15px; margin-bottom: 0.2rem; }
  .bra-howto-text p { font-size: 13.5px; }

  .bra-errors {
    gap: 0.6rem;
    border-radius: 13px;
    padding: 0.85rem 1.2rem;
    margin-bottom: 1.1rem;
  }
  .bra-errors-icon { width: 18px; height: 18px; font-size: 12px; }
  .bra-errors-text { font-size: 13.5px; }

  .bra-bottom-block { padding-right: 210px; }

  .bra-form-row { gap: 15px; margin-bottom: 1.1rem; }
  .bra-field label { font-size: 15px; margin-bottom: 7px; }
  .bra-field input { padding: 12px 15px; font-size: 15px; border-radius: 11px; border-width: 1.5px; }
  .bra-err { font-size: 13px; min-height: 16px; }
  .bra-submit { padding: 15px 32px; font-size: 15px; }

  .bra-result-label { font-size: 15px; padding: 12px 20px; border-width: 1.5px; border-radius: 11px; min-width: 130px; }
  .bra-size-badge { padding: 11px 18px; font-size: 16px; border-radius: 11px; }

  .bra-footer { font-size: 14px; padding: 1rem 1.6rem; margin: 0 2.2rem; }
}