/* Overlay e modal — pure CSS, no JS required.
   IMPORTANTE: usa PX (não rem) e !important nas propriedades críticas de
   posicionamento. Sem isso, HTMLs hostis (CSS reset agressivo, text-align:right,
   float, direction:rtl, transforms globais) bagunçavam o modal — botava no canto
   superior direito em vez do centro. Agora o modal SEMPRE fica centralizado,
   independente do CSS da página. */
.gdm-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  background: rgba(10, 10, 15, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 2147483647 !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: row !important;
  text-align: left;
  direction: ltr !important;
  float: none !important;
  transform: none !important;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  animation: gdmFadeIn 0.2s ease-out;
}

/* Reset defensivo: garante que descendentes herdam tamanhos base sãos
   mesmo se a página tiver CSS reset que mude html/body */
.gdm-overlay, .gdm-overlay * {
  box-sizing: border-box;
  float: none;
}

@keyframes gdmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gdm-backdrop-close {
  position: absolute;
  inset: 0;
  z-index: 0;
  text-decoration: none;
}

.gdm-card {
  /* Centralização ABSOLUTA via translate — método mais confiável.
     Ignora qualquer CSS hostil do parent (flex/grid quebrado, align-items errado etc).
     Modal SEMPRE no centro perfeito do viewport, vertical e horizontal.
     Note: transform sem !important pra deixar o keyframe gdmSlideIn animar
     (CSS não anima props com !important). */
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
  margin: 0 !important;
  z-index: 1 !important;
  max-width: 500px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 32px); /* não passa do viewport */
  overflow-y: auto; /* se conteúdo for muito alto, scrolla internamente */
  -webkit-overflow-scrolling: touch;
  background: #fff;
  color: #1a1a26;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-size: 16px;
  line-height: 1.5;
  float: none !important;
  direction: ltr;
  animation: gdmSlideIn 0.25s ease-out;
}

@keyframes gdmSlideIn {
  from { transform: translate(-50%, calc(-50% + 20px)); opacity: 0; }
  to   { transform: translate(-50%, -50%); opacity: 1; }
}

.gdm-x {
  position: absolute !important;
  top: 8px !important;
  right: 13px !important;
  left: auto !important;
  bottom: auto !important;
  background: none !important;
  color: rgba(255, 255, 255, 0.9);
  font-size: 24px;
  text-decoration: none !important;
  padding: 5px 10px;
  z-index: 3 !important;
  line-height: 1;
  float: none !important;
  margin: 0 !important;
  transform: none !important;
}
.gdm-x:hover { color: #fff; }

.gdm-head {
  padding: 27px 24px 24px;
  text-align: center;
  color: #fff;
}

.gdm-logo {
  margin-bottom: 16px;
  text-align: center;
}
.gdm-logo img {
  max-width: 140px;
  max-height: 70px;
  object-fit: contain;
  display: inline-block;
}

.gdm-h {
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 6px;
  font-family: inherit;
  line-height: 1.3;
}

.gdm-sub {
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  margin: 0;
  line-height: 1.4;
}

.gdm-body {
  padding: 24px 26px 22px;
  text-align: left;
}

.gdm-label {
  display: block;
  color: #1a1a26;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.gdm-input {
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #1a1a26;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 16px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gdm-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.gdm-input::placeholder { color: #9ca3af; }

.gdm-btn {
  width: 100%;
  padding: 15px 22px;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.gdm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.gdm-privacy {
  text-align: center;
  color: #6b7280;
  font-size: 12.5px;
  margin: 14px 0 0;
  line-height: 1.4;
}

/* Success state */
.gdm-check {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gdm-sub-d {
  color: #6b7280;
  font-size: 15px;
  text-align: center;
  margin: 0 0 6px;
  line-height: 1.4;
}

.gdm-email-d {
  color: #1a1a26;
  font-weight: 700;
  text-align: center;
  margin: 0 0 21px;
  font-size: 16px;
  word-break: break-all;
  line-height: 1.3;
}

.gdm-info-box {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 19px;
  text-align: left;
}

.gdm-info-icon {
  flex-shrink: 0;
  color: #16a34a;
  font-size: 18px;
  line-height: 1.3;
}

.gdm-info-text {
  color: #4b5563;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0;
  text-align: left;
}

/* =================================================================== */
/* VARIANTE 2 — Dark/gaming com aviso de atualização                    */
/* (.gdm-v2 aplica em .gdm-form-state ou .gdm-success-state)           */
/* Card maior (480px) e fontes maiores pra acomodar mais elementos     */
/* =================================================================== */
.gdm-card .gdm-v2 {
  background: #0f0f1a;
  color: #e5e7eb;
}
/* Quando variante 2 está ativa, o card é maior + dark */
.gdm-card:has(.gdm-v2) {
  background: #0f0f1a;
  color: #e5e7eb;
  border: 1px solid #2a2a3e;
  max-width: 500px;
}
/* Fallback pra browsers sem :has() — força largura via .gdm-form-state.gdm-v2 ocupar tudo */
.gdm-form-state.gdm-v2,
.gdm-success-state.gdm-v2 {
  background: #0f0f1a;
  color: #e5e7eb;
}
.gdm-v2-body {
  padding: 38px 32px 30px;
  text-align: center;
}
.gdm-v2 .gdm-logo {
  margin-bottom: 22px;
}
.gdm-v2 .gdm-logo img {
  max-width: 96px;
  max-height: 96px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}
.gdm-v2-title {
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  text-transform: uppercase;
  line-height: 1.2;
}
.gdm-v2-subtitle {
  color: #ef4444;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 20px;
  line-height: 1.4;
}
.gdm-v2-desc {
  color: #9ca3af;
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 22px;
  text-align: center;
}
.gdm-v2-alert {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  border-radius: 6px;
  padding: 14px 18px;
  text-align: left;
  margin: 0 0 24px;
}
.gdm-v2-alert-title {
  color: #ef4444;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.gdm-v2-alert-desc {
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.55;
}
.gdm-v2-email-label {
  display: block;
  color: #9ca3af;
  font-size: 14px;
  text-align: left;
  margin: 0 0 9px;
  font-weight: 500;
}
.gdm-v2-input {
  width: 100%;
  padding: 15px 17px;
  background: #1a1a26;
  border: 1px solid #2a2a3e;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  margin-bottom: 16px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gdm-v2-input:focus {
  outline: none;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.gdm-v2-input::placeholder {
  color: #4b5563;
}
.gdm-v2-btn {
  width: 100%;
  padding: 17px 22px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.gdm-v2-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(239, 68, 68, 0.5);
}
.gdm-v2-status {
  margin-top: 22px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
  letter-spacing: 0.02em;
}
/* Estado de sucesso na variante 2 */
.gdm-v2-success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 22px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 32px rgba(34, 197, 94, 0.4);
}
.gdm-v2-email-display {
  color: #fff;
  font-weight: 700;
  text-align: center;
  margin: 0 0 20px;
  font-size: 16px;
  word-break: break-all;
  background: #1a1a26;
  border: 1px solid #2a2a3e;
  padding: 12px 16px;
  border-radius: 6px;
}
.gdm-v2-info-box {
  background: rgba(34, 197, 94, 0.08);
  border-left: 3px solid #22c55e;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 0 0 20px;
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
}

/* =================================================================== */
/* LOADING SPINNER — aparece antes do modal (delay configurável)       */
/* Visual clean/profissional, sem temática de jogo                      */
/* =================================================================== */
.gdm-loading-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  background: rgba(10, 10, 15, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 2147483646 !important; /* um abaixo do modal */
  display: none;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  gap: 18px;
  float: none !important;
  transform: none !important;
  direction: ltr !important;
  animation: gdmFadeIn 0.15s ease-out;
}
.gdm-loading-overlay.show { display: flex !important; }
.gdm-loading-spinner {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 44px !important;
  height: 44px !important;
  margin: 0 auto !important;
  border: 3px solid rgba(255, 255, 255, 0.15) !important;
  border-top-color: rgba(255, 255, 255, 0.95) !important;
  border-radius: 50% !important;
  float: none !important;
  flex-shrink: 0 !important;
  align-self: center !important;
  animation: gdmSpin 0.8s linear infinite;
}
.gdm-loading-text {
  position: relative !important;
  margin: 0 auto !important;
  text-align: center !important;
  color: rgba(255, 255, 255, 0.75);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  float: none !important;
  align-self: center !important;
  -webkit-font-smoothing: antialiased;
}
@keyframes gdmSpin {
  to { transform: rotate(360deg); }
}
