.mx-demo-modal[hidden],
.mx-demo-form[hidden],
.mx-demo-success[hidden] {
  display: none !important;
}

body.mx-demo-open {
  overflow: hidden;
}

.mx-demo-modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  padding: 24px;
  overflow-y: auto;
  place-items: center;
  background: rgba(11, 45, 74, 0.64);
  opacity: 0;
  transition: opacity 240ms cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(8px);
}

.mx-demo-modal.is-open {
  opacity: 1;
}

.mx-demo-dialog {
  position: relative;
  width: min(100%, 760px);
  max-height: calc(100dvh - 48px);
  padding: clamp(26px, 5vw, 46px);
  overflow-y: auto;
  border: 1px solid var(--border, #e8eaf2);
  border-radius: var(--radius-lg, 30px);
  background: var(--card-bg, #fff);
  box-shadow: 0 30px 90px rgba(11, 45, 74, 0.28);
  color: var(--text-primary, #2f2f3a);
  font-family: var(--font-sans, "Estedad", Tahoma, Arial, sans-serif);
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(0.985);
  transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1), transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.mx-demo-modal.is-open .mx-demo-dialog {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.mx-demo-close {
  position: absolute;
  inset-block-start: 18px;
  inset-inline-end: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border, #e8eaf2);
  border-radius: 12px;
  background: var(--page-bg, #f5f7ff);
  color: var(--text-secondary, #7a7a8c);
  cursor: pointer;
  font-size: 1.55rem;
  line-height: 1;
  transition: border-color 220ms ease, color 220ms ease, transform 220ms ease;
}

.mx-demo-close:hover {
  border-color: var(--primary-light, #98bdff);
  color: var(--primary, #4b49ac);
  transform: translateY(-1px);
}

.mx-demo-heading {
  padding-inline-end: 48px;
  margin-block-end: 26px;
}

.mx-demo-eyebrow {
  margin-block-end: 8px;
  color: var(--primary, #4b49ac);
  font-size: 0.78rem;
  font-weight: 700;
}

.mx-demo-heading h2 {
  margin-block-end: 8px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.55;
}

.mx-demo-heading > p:last-child {
  margin: 0;
  font-size: 0.92rem;
}

.mx-demo-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.mx-demo-field {
  min-width: 0;
}

.mx-demo-field-wide,
.mx-demo-actions {
  grid-column: 1 / -1;
}

.mx-demo-field label {
  display: block;
  margin-block-end: 7px;
  color: var(--mx-text, #0f172a);
  font-size: 0.84rem;
  font-weight: 600;
}

.mx-demo-field label > span[aria-hidden="true"] {
  color: var(--coral, #f3797e);
}

.mx-demo-optional {
  margin-inline-start: 6px;
  color: var(--text-muted, #a7a7b5);
  font-size: 0.72rem;
  font-weight: 400;
}

.mx-demo-field input,
.mx-demo-field select,
.mx-demo-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--border, #e8eaf2);
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: var(--mx-text, #0f172a);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.mx-demo-field textarea {
  min-height: 92px;
  resize: vertical;
}

.mx-demo-field input:focus,
.mx-demo-field select:focus,
.mx-demo-field textarea:focus {
  border-color: var(--mx-blue, #0077ff);
  box-shadow: 0 0 0 4px rgba(0, 119, 255, 0.1);
}

.mx-demo-field [aria-invalid="true"] {
  border-color: var(--coral, #f3797e);
  box-shadow: 0 0 0 4px rgba(243, 121, 126, 0.1);
}

.mx-demo-field small {
  display: block;
  min-height: 20px;
  padding-block-start: 4px;
  color: #c2414a;
  font-size: 0.72rem;
}

.mx-demo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.mx-demo-feedback {
  margin: 0;
  color: #c2414a;
  font-size: 0.8rem;
  white-space: pre-line;
}

.mx-demo-submit {
  flex: 0 0 auto;
  border: 0;
  cursor: pointer;
}

.mx-demo-submit[disabled] {
  cursor: wait;
  opacity: 0.66;
  transform: none;
}

.mx-demo-trap {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  inset-inline-start: -10000px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.mx-demo-success {
  padding-block: 24px 8px;
  text-align: center;
}

.mx-demo-success > span {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  place-items: center;
  border-radius: 18px;
  background: rgba(0, 194, 168, 0.12);
  color: var(--mx-teal, #00c2a8);
  font-size: 1.55rem;
  font-weight: 700;
}

.mx-demo-success h3 {
  margin-block-end: 8px;
  font-size: 1.4rem;
}

.mx-demo-success p {
  margin-block-end: 24px;
}

@media (max-width: 640px) {
  .mx-demo-modal {
    padding: 0;
    align-items: end;
  }

  .mx-demo-dialog {
    width: 100%;
    max-height: 92dvh;
    padding: 28px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    transform: translate3d(0, 24px, 0);
  }

  .mx-demo-heading {
    padding-inline-end: 42px;
  }

  .mx-demo-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mx-demo-field-wide,
  .mx-demo-actions {
    grid-column: auto;
  }

  .mx-demo-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mx-demo-submit {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mx-demo-modal,
  .mx-demo-dialog,
  .mx-demo-close,
  .mx-demo-field input,
  .mx-demo-field select,
  .mx-demo-field textarea {
    transition: none !important;
  }
}

