/* ============================================================
   EuroMóveis — Wizard Multi-Passo para Configuradores
   Progresso, transições, navegação, review, modo duplo,
   sidebar hiding, mobile sticky nav
   BEM-light: em-wizard__*
   Bootstrap 3 compatível
   ============================================================ */

/* ── Variáveis CSS ── */
:root {
  --em-wizard-progress-bg: #e8ebf0;
  --em-wizard-progress-active: #4A5568;
  --em-wizard-progress-done: #27ae60;
  --em-wizard-progress-pending: #ccc;
  --em-wizard-transition: 300ms ease;
  --em-wizard-nav-height: 64px;
  --em-wizard-card-shadow: 0 2px 8px rgba(0,0,0,0.06);
  --em-wizard-card-radius: 8px;
  --em-wizard-card-padding: 24px;
}

/* ============================================================
   SIDEBAR HIDING — apenas nas 4 páginas de configurador
   ============================================================ */
#information-mesas-medida #column-right,
#information-mesas-medida #column-left,
#information-roupeiros-medida #column-right,
#information-roupeiros-medida #column-left,
#information-sofas-medida #column-right,
#information-sofas-medida #column-left,
#information-cozinhas-medida #column-right,
#information-cozinhas-medida #column-left {
  display: none;
}
#information-mesas-medida #content,
#information-roupeiros-medida #content,
#information-sofas-medida #content,
#information-cozinhas-medida #content {
  width: 100%;
  float: none;
}
/* Forçar col-sm-12 quando Journal aplica col-sm-9 */
#information-roupeiros-medida #content.col-sm-9,
#information-sofas-medida #content.col-sm-9,
#information-cozinhas-medida #content.col-sm-9 {
  width: 100%;
}

/* ============================================================
   TOGGLE MODO (Guiado / Avançado)
   ============================================================ */
.em-wizard__mode-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 16px;
}
.em-wizard__mode-btn {
  padding: 8px 20px;
  border: 1px solid var(--em-wizard-progress-active);
  border-radius: 20px;
  background: transparent;
  color: var(--em-wizard-progress-active);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}
.em-wizard__mode-btn:hover {
  background: var(--em-wizard-progress-bg);
}
.em-wizard__mode-btn--active {
  background: var(--em-wizard-progress-active);
  color: #fff;
}

/* ============================================================
   BARRA DE PROGRESSO
   ============================================================ */
.em-wizard__progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 0 16px;
}
.em-wizard__progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  position: relative;
  z-index: 1;
  min-width: 60px;
}
.em-wizard__progress-step--completed {
  cursor: pointer;
}
.em-wizard__progress-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid var(--em-wizard-progress-pending);
  background: #fff;
  color: var(--em-wizard-progress-pending);
  transition: all var(--em-wizard-transition);
}
.em-wizard__progress-step--active .em-wizard__progress-circle {
  border-color: var(--em-wizard-progress-active);
  background: var(--em-wizard-progress-active);
  color: #fff;
  box-shadow: 0 2px 8px rgba(74,85,104,0.3);
}
.em-wizard__progress-step--completed .em-wizard__progress-circle {
  border-color: var(--em-wizard-progress-done);
  background: var(--em-wizard-progress-done);
  color: #fff;
}
.em-wizard__progress-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-align: center;
  max-width: 100px;
  line-height: 1.3;
  transition: color var(--em-wizard-transition);
}
.em-wizard__progress-step--active .em-wizard__progress-label {
  color: var(--em-wizard-progress-active);
}
.em-wizard__progress-step--completed .em-wizard__progress-label {
  color: var(--em-wizard-progress-done);
}
.em-wizard__progress-line {
  flex: 1;
  height: 2px;
  background: var(--em-wizard-progress-pending);
  min-width: 20px;
  margin: 0 -4px;
  margin-top: -20px;
  transition: background var(--em-wizard-transition);
}
.em-wizard__progress-line--completed {
  background: var(--em-wizard-progress-done);
}

/* Texto de progresso: "Passo 2 de 5 — 40% concluído" */
.em-wizard__progress-text {
  text-align: center;
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
  font-weight: 500;
}

/* ============================================================
   PASSOS (STEPS)
   ============================================================ */
.em-wizard__step {
  display: none;
}
.em-wizard__step--active {
  display: block;
  animation: em-wizardFadeIn var(--em-wizard-transition);
}
@keyframes em-wizardFadeIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes em-wizardFadeInReverse {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.em-wizard__step--entering-backward {
  animation-name: em-wizardFadeInReverse;
}

/* Respeitar prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .em-wizard__step--active,
  .em-wizard__step--entering-backward {
    animation: none;
  }
  .em-wizard__progress-circle,
  .em-wizard__progress-line,
  .em-wizard__progress-label {
    transition: none;
  }
}

/* ============================================================
   NAVEGAÇÃO (Anterior / Seguinte)
   ============================================================ */
.em-wizard__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 10px;
  gap: 12px;
}
.em-wizard__nav-btn {
  padding: 10px 28px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: none;
}
.em-wizard__nav-btn--prev {
  background: transparent;
  border: 1px solid #ccc;
  color: #666;
}
.em-wizard__nav-btn--prev:hover {
  border-color: var(--em-wizard-progress-active);
  color: var(--em-wizard-progress-active);
}
.em-wizard__nav-btn--next {
  background: var(--em-wizard-progress-active);
  color: #fff;
  min-width: 160px;
  justify-content: center;
}
.em-wizard__nav-btn--next:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.em-wizard__nav-btn:disabled,
.em-wizard__nav-btn--inactive {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
/* Próximo desactivado → cinzento sólido e legível (não dark-translúcido) */
.em-wizard__nav-btn--next:disabled,
.em-wizard__nav-btn--next.em-wizard__nav-btn--inactive {
  background: #cfcfcf;
  color: #888;
  opacity: 1;
}
.em-wizard__nav-btn--next.em-wizard__nav-btn--inactive:hover {
  opacity: 1;
  transform: none;
  box-shadow: none;
}

/* ── Erro inline junto ao label ── */
.em-wizard__inline-error {
  color: #e74c3c;
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
  margin-left: 4px;
  animation: em-wizardFadeError 0.3s ease;
}
@keyframes em-wizardFadeError {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .em-wizard__inline-error { animation: none; }
}

/* ── Highlight de campos obrigatórios em falta ── */
.em-wizard__field--missing {
  outline: 2px solid #e74c3c;
  outline-offset: 2px;
  border-radius: 8px;
  animation: em-wizardPulse 0.6s ease;
}
@keyframes em-wizardPulse {
  0%   { outline-color: transparent; }
  30%  { outline-color: #e74c3c; }
  60%  { outline-color: transparent; }
  100% { outline-color: #e74c3c; }
}
@media (prefers-reduced-motion: reduce) {
  .em-wizard__field--missing {
    animation: none;
  }
}
.em-wizard__nav-spacer {
  flex: 1;
}
/* Botão "Recomeçar" discreto */
.em-wizard__restart-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
}
.em-wizard__restart-btn:hover {
  color: #666;
}

/* ============================================================
   PASSO DE REVISÃO (Review)
   ============================================================ */
.em-wizard__review {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.em-wizard__review-summary {
  flex: 1;
  min-width: 0;
}
.em-wizard__review-contact {
  flex: 1;
  min-width: 0;
}
.em-wizard__review-section {
  background: #fff;
  border: 1px solid var(--em-card-border, #e8ebf0);
  border-radius: var(--em-wizard-card-radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--em-wizard-card-shadow);
}
.em-wizard__review-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}
.em-wizard__review-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin: 0;
}
.em-wizard__review-edit-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #888;
  font-size: 13px;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.em-wizard__review-edit-btn:hover {
  border-color: var(--em-wizard-progress-active);
  color: var(--em-wizard-progress-active);
}
.em-wizard__review-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 14px;
  border-bottom: 1px solid #f8f8f8;
}
.em-wizard__review-row:last-child {
  border-bottom: none;
}
.em-wizard__review-label {
  color: #888;
  font-weight: 500;
}
.em-wizard__review-value {
  color: #333;
  font-weight: 600;
  text-align: right;
  max-width: 60%;
}

/* Blockquote para "Outro" (especificação do cliente) */
.em-wizard__review-quote-label {
  font-size: 13px;
  font-weight: 600;
  color: #888;
  margin-top: 10px;
  margin-bottom: 4px;
}
.em-wizard__review-quote {
  margin: 8px 0 4px;
  padding: 10px 14px;
  border-left: 3px solid #d4a76a;
  background: #fdf8ef;
  border-radius: 0 6px 6px 0;
}
.em-wizard__review-quote-text {
  font-size: 14px;
  font-style: italic;
  color: #555;
  line-height: 1.5;
}
.em-wizard__review-quote-sub {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* Preview final no review */
.em-wizard__review-preview {
  background: #f8f9fb;
  border: 1px solid #e8ebf0;
  border-radius: var(--em-wizard-card-radius);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}
.em-wizard__review-preview svg {
  max-width: 100%;
  max-height: 300px;
}

/* ============================================================
   MODO AVANÇADO — todos os passos visíveis
   ============================================================ */
.em-configurator--advanced .em-wizard__step {
  display: block;
  animation: none;
}
.em-configurator--advanced .em-wizard__progress,
.em-configurator--advanced .em-wizard__progress-text,
.em-configurator--advanced .em-wizard__nav {
  display: none;
}
/* No modo avançado, review step fica escondido
   (o utilizador vê tudo e submete diretamente) */
.em-configurator--advanced .em-wizard__step[data-step-id="review"] {
  display: none;
}
/* Botão submit visível no modo avançado no último card visível */
.em-configurator--advanced .em-wizard__advanced-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.em-wizard__advanced-submit {
  display: none;
}

/* ============================================================
   RESPONSIVE — TABLET (768–1199px)
   ============================================================ */
@media (max-width: 1199px) {
  .em-wizard__progress-label {
    font-size: 12px;
    max-width: 70px;
  }
  .em-wizard__progress-step {
    min-width: 50px;
  }
  .em-wizard__progress-circle {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
  :root {
    --em-wizard-card-padding: 20px;
  }
}

/* ============================================================
   RESPONSIVE — TABLET (768–991px)
   ============================================================ */
@media (max-width: 991px) {
  .em-wizard__review {
    flex-direction: column;
  }
  .em-wizard__progress-label {
    display: none;
  }
  .em-wizard__progress-step {
    min-width: 36px;
  }
  .em-wizard__progress-circle {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (<768px)
   ============================================================ */
@media (max-width: 767px) {
  :root {
    --em-wizard-card-padding: 16px;
  }

  /* Barra de progresso simplificada */
  .em-wizard__progress {
    margin-bottom: 12px;
    padding: 0 4px;
  }
  .em-wizard__progress-step {
    min-width: 30px;
  }
  .em-wizard__progress-circle {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .em-wizard__progress-line {
    min-width: 8px;
  }
  /* Texto de progresso mais compacto */
  .em-wizard__progress-text {
    font-size: 13px;
    margin-bottom: 12px;
  }

  /* Nav sticky no fundo */
  .em-wizard__nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    padding: 10px 16px;
    z-index: 100;
    margin: 0;
  }
  /* Compensar espaço do nav fixo */
  .em-wizard__nav-spacer-bottom {
    height: var(--em-wizard-nav-height);
  }

  /* WhatsApp flutuante não pode tapar o botão Seguinte */
  body:has(.em-wizard__nav) .em-wa-float {
    bottom: calc(var(--em-wizard-nav-height) + 12px);
  }

  /* Preview colapsável */
  .em-wizard__preview-toggle {
    display: block;
    width: 100%;
    padding: 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    margin-bottom: 12px;
  }
  .em-configurator__preview--collapsed .em-configurator__preview-inner {
    display: none;
  }

  /* Toggle modo mais compacto */
  .em-wizard__mode-toggle {
    justify-content: center;
    margin-bottom: 12px;
  }
  .em-wizard__mode-btn {
    font-size: 13px;
    padding: 6px 14px;
    min-height: 44px;
  }

  /* Review: stack */
  .em-wizard__review-row {
    flex-direction: column;
    gap: 2px;
  }
  .em-wizard__review-value {
    text-align: left;
    max-width: 100%;
  }
  /* Em column, align-items:flex-start do pai impedia stretch horizontal.
     Força os filhos a ocuparem a largura toda. */
  .em-wizard__review-summary,
  .em-wizard__review-contact {
    align-self: stretch;
    width: 100%;
  }
}

/* ============================================================
   ECRÃS MUITO PEQUENOS (≤375px)
   ============================================================ */
@media (max-width: 375px) {
  .em-wizard__progress-circle {
    width: 28px;
    height: 28px;
    font-size: 12px;
    border-width: 1.5px;
  }
  .em-wizard__progress-line {
    min-width: 6px;
  }
  .em-wizard__progress-text {
    font-size: 12px;
  }
  .em-wizard__nav-btn {
    padding: 8px 16px;
    font-size: 14px;
  }
  .em-wizard__mode-toggle {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
}

/* ── Chips de contacto preferido (estilo toggle multi-select) ── */
.em-contact-chips {
  display: inline-flex;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
}
.em-contact-chips__chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid #ddd;
  min-height: 44px;
  margin: 0;
  user-select: none;
  text-align: center;
}
.em-contact-chips__chip:last-child {
  border-right: none;
}
.em-contact-chips__chip input[type="checkbox"] {
  display: none;
}
.em-contact-chips__chip:has(input:checked) {
  background: var(--em-wizard-progress-active, #4A5568);
  color: #fff;
  font-weight: 600;
}
.em-contact-chips__chip:has(input:checked) i {
  color: #fff;
}
.em-contact-chips__chip:hover:not(:has(input:checked)) {
  background: #f5f0eb;
}
.em-contact-chips__chip i {
  font-size: 14px;
  color: var(--em-wizard-progress-active, #4A5568);
}

/* ── File upload preview items (compactos) ── */
.em-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin-top: 6px;
  background: #f9f9f9;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  overflow: hidden;
  max-width: 100%;
}
.em-file-item__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
  flex-shrink: 0;
}
.em-file-item__info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.em-file-item__name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}
.em-file-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.em-file-item__size {
  font-size: 12px;
  color: #999;
}
.em-file-item__remove {
  background: none;
  border: none;
  color: #c0392b;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.em-file-item__remove:hover {
  color: #e74c3c;
}

/* Esconder toggle de preview em desktop/tablet */
@media (min-width: 768px) {
  .em-wizard__preview-toggle {
    display: none;
  }
}
