/* ============================================================
   ALMA FORMS GBP — form.css
   Layout do formulário público (index.html), por etapas.
   Fase 4 (estrutura/visual base completos nesta fase; navegação
   entre etapas, validação e payload entram na Fase 5).
   ============================================================ */

.form-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 60px;
}

/* ------------------------------------------------------------
   Cabeçalho (logo + título do sistema)
   ------------------------------------------------------------ */

.form-header {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-align: center;
}

.form-header__logo {
  height: 70px;
}

.form-header__title {
  font-size: 20px;
  margin: 0;
}

.form-header__subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0;
}

/* ------------------------------------------------------------
   Barra de progresso
   ------------------------------------------------------------ */

.progress-bar {
  width: 100%;
  max-width: 640px;
  margin-bottom: 24px;
}

.progress-bar__track {
  height: 8px;
  border-radius: var(--radius-badge);
  background: var(--color-border);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-badge);
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.progress-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* ------------------------------------------------------------
   Card da etapa
   ------------------------------------------------------------ */

.form-card {
  width: 100%;
  max-width: 640px;
}

.step-header {
  margin-bottom: 24px;
}

.step-header__title {
  font-size: 19px;
  margin-bottom: 4px;
}

.step-header__description {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0;
}

.form-step {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-step[hidden] {
  display: none;
}

/* ------------------------------------------------------------
   Campos
   ------------------------------------------------------------ */

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group--tight {
  gap: 3px;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}

.field-label__optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

.field-required::after {
  content: " *";
  color: var(--color-error);
}

.field-help {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

.field-error {
  font-size: 12px;
  color: var(--color-error);
  margin: 0;
  display: none; /* mensagens de erro agora aparecem como toast, nunca inline */
}

.field-group.has-error .input {
  border-color: var(--color-error);
}

textarea.input {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font-body);
}

/* Linha com múltiplos campos lado a lado (colapsa no mobile) */
.field-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field-row--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ------------------------------------------------------------
   Grupos de opção (Sim/Não, seleção em botões)
   ------------------------------------------------------------ */

.option-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.option-pill {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-badge);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-white);
  cursor: pointer;
  outline: none;
}

.option-pill::-moz-focus-inner {
  border: 0;
}

.option-pill:hover {
  border-color: var(--color-blue-mid);
  color: var(--color-text);
}

.option-pill[aria-pressed="true"] {
  background: var(--gradient-primary);
  border-style: none;
  /* Sem borda (não só cor transparente) — evita a mesma costura visual
     que ocorre no contorno arredondado entre o degradê e a curva da borda. */
  padding: 9px 19px; /* compensa o 1px de borda que sumiu, pra não "saltar" de tamanho */
  color: var(--color-white);
}

/* ------------------------------------------------------------
   Autocomplete (setor / categoria — Fase 5)
   ------------------------------------------------------------ */

.autocomplete {
  position: relative;
}

.autocomplete__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  box-shadow: var(--shadow-elevated);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
}

.autocomplete__list[hidden] {
  display: none;
}

.autocomplete__option {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.autocomplete__option:hover,
.autocomplete__option--active {
  background: rgba(0, 175, 250, 0.08);
  color: var(--color-blue-strong);
}

/* ------------------------------------------------------------
   Alertas inline (ex.: incoerência setor/categoria)
   ------------------------------------------------------------ */

.inline-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  font-size: 13px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #92590A;
  margin-top: 5px;
}

.inline-alert[hidden] {
  display: none;
}

/* online-alert e incoherence-alert são filhos diretos de .form-step,
   então já recebem 20px de gap do flex do form-step — o margin-top:5px
   da classe acima somaria 25px ali. Os outros 2 alertas (área de
   cobertura e aviso de senha do Gmail) ficam dentro de um wrapper
   próprio sem flex-gap, então mantêm os 5px normalmente. */
.form-step > .inline-alert {
  margin-top: 0;
}

/* ------------------------------------------------------------
   Upload de mídia (Etapa 8 — imagens e vídeos para o Drive)
   ------------------------------------------------------------ */

.media-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-input);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.media-dropzone:hover,
.media-dropzone--dragover {
  border-color: var(--color-blue-mid);
  background: rgba(0, 175, 250, 0.04);
}

.media-dropzone__title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.media-dropzone__hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

.media-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  font-size: 13px;
}

.media-file-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-file-item__remove {
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.media-file-item__remove:hover {
  color: var(--color-error);
}

.media-file-item__progress {
  width: 60px;
  height: 4px;
  border-radius: var(--radius-badge);
  background: var(--color-border);
  overflow: hidden;
  flex-shrink: 0;
}

.media-file-item__progress-fill {
  height: 100%;
  background: var(--color-blue-strong);
}

/* ------------------------------------------------------------
   Revisão final (Etapa 10)
   ------------------------------------------------------------ */

.review-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-block__title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.review-block__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  padding: 4px 0;
}

.review-block__row dt {
  color: var(--color-text-muted);
}

.review-block__row dd {
  margin: 0;
  text-align: right;
  max-width: 60%;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.review-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  padding-top: 8px;
}

.review-confirm input {
  margin-top: 3px;
}

/* ------------------------------------------------------------
   Navegação entre etapas
   ------------------------------------------------------------ */

.form-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.form-nav .btn {
  min-width: 120px;
}

.form-nav__spacer {
  flex: 1;
}

/* ------------------------------------------------------------
   Tela de confirmação de envio
   ------------------------------------------------------------ */

.form-confirmation {
  text-align: center;
  padding: 40px 24px;
}

.form-confirmation__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-confirmation__icon svg {
  width: 28px;
  height: 28px;
}

.form-confirmation__title {
  font-size: 19px;
  margin-bottom: 8px;
}

.form-confirmation__text {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0 auto;
  max-width: 420px;
}

/* ─── Hours widget ─────────────────────────────────────────── */

.hours-widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hours-day {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  overflow: visible;
}

.hours-day__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--color-bg);
  border-radius: var(--radius-input);
}

.hours-day__name {
  font-weight: 600;
  font-size: 14px;
}

.hours-closed-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.hours-periods {
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible; /* permite que o dropdown de horário "escape" da caixa quando expandido */
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}

.hours-periods.is-collapsed {
  overflow: hidden; /* só corta durante o recolhimento, para a sanfona funcionar */
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  gap: 0;
}

.hours-period-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.time-separator {
  padding-bottom: 10px;
  color: var(--color-text-muted);
  font-size: 14px;
  align-self: flex-end;
}

.time-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-field-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.time-autocomplete {
  position: relative;
}

.time-autocomplete .autocomplete__list {
  min-width: 80px;
  width: 80px;
}

.btn-period-add {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  width: 30px;
  height: 30px;
  font-size: 16px;
  cursor: pointer;
  color: var(--color-blue-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.btn-period-add:hover {
  border-color: var(--color-blue-mid);
  background: rgba(0,175,250,.06);
}

.btn-period-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-muted);
  padding: 4px 6px;
  margin-bottom: 2px;
  border-radius: 6px;
}

.btn-period-remove:hover {
  color: var(--color-error);
  background: rgba(239,68,68,.08);
}

@media (max-width: 640px) {
  .hours-period-row { flex-wrap: wrap; gap: 6px; }
  .time-autocomplete .input { width: 70px; }
}

/* ─── Correções gerais de dropdown e horários ──────────────── */

/* Remove bullets e padding padrão de todas as listas de autocomplete */
.autocomplete__list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  max-height: 200px;
  overflow-y: auto;
}

/* Time list específico — mais compacto */
.time-autocomplete .autocomplete__list {
  max-height: 180px;
  min-width: 80px;
  width: 80px;
}

/* Reduz padding das opções */
.autocomplete__option {
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
}

/* Garantir que hours-day não crie scroll horizontal */
.hours-day {
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}

.hours-period-row {
  flex-wrap: nowrap;
  overflow: visible;
}

@media (max-width: 480px) {
  .hours-period-row { flex-wrap: wrap; }
  .time-autocomplete .input { width: 70px; }
}

/* ─── Tooltip "?" ──────────────────────────────────────────── */

.field-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-text-muted);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 6px;
  flex-shrink: 0;
  line-height: 1;
}

.field-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
  width: 230px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(16,16,16,.2);
}

.field-tooltip:hover::after,
.field-tooltip:focus::after {
  opacity: 1;
}

/* ─── Botão "Enviar formulário" travado até confirmar revisão ─ */

.btn--locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ─── Toast com ações (pergunta de aplicar horário) ───────────── */

.toast-actions {
  display: flex;
  gap: 8px;
}

.toast-actions__btn {
  flex: 1;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-button);
  cursor: pointer;
  outline: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.toast-actions__btn--primary {
  background: var(--color-blue-strong);
  border-color: var(--color-blue-strong);
  color: #fff;
}

.toast-actions__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 16, 16, 0.12);
}

.toast-actions__btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Toast mais largo para o aviso de mídia não salva no rascunho */
.toast--media-warning {
  max-width: 370px;
}