/* ============================================================
   Complya — site-modal.css
   ============================================================ */

.hp { position: absolute; left: -9999px; opacity: 0; pointer-events: none; height: 0; width: 0; }

/* Container do modal — centralizado vertical e horizontalmente,
   sem scroll externo (o scroll fica dentro do body do dialog). */
.demo-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.demo-modal[hidden] { display: none; }

.demo-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14, 23, 38, .55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: demoFadeIn .15s ease-out;
}

/* Dialog: altura máxima do viewport com flex column,
   header fixo e body com scroll interno. */
.demo-modal-dialog {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);   /* dvh evita problema com teclado mobile */
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  overflow: hidden;                  /* preserva border-radius com scroll interno */
  animation: demoSlideIn .2s ease-out;
}

@keyframes demoFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes demoSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}

.demo-modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px;
  border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink-light); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  z-index: 2;                        /* fica acima do conteúdo que rola */
  transition: background .15s, color .15s;
}
.demo-modal-close:hover { background: var(--bg-alt); color: var(--ink); }

/* Body com scroll interno */
.demo-modal-body {
  padding: 28px 28px 22px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.demo-modal-body::-webkit-scrollbar { width: 8px; }
.demo-modal-body::-webkit-scrollbar-track { background: transparent; }
.demo-modal-body::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
}
.demo-modal-body::-webkit-scrollbar-thumb:hover { background: var(--ink-light); }

@media (max-width: 520px) { .demo-modal-body { padding: 24px 18px 18px; } }

.demo-modal-head { margin-bottom: 18px; }
.demo-modal-head .eyebrow { color: var(--primary); background: var(--bg-alt); }
.demo-modal-head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem; font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 6px;
}
.demo-modal-head p { color: var(--ink-light); margin: 0; font-size: .92rem; }

.demo-form .form-row { margin-bottom: 14px; }
.demo-form .form-row:last-child { margin-bottom: 0; }
.demo-form .form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .demo-form .form-grid-2 { grid-template-columns: 1fr; gap: 0; } }

.demo-form label {
  display: block;
  font-size: .86rem; font-weight: 600;
  color: var(--ink); margin-bottom: 5px;
}
.demo-form label .req { color: #DC2626; }
.demo-form label .opt { color: var(--ink-light); font-weight: 400; }

.demo-form input,
.demo-form select,
.demo-form textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit; font-size: .94rem;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.demo-form input:focus,
.demo-form select:focus,
.demo-form textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.demo-form input.is-invalid,
.demo-form select.is-invalid,
.demo-form textarea.is-invalid {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

.demo-form textarea { resize: vertical; min-height: 70px; }

.demo-form select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236B7280' d='M6 8 0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 10px;
  padding-right: 34px;
}

.demo-form .form-hint { display: block; color: var(--ink-light); font-size: .76rem; margin-top: 4px; }

.demo-form .form-error {
  display: none;
  color: #DC2626;
  font-size: .8rem;
  margin-top: 5px;
}
.demo-form .form-error.is-visible { display: block; }

.demo-form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
@media (max-width: 520px) {
  .demo-form-actions { flex-direction: column-reverse; }
  .demo-form-actions .btn { width: 100%; justify-content: center; }
}

.demo-form-actions .btn-loading:not([hidden]) { display: inline-flex; align-items: center; gap: 6px; }
.spin { display: inline-block; animation: demoSpin 1s linear infinite; }
@keyframes demoSpin { to { transform: rotate(360deg); } }

.demo-form-error {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 14px;
  padding: 11px 13px;
  background: rgba(220, 38, 38, .06);
  border: 1px solid rgba(220, 38, 38, .25);
  border-radius: 8px;
  color: #991B1B;
  font-size: .88rem;
}
.demo-form-error[hidden] { display: none; }
.demo-form-error i { color: #DC2626; font-size: 1.05rem; flex-shrink: 0; margin-top: 1px; }

.demo-modal-success { text-align: center; padding: 16px 0; }
.demo-modal-success-icon {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: rgba(22, 163, 74, .12);
  color: #16A34A;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 14px;
  animation: demoBounce .4s ease-out;
}
@keyframes demoBounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.demo-modal-success h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem; margin: 0 0 8px;
}
.demo-modal-success p { color: var(--ink-light); margin: 0 0 18px; font-size: .92rem; }
.demo-modal-success a { color: var(--primary); }

body.has-modal-open { overflow: hidden; }
