/*!
 * RioGrafica - Wizard de Pedido de Orcamento
 * Plugin: riografica-orcamentos
 *
 * Este ficheiro e a fonte de verdade do estilo do formulario.
 * NAO duplicar estas regras no Additional CSS do Customizer nem no Elementor.
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

.rg-wizard-root,
[data-rg-cta-externo] {
  --rg-dark: #004B3C;
  --rg-teal: #00B996;
  --rg-bg: #F8F9FA;
  --rg-text: #1a1a1a;
  --rg-muted: #6b7280;
  --rg-border: #d7dbe0;
  --rg-placeholder: #9aa0a6;
  --rg-error: #b32d2e;
  --rg-error-bg: #fdf3f3;
  --rg-radius: 2px;
  --rg-font: 'Poppins', sans-serif;
}

/* ==========================================================================
   2. Campos
   ========================================================================== */

.rg-field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--rg-text);
}

.rg-textarea,
.rg-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--rg-border);
  border-radius: var(--rg-radius);
  font-family: var(--rg-font);
  font-size: 15px;
  color: var(--rg-text);
  margin-bottom: 0;
}

.rg-textarea { min-height: 180px; padding: 16px; resize: vertical; }
.rg-input { padding: 14px 16px; }

.rg-textarea::placeholder,
.rg-input::placeholder { color: var(--rg-placeholder); }

/* Foco: o #00FFFF original nao era da paleta e um anel a 25% de opacidade
   nao atinge os 3:1 que a WCAG 2.2 exige para o indicador de foco. */
.rg-input:focus-visible,
.rg-textarea:focus-visible {
  outline: none;
  border-color: var(--rg-dark);
  box-shadow: 0 0 0 3px rgba(0, 75, 60, 0.35);
}

.rg-error + .rg-field-label { margin-top: 16px; }

/* ==========================================================================
   3. Upload
   ========================================================================== */

.rg-dropzone {
  position: relative;
  display: block;
  padding: 28px 16px;
  border: 1.5px dashed var(--rg-placeholder);
  border-radius: var(--rg-radius);
  text-align: center;
  cursor: pointer;
  color: var(--rg-muted);
  font-size: 14px;
  transition: .15s border-color;
}

.rg-dropzone:hover,
.rg-dropzone.is-dragover { border-color: var(--rg-teal); color: var(--rg-teal); }

.rg-dropzone.has-file { border-style: solid; border-color: var(--rg-teal); color: var(--rg-text); }

.rg-dropzone svg { display: block; margin: 0 auto 8px; }

/* display:none tirava o input da ordem de tabulacao e ninguem conseguia
   anexar um PDF por teclado. Clip visual mantem-no focavel. */
.rg-dropzone .rg-file-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* O input esta clipado, por isso o anel de foco vive na dropzone. */
.rg-dropzone:focus-within {
  outline: 3px solid var(--rg-dark);
  outline-offset: 2px;
  border-color: var(--rg-teal);
}

.rg-file-name {
  display: block;
  margin-top: 8px;
  font-weight: 600;
  color: var(--rg-text);
  word-break: break-all;
}

/* O tema e o Elementor estilizam <button>; forcar aspeto de link. */
.rg-dropzone .rg-file-remove,
.rg-dropzone .rg-file-remove:hover,
.rg-dropzone .rg-file-remove:focus {
  display: inline-block;
  width: auto;
  margin: 8px 0 0;
  padding: 4px 8px;
  background: none !important;
  border: none !important;
  box-shadow: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--rg-error) !important;
  text-decoration: underline;
  cursor: pointer;
}

/* ==========================================================================
   4. Botoes
   ========================================================================== */

.rg-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: var(--rg-radius);
  background: var(--rg-teal);
  color: #fff !important;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: .15s background;
}

.rg-btn:hover { background: #019a7c; color: #fff; }
.rg-btn:disabled { opacity: .5; cursor: not-allowed; }

.rg-btn--inline { max-width: 340px; margin-top: 24px; }

.rg-btn:focus-visible,
.rg-file-remove:focus-visible,
.rg-checkbox:focus-visible {
  outline: 3px solid var(--rg-dark);
  outline-offset: 2px;
}

/* Botao de voltar: accao secundaria. Sem fundo, texto e seta em verde com
   underline, para nao competir com o "Confirmar pedido". A seta e uma entidade
   dentro do texto, por isso herda a cor automaticamente. */
.rg-btn-back {
  display: inline-block;
  width: auto;
  max-width: none;
  margin: 16px 0 0;
  padding: 8px 0;
  background: none !important;
  border: none !important;
  box-shadow: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  /* O --rg-teal como cor de texto da 2,5:1 sobre o fundo claro e falha AA.
     O --rg-dark e o verde escuro da marca e da cerca de 9,7:1. */
  color: var(--rg-dark) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.rg-btn-back:hover {
  color: #003D31 !important;
  text-decoration-thickness: 2px;
}

.rg-btn-back:focus-visible {
  outline: 3px solid var(--rg-dark);
  outline-offset: 2px;
}

/* Loading: trava visualmente o duplo submit */
.rg-btn.is-loading { color: transparent !important; pointer-events: none; }
.rg-spinner { display: none; }
.rg-btn.is-loading .rg-spinner {
  display: block;
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rg-spin .7s linear infinite;
}
@keyframes rg-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   5. CTA
   O botao visivel e o do widget da coluna esquerda (data-rg-cta-externo).
   O CTA interno do wizard fica escondido mas funcional: o de fora delega nele.
   ========================================================================== */

.rg-cta-wrap { padding: 28px 0; }
.rg-wizard-root .rg-cta-wrap { display: none !important; }

/* Bloco de introducao da pagina (titulo, texto, contactos e o CTA).
   Some enquanto o wizard esta aberto, para o visitante ver so o formulario.
   A classe .rg-intro esta no container do Elementor - se a estrutura da pagina
   mudar, basta voltar a por a classe no separador Avancado do container. */
body.rg-wizard-aberto .rg-intro { display: none !important; }

/* O atributo hidden do HTML e display:none da folha do browser, que perde para
   qualquer classe com display. Sem isto o "Remover ficheiro" e o CTA externo
   apareciam quando nao deviam. Escopado de proposito, para nao mexer no resto
   do site. */
.rg-wizard-root [hidden],
.rg-file-remove[hidden],
.rg-cta-wrap[hidden],
[data-rg-cta-externo][hidden] { display: none !important; }

/* ==========================================================================
   6. Passos
   ========================================================================== */

.rg-wizard { max-width: 640px; width: 100%; }

.rg-wizard-step { display: none; }
.rg-wizard-step.is-active { display: block; }

.rg-progress {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  /* --rg-teal sobre branco da 2,5:1 e falha AA em texto pequeno.
     --rg-dark da 10,1:1. */
  color: var(--rg-dark);
}

/* white-space:nowrap a 48px num container de 640px empurrava o titulo para
   ~700px e criava scroll horizontal na pagina entre ~600px e ~900px. */
.rg-wizard-title {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.15;
  color: var(--rg-text);
  white-space: normal;
  text-wrap: balance;
}

.rg-wizard-subtitle {
  margin: 0 0 32px;
  font-size: 17px;
  font-weight: 400;
  color: var(--rg-muted);
}

/* Recebem foco por JS ao mudar de passo; nao queremos anel num heading. */
.rg-wizard-title:focus,
.rg-thankyou-text:focus { outline: none; }

.rg-thankyou-text {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--rg-text);
}
.rg-thankyou-text strong { font-weight: 700; }

.rg-step3-shape-mobile { display: none; }

/* ==========================================================================
   7. Erros
   ========================================================================== */

.rg-error {
  margin: 6px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--rg-error);
}
.rg-error:empty { display: none; }

.rg-error--form {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--rg-error-bg);
  border-left: 3px solid var(--rg-error);
  font-size: 14.5px;
}

.rg-input.has-error,
.rg-textarea.has-error { border-color: var(--rg-error); background: var(--rg-error-bg); }

.rg-input.has-error:focus-visible,
.rg-textarea.has-error:focus-visible { box-shadow: 0 0 0 3px rgba(179, 45, 46, .25); }

.rg-checkbox.has-error { outline: 2px solid var(--rg-error); outline-offset: 2px; }

/* ==========================================================================
   8. Consentimento RGPD
   ========================================================================== */

.rg-consent { display: flex; align-items: flex-start; gap: 12px; margin-top: 24px; }

.rg-checkbox {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  margin: 2px 0 0;
  accent-color: var(--rg-dark);
  cursor: pointer;
}

.rg-consent-label { font-size: 14px; line-height: 1.5; color: var(--rg-muted); cursor: pointer; }
.rg-consent-label a { color: var(--rg-dark); font-weight: 600; text-decoration: underline; }

/* Honeypot fora do ecra, nao display:none: muitos bots ignoram campos com
   display:none mas preenchem estes. */
.rg-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ==========================================================================
   9. Responsive - 767px alinha com o breakpoint mobile do Elementor
   ========================================================================== */

@media (max-width: 767px) {
  .rg-btn--inline { max-width: 100%; margin-left: auto; margin-right: auto; }
  .rg-thankyou-text { font-size: 26px; }
  .rg-step3-shape-mobile { display: block; width: 100%; height: auto; margin-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .rg-dropzone, .rg-btn { transition: none; }
  .rg-btn.is-loading .rg-spinner { animation-duration: 1.5s; }
}
