/* ==================== Mirey reserve modal (site palette) ==================== */
.mirey-modal-backdrop {
  --mm-accent: var(--site-accent, #8b5e34);
  --mm-accent-hover: var(--site-accent-hover, #67401f);
  --mm-text: #2f241d;
  --mm-muted: #806b5e;
  --mm-surface: #fffaf4;
  --mm-surface-soft: #f8f1e8;
  --mm-border: rgba(139, 94, 52, 0.18);
  --mm-shadow: 0 18px 48px rgba(70, 45, 28, 0.18);

  position: fixed;
  inset: 0;
  background: rgba(47, 36, 29, 0.48);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100050;
  padding: 24px;
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(2px);
}

.mirey-modal-backdrop.is-open {
  display: flex;
}

.mirey-modal,
.mirey-modal * {
  box-sizing: border-box;
}

.mirey-modal {
  position: relative;
  width: min(100vw - 32px, 460px);
  max-width: 100%;
  max-height: calc(100vh - 48px);
  overflow: auto;
  background:
    linear-gradient(180deg, #fffdf9 0%, #ffffff 42%, #ffffff 100%);
  border: 1px solid var(--mm-border);
  border-radius: 18px;
  padding: 26px 22px 22px;
  box-shadow: var(--mm-shadow);
  font-family: var(--tb-text-primary-font, Inter, sans-serif);
  color: var(--mm-text);
  transform: translateY(12px) scale(0.985);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.mirey-modal-accent {
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #f7dfc4 0%, var(--mm-accent) 48%, #cda983 100%);
}

.mirey-modal-backdrop.is-open .mirey-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.mirey-modal-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 18px;
  padding: 0 28px;
}

.mirey-modal-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mm-accent);
  margin-bottom: 6px;
}

.mirey-modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  color: var(--mm-text);
}

.mirey-modal-close {
  position: absolute;
  top: -6px;
  right: -8px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  color: var(--mm-muted);
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.mirey-modal-close:hover,
.mirey-modal-close:focus {
  color: var(--mm-text);
  background: var(--mm-surface-soft);
  border-color: var(--mm-border);
  outline: none;
}

/* Product badge */
.mirey-modal-product {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--mm-surface);
  border: 1px solid var(--mm-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  min-width: 0;
}

.mirey-modal-product.is-visible {
  display: flex;
}

.mirey-modal-product-icon {
  width: 36px;
  height: 36px;
  background: var(--mm-accent);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 36px;
  box-shadow: 0 6px 14px rgba(139, 94, 52, 0.28);
}

.mirey-modal-product-meta {
  min-width: 0;
  flex: 1;
}

.mirey-modal-product-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--mm-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mirey-modal-product-price {
  font-size: 13px;
  color: #1b5e20;
  font-weight: 600;
  margin-top: 2px;
}

/* Form */
.mirey-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 100%;
}

.mirey-modal-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.mirey-modal-field label {
  font-weight: 600;
  font-size: 13px;
  color: var(--mm-text);
}

.mirey-modal-req {
  color: #c62828;
}

.mirey-modal-optional {
  font-weight: 400;
  color: var(--mm-muted);
}

.mirey-modal-input-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.mirey-modal-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mm-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.mirey-modal-input,
.mirey-modal-textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--mm-border) !important;
  border-radius: 12px !important;
  font-size: 15px;
  line-height: 1.4;
  background: #fff !important;
  color: var(--mm-text);
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.mirey-modal-input::placeholder,
.mirey-modal-textarea::placeholder {
  color: #a89280;
}

.mirey-modal-input:focus,
.mirey-modal-textarea:focus {
  border-color: var(--mm-accent) !important;
  box-shadow: 0 0 0 3px rgba(139, 94, 52, 0.16) !important;
  background: #fff !important;
  outline: none;
}

.mirey-modal-textarea {
  resize: none;
  height: 92px;
  overflow: auto;
  padding-left: 14px;
  font-family: inherit;
}

.mirey-modal-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--mm-surface-soft);
  border: 1px solid var(--mm-border);
  border-radius: 14px;
  padding: 12px 14px;
}

.mirey-modal-info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: #5c4a3d;
}

.mirey-modal-info-icon {
  flex: 0 0 18px;
  margin-top: 1px;
  color: var(--mm-accent);
  display: grid;
  place-items: center;
}

.mirey-modal-actions {
  display: flex;
  margin-top: 2px;
}

.mirey-modal-submit {
  width: 100%;
  background: #000;
  color: #fff;
  border: none;
  padding: 13px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.1s ease;
}

.mirey-modal-submit:hover,
.mirey-modal-submit:focus {
  background: var(--mm-accent);
  outline: none;
}

.mirey-modal-submit:active {
  transform: translateY(1px);
}

.mirey-modal-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.mirey-modal-status {
  font-size: 13px;
  display: none;
  margin: 0;
}

.mirey-modal-status.ok {
  display: block;
  color: #1b5e20;
}

.mirey-modal-status.err {
  display: block;
  color: #c62828;
}

/* Success / error result panels */
.mirey-modal-success,
.mirey-modal-error {
  display: none;
  text-align: center;
  padding: 18px 8px 0;
  position: relative;
}

.mirey-modal-success.is-visible,
.mirey-modal-error.is-visible {
  display: block;
}

.mirey-modal-success-icon,
.mirey-modal-error-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.mirey-modal-success-icon {
  color: #1b5e20;
  background: #e8f5e9;
}

.mirey-modal-error-icon {
  color: #c62828;
  background: #ffebee;
}

.mirey-modal-success-title,
.mirey-modal-error-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--mm-text);
}

.mirey-modal-success-lead,
.mirey-modal-error-lead {
  font-size: 14px;
  color: var(--mm-muted);
  margin: 0 0 14px;
}

.mirey-modal-ok-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--mm-text);
  margin-bottom: 6px;
}

.mirey-modal-ok-text {
  font-size: 14px;
  color: #5c4a3d;
  margin-bottom: 4px;
}

.mirey-modal-ok-phone {
  margin-top: 14px;
  margin-bottom: 18px;
  font-size: 17px;
}

.mirey-modal-ok-phone a {
  color: var(--mm-accent);
  text-decoration: none;
}

.mirey-modal-ok-phone a:hover {
  color: var(--mm-accent-hover);
  text-decoration: underline;
}

/* Progress bar (как у cart-toast) */
@keyframes mirey-modal-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.mirey-modal-progress {
  height: 4px;
  margin: 18px -22px 0;
  background: #ececec;
  overflow: hidden;
  border-radius: 0 0 14px 14px;
}

.mirey-modal-progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--mm-accent, #8b5e34);
  animation: mirey-modal-progress linear forwards;
}

.mirey-modal-progress--error .mirey-modal-progress-bar {
  background: #e53935;
}

body.mirey-modal-open {
  overflow: hidden;
}

/* Mobile + tablet: по центру экрана (как на ПК) */
@media (max-width: 1024px) {
  .mirey-modal-backdrop {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }

  .mirey-modal {
    width: min(100%, 460px);
    max-height: calc(100vh - 32px);
    border-radius: 18px;
    padding: 22px 16px 16px;
  }

  .mirey-modal-title {
    font-size: 24px;
  }

  .mirey-modal-accent {
    left: 16px;
    right: 16px;
  }

  .mirey-modal-progress {
    margin-left: -16px;
    margin-right: -16px;
  }
}
