/* Atlas PPF — Buy film modal (попап заявки «Купить плёнку»).
   Один компонент на весь сайт: general (без товара) и product (с позицией).
   Стиль — тёмная тема сайта: фон #000, шрифт Oswald, CTA #8bf3ff, радиус 8px. */

.atlas-bm {
  --bm-bg: #0d0d0d;
  --bm-panel: #161616;
  --bm-card: #1c1c1c;
  --bm-line: #2b2b2b;
  --bm-text: #ffffff;
  --bm-muted: #9a9a9a;
  --bm-cta: #8bf3ff;
  --bm-cta-text: #000000;
  --bm-error: #ff6b6b;
  --bm-success: #6bff8f;
  --bm-radius: 8px;
  --bm-font: 'Oswald', Arial, sans-serif;

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: var(--bm-font);
  color: var(--bm-text);
  box-sizing: border-box;
}

.atlas-bm[hidden] {
  display: none;
}

.atlas-bm *, .atlas-bm *::before, .atlas-bm *::after {
  box-sizing: border-box;
}

/* Overlay */
.atlas-bm__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  animation: atlas-bm-fade 0.2s ease;
}

/* Dialog */
.atlas-bm__dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  background: var(--bm-bg);
  border: 1px solid var(--bm-line);
  border-radius: var(--bm-radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: atlas-bm-pop 0.22s ease;
}

.atlas-bm__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 24px 28px;
  -webkit-overflow-scrolling: touch;
}

/* Header */
.atlas-bm__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 0;
}

.atlas-bm__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.atlas-bm__close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin: -6px -6px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--bm-radius);
  color: var(--bm-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.atlas-bm__close:hover {
  color: var(--bm-text);
  background: var(--bm-card);
}

.atlas-bm__close:focus-visible {
  outline: 2px solid var(--bm-cta);
  outline-offset: 2px;
}

/* Mini-cart (product mode) */
.atlas-bm__cart {
  display: none;
  margin: 18px 24px 0;
}
.atlas-bm--product .atlas-bm__cart {
  display: block;
}

.atlas-bm__cart-card {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--bm-card);
  border: 1px solid var(--bm-line);
  border-radius: var(--bm-radius);
}

.atlas-bm__cart-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: var(--bm-radius);
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.atlas-bm__cart-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.atlas-bm__cart-info {
  flex: 1 1 calc(100% - 78px);
  min-width: 0;
}

.atlas-bm__cart-name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 2px;
}

.atlas-bm__cart-unit {
  font-size: 13px;
  color: var(--bm-muted);
  margin: 0 0 8px;
}

.atlas-bm__cart-price {
  font-size: 15px;
  font-weight: 600;
}

/* Qty stepper */
.atlas-bm__qty {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--bm-line);
  border-radius: var(--bm-radius);
  background: #000;
  overflow: hidden;
}

.atlas-bm__qty-btn {
  width: 34px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--bm-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.atlas-bm__qty-btn:hover {
  background: var(--bm-card);
}

.atlas-bm__qty-btn:focus-visible {
  outline: 2px solid var(--bm-cta);
  outline-offset: -2px;
}

.atlas-bm__qty-btn:disabled {
  color: var(--bm-muted);
  cursor: not-allowed;
}

.atlas-bm__qty-input {
  width: 40px;
  height: 36px;
  border: 0;
  border-left: 1px solid var(--bm-line);
  border-right: 1px solid var(--bm-line);
  background: transparent;
  color: var(--bm-text);
  text-align: center;
  font-family: var(--bm-font);
  font-size: 15px;
  font-weight: 500;
  -moz-appearance: textfield;
  appearance: textfield;
}

.atlas-bm__qty-input::-webkit-outer-spin-button,
.atlas-bm__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.atlas-bm__cart-total {
  flex: 0 0 auto;
  text-align: right;
  min-width: 74px;
}

.atlas-bm__cart-total-label {
  display: block;
  font-size: 11px;
  color: var(--bm-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.atlas-bm__cart-total-value {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}

/* Form */
.atlas-bm__form {
  margin-top: 20px;
}

.atlas-bm__field {
  margin-bottom: 16px;
}

.atlas-bm__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--bm-text);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.atlas-bm__label .atlas-bm__req {
  color: var(--bm-error);
  margin-left: 2px;
}

.atlas-bm__input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: #000;
  border: 1px solid var(--bm-line);
  border-radius: var(--bm-radius);
  color: var(--bm-text);
  font-family: var(--bm-font);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.atlas-bm__input::placeholder {
  color: var(--bm-muted);
}

.atlas-bm__input:focus {
  outline: none;
  border-color: var(--bm-cta);
  box-shadow: 0 0 0 2px rgba(139, 243, 255, 0.25);
}

.atlas-bm__input--error {
  border-color: var(--bm-error);
}

.atlas-bm__error-text {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--bm-error);
}

.atlas-bm__field--invalid .atlas-bm__error-text {
  display: block;
}

.atlas-bm__field--invalid .atlas-bm__input {
  border-color: var(--bm-error);
}

/* Payment segmented control */
.atlas-bm__pay {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.atlas-bm__pay-opt {
  position: relative;
}

.atlas-bm__pay-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.atlas-bm__pay-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 10px;
  background: #000;
  border: 1px solid var(--bm-line);
  border-radius: var(--bm-radius);
  color: var(--bm-muted);
  font-family: var(--bm-font);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.atlas-bm__pay-opt input:checked + .atlas-bm__pay-label {
  border-color: var(--bm-cta);
  color: var(--bm-text);
  background: var(--bm-card);
}

.atlas-bm__pay-opt input:focus-visible + .atlas-bm__pay-label {
  outline: 2px solid var(--bm-cta);
  outline-offset: 2px;
}

.atlas-bm__field--invalid .atlas-bm__pay-label {
  border-color: var(--bm-error);
}

/* Form-level error */
.atlas-bm__form-error {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid var(--bm-error);
  border-radius: var(--bm-radius);
  color: var(--bm-error);
  font-size: 14px;
}

.atlas-bm__form-error--show {
  display: block;
}

/* Error banner phone link (backup channel when submission fails) */
.atlas-bm__error-phone {
  color: var(--bm-cta);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid rgba(139, 243, 255, 0.4);
}

.atlas-bm__error-phone:hover {
  border-bottom-color: var(--bm-cta);
}

/* Submit */
.atlas-bm__submit {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  background: var(--bm-cta);
  color: var(--bm-cta-text);
  border: 0;
  border-radius: var(--bm-radius);
  font-family: var(--bm-font);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

.atlas-bm__submit:hover {
  filter: brightness(1.05);
}

.atlas-bm__submit:active {
  transform: translateY(1px);
}

.atlas-bm__submit:focus-visible {
  outline: 2px solid var(--bm-cta);
  outline-offset: 2px;
}

.atlas-bm__submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Success state */
.atlas-bm__success {
  display: none;
  text-align: center;
  padding: 30px 10px 10px;
}

.atlas-bm__success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(107, 255, 143, 0.14);
  border: 2px solid var(--bm-success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bm-success);
  font-size: 30px;
}

.atlas-bm__success-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.atlas-bm__success-text {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--bm-muted);
  line-height: 1.5;
}

.atlas-bm__success-close {
  background: var(--bm-cta);
  color: var(--bm-cta-text);
  border: 0;
  border-radius: var(--bm-radius);
  font-family: var(--bm-font);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px 24px;
  cursor: pointer;
}

.atlas-bm__success-close:focus-visible {
  outline: 2px solid var(--bm-cta);
  outline-offset: 2px;
}

/* Toast notifications removed: success/error are shown inside the modal */

/* States */
.atlas-bm__form-wrap[hidden] {
  display: none;
}

.atlas-bm__success[hidden] {
  display: none;
}

/* Animations */
@keyframes atlas-bm-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes atlas-bm-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .atlas-bm__overlay, .atlas-bm__dialog { animation: none; }
}

/* Mobile */
@media (max-width: 480px) {
  .atlas-bm { padding: 10px; }
  .atlas-bm__dialog { max-height: calc(100vh - 20px); }
  .atlas-bm__head { padding: 18px 18px 0; }
  .atlas-bm__scroll { padding: 18px 18px 22px; }
  .atlas-bm__cart { margin: 14px 18px 0; }
  .atlas-bm__cart-card { flex-wrap: wrap; }
  .atlas-bm__cart-total { min-width: 0; text-align: left; }
  .atlas-bm__title { font-size: 19px; }
}
