/* ─────────────────────────────────────────────
   WhatsApp Franquias — Frontend v1.2
   Correções: modal mobile + espaçamento botões
   ───────────────────────────────────────────── */

:root {
  --gwf-radius: 16px;
  --gwf-shadow: 0 8px 32px rgba(0,0,0,.18);
  --gwf-ease: cubic-bezier(.4,0,.2,1);
  --gwf-z: 99999;
}

/* ════════════════════════════════════════════
   BOTÃO FLUTUANTE
   ════════════════════════════════════════════ */
#gwf-btn {
  position: fixed !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 14px 22px !important;
  border-radius: 50px !important;
  border: none !important;
  cursor: pointer !important;
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: .01em !important;
  line-height: 1 !important;
  box-shadow: var(--gwf-shadow) !important;
  z-index: var(--gwf-z) !important;
  transition: transform .22s var(--gwf-ease), box-shadow .22s var(--gwf-ease) !important;
  outline: none !important;
  text-decoration: none !important;
  /* Garante que nada do tema sobreponha */
  background-image: none !important;
  box-sizing: border-box !important;
}

#gwf-btn:hover  { transform: translateY(-3px) scale(1.03) !important; box-shadow: 0 14px 40px rgba(0,0,0,.22) !important; }
#gwf-btn:active { transform: scale(.97) !important; }
#gwf-btn svg    { flex-shrink: 0 !important; display: block !important; }
#gwf-btn span   { display: block !important; }

#gwf-btn.pos-bottom-right { bottom: 28px !important; right: 28px !important; }
#gwf-btn.pos-bottom-left  { bottom: 28px !important; left: 28px !important; }
#gwf-btn.pos-top-right    { top: 28px !important; right: 28px !important; }
#gwf-btn.pos-top-left     { top: 28px !important; left: 28px !important; }

@keyframes gwf-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37,211,102,.55); }
  70%  { box-shadow: 0 0 0 14px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}
#gwf-btn.gwf-pulse { animation: gwf-pulse 2s ease-out 1s 2; }

/* ════════════════════════════════════════════
   OVERLAY
   ════════════════════════════════════════════ */
#gwf-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,.5) !important;
  z-index: calc(var(--gwf-z) + 1) !important;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  /* Estado fechado: invisível mas sem afetar layout */
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity .22s var(--gwf-ease), visibility .22s var(--gwf-ease) !important;
}
#gwf-overlay.gwf-open {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* ════════════════════════════════════════════
   MODAL — Desktop (centrado)
   ════════════════════════════════════════════ */
#gwf-modal {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -48%) !important; /* ligeiramente acima = fechado */
  width: 92% !important;
  max-width: 460px !important;
  max-height: 88vh !important;
  background: #fff !important;
  border-radius: var(--gwf-radius) !important;
  overflow: hidden !important;
  box-shadow: 0 24px 64px rgba(0,0,0,.26) !important;
  z-index: calc(var(--gwf-z) + 2) !important;
  display: flex !important;
  flex-direction: column !important;
  /* Estado fechado */
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: transform .26s var(--gwf-ease), opacity .26s var(--gwf-ease), visibility .26s var(--gwf-ease) !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
}
#gwf-modal.gwf-open {
  transform: translate(-50%, -50%) !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* ════════════════════════════════════════════
   MODAL — Mobile (bottom sheet)
   ════════════════════════════════════════════ */
@media (max-width: 600px) {
  #gwf-btn { font-size: 14px !important; padding: 12px 18px !important; }
  #gwf-btn.pos-bottom-right { bottom: 18px !important; right: 16px !important; }
  #gwf-btn.pos-bottom-left  { bottom: 18px !important; left: 16px !important; }
  #gwf-btn.pos-top-right    { top: 18px !important; right: 16px !important; }
  #gwf-btn.pos-top-left     { top: 18px !important; left: 16px !important; }

  /* Sobrescreve o posicionamento desktop */
  #gwf-modal {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 82vh !important;
    border-radius: 20px 20px 0 0 !important;
    /* Fechado: escorrega para baixo */
    transform: translateY(100%) !important;
  }
  #gwf-modal.gwf-open {
    transform: translateY(0) !important;
  }
}

/* ════════════════════════════════════════════
   CONTEÚDO DO MODAL
   ════════════════════════════════════════════ */
#gwf-modal .gwf-modal-header {
  padding: 20px 22px 16px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}
#gwf-modal .gwf-modal-header-text { flex: 1 !important; min-width: 0 !important; }
#gwf-modal .gwf-modal-header h2 {
  margin: 0 0 5px !important;
  padding: 0 !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #fff !important;
  line-height: 1.35 !important;
  border: none !important;
  background: none !important;
}
#gwf-modal .gwf-modal-header p {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  color: rgba(255,255,255,.85) !important;
  line-height: 1.5 !important;
}

#gwf-modal .gwf-modal-close {
  background: rgba(255,255,255,.2) !important;
  border: none !important;
  color: #fff !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  font-size: 17px !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  margin-top: 2px !important;
  padding: 0 !important;
  transition: background .15s !important;
}
#gwf-modal .gwf-modal-close:hover { background: rgba(255,255,255,.35) !important; }

/* Barra de busca */
#gwf-modal .gwf-search-wrap {
  padding: 12px 16px 10px !important;
  border-bottom: 1px solid #efefef !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}
#gwf-modal .gwf-search-input {
  width: 100% !important;
  padding: 9px 12px 9px 36px !important;
  border: 1.5px solid #e0e0e0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  background: #f7f7f7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center !important;
  box-sizing: border-box !important;
  outline: none !important;
  transition: border-color .15s !important;
  color: #222 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
#gwf-modal .gwf-search-input:focus { border-color: #25D366 !important; background-color: #fff !important; }

/* Lista de cidades — container scrollável */
#gwf-modal .gwf-city-list {
  overflow-y: auto !important;
  flex: 1 !important;
  padding: 8px 10px 12px !important;
  -webkit-overflow-scrolling: touch !important; /* scroll suave iOS */
  overscroll-behavior: contain !important;
}

/* Label do estado */
#gwf-modal .gwf-estado-label {
  display: block !important;
  padding: 10px 8px 5px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: .1em !important;
  text-transform: uppercase !important;
  color: #bbb !important;
  border: none !important;
  background: none !important;
  margin: 0 !important;
}

/* ── Botão de cidade — blindado contra resets do tema ── */
#gwf-modal .gwf-city-btn {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  /* Espaçamento vertical explícito → evita botões colados */
  padding: 11px 14px !important;
  margin: 0 0 4px 0 !important;    /* gap entre botões */
  background: #f9f9f9 !important;
  border: 1px solid #efefef !important;
  border-radius: 10px !important;
  text-align: left !important;
  cursor: pointer !important;
  font-size: 15px !important;
  font-family: inherit !important;
  color: #1a1a1a !important;
  gap: 12px !important;
  transition: background .15s, border-color .15s !important;
  box-sizing: border-box !important;
  line-height: 1.3 !important;
  text-decoration: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  min-height: 52px !important;
}
#gwf-modal .gwf-city-btn:last-child { margin-bottom: 0 !important; }
#gwf-modal .gwf-city-btn:hover  { background: #f0fdf4 !important; border-color: #bbf7d0 !important; }
#gwf-modal .gwf-city-btn:active { background: #dcfce7 !important; }

#gwf-modal .gwf-city-icon {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  background: #dcfce7 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
#gwf-modal .gwf-city-icon svg { display: block !important; }

#gwf-modal .gwf-city-name  { font-weight: 600 !important; flex: 1 !important; color: #1a1a1a !important; }
#gwf-modal .gwf-city-arrow { color: #ccc !important; font-size: 16px !important; flex-shrink: 0 !important; }

/* Footer */
#gwf-modal .gwf-modal-footer {
  padding: 10px 20px 14px !important;
  text-align: center !important;
  font-size: 11px !important;
  color: #ccc !important;
  border-top: 1px solid #f0f0f0 !important;
  flex-shrink: 0 !important;
}

/* Acessibilidade: reduced motion */
@media (prefers-reduced-motion: reduce) {
  #gwf-btn, #gwf-modal, #gwf-overlay { transition: none !important; animation: none !important; }
}
