/*
 * WAAI Landing — Request Demo modal.
 * Форма рендерится inline (без iframe), поля приходят через
 * /Universal/SmartForms/api/form_public.php. См. demo-modal.js.
 *
 * Типографика: EN/RU — Montserrat Alternates; HE — Assistant
 * (атрибут lang="…" задаётся на .dm-modal в demo-modal.php).
 */

body.dm-open { overflow: hidden; }

/* hidden-attribute должен побеждать любые display: flex/grid внутри модалки */
.dm-overlay [hidden] { display: none !important; }

.dm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  overflow-y: auto;
}

.dm-overlay.is-open { opacity: 1; pointer-events: auto; }
.dm-overlay[hidden]  { display: none; }

.dm-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: auto;
  background: #0d0d0d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  color: #f0f0f0;
}

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

.dm-modal[lang="en"],
.dm-modal[lang="ru"] {
  font-family: 'Montserrat Alternates', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.dm-modal[lang="he"] {
  font-family: 'Assistant', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.dm-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 10;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.dm-close:hover {
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.dm-header {
  padding: 36px 32px 14px;
  text-align: center;
}

.dm-title {
  margin: 0 0 10px;
  font-family: inherit;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.22;
}

.dm-intro {
  margin: 0;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.94rem;
  line-height: 1.6;
  max-width: 420px;
  margin-inline: auto;
}

.dm-body {
  padding: 18px 32px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 14px;
}

/* Loading skeleton */
.dm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

.dm-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: #25d366;
  border-radius: 50%;
  animation: dm-spin 0.85s linear infinite;
}

@keyframes dm-spin { to { transform: rotate(360deg); } }

/* Error banner */
.dm-error {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: rgba(232, 93, 93, 0.08);
  border: 1px solid rgba(232, 93, 93, 0.35);
  border-radius: 10px;
  color: #f5c4c4;
  font-size: 0.875rem;
  line-height: 1.45;
}

/* Form — двухколоночная сетка */
.dm-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
  font-family: inherit;
}

.dm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* На всю ширину: длинные / составные поля и блок submit */
.dm-field[data-type="textarea"],
.dm-field[data-type="url"],
.dm-field[data-type="select"],
.dm-field[data-type="radio"],
.dm-field[data-type="checkbox"],
.dm-actions {
  grid-column: 1 / -1;
}

.dm-label {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.35;
}

.dm-req     { color: #e85d5d; font-weight: 600; }
.dm-optional {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
  font-size: 0.78rem;
}

.dm-input,
.dm-textarea,
.dm-select {
  width: 100%;
  background: transparent;
  color: #f0f0f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dm-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

.dm-input::placeholder,
.dm-textarea::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.dm-input:hover,
.dm-textarea:hover,
.dm-select:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.dm-input:focus,
.dm-textarea:focus,
.dm-select:focus {
  outline: none;
  border-color: #25d366;
  background: rgba(37, 211, 102, 0.04);
}

.dm-field.is-error .dm-input,
.dm-field.is-error .dm-textarea,
.dm-field.is-error .dm-select {
  border-color: rgba(232, 93, 93, 0.7);
}

/* Submit area */
.dm-actions {
  display: flex;
  justify-content: stretch;
  margin-top: 6px;
}

.dm-submit {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  background: #25d366;
  color: #051d10;
  border: 1px solid #1ea952;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.dm-submit:hover { background: #2ddf74; border-color: #2ddf74; }
.dm-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.dm-submit-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(5, 29, 16, 0.4);
  border-top-color: #051d10;
  border-radius: 50%;
  animation: dm-spin 0.85s linear infinite;
}

/* Success state */
.dm-success {
  padding: 44px 32px 52px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  font-family: inherit;
}

.dm-success-icon {
  color: #25d366;
  background: rgba(37, 211, 102, 0.1);
  border-radius: 50%;
  padding: 14px;
  box-sizing: content-box;
  border: 1px solid rgba(37, 211, 102, 0.22);
}

.dm-success-text {
  margin: 0;
  color: #fff;
  font-family: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.5;
  max-width: 360px;
}

.dm-success-countdown {
  margin: 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

[dir="rtl"] .dm-success { direction: rtl; }

@media (max-width: 560px) {
  .dm-overlay { padding: 16px 12px; }
  .dm-modal   { border-radius: 14px; }

  .dm-header  { padding: 30px 22px 12px; }
  .dm-body    { padding: 16px 18px 22px; }

  .dm-success { padding: 36px 22px 44px; }
}

/* В одну колонку схлопываем ТОЛЬКО на реально маленьких экранах */
@media (max-width: 380px) {
  .dm-form { grid-template-columns: 1fr; }
}
