/* ==========================================================================
   PROVADOR VIRTUAL - TOTEM KIOSK STYLESHEET (VERTICAL 9:16)
   Design System: Damyller Haute Couture & Interactive Retail Totem
   ========================================================================== */

:root {
  --store-color: #ff9200;
  --store-color-glow: rgba(255, 146, 0, 0.45);
  --store-color-subtle: rgba(255, 146, 0, 0.15);
  --bg-dark: #07080c;
  --bg-panel: rgba(13, 15, 22, 0.88);
  --bg-panel-border: rgba(255, 255, 255, 0.1);
  --text-main: #f9fafb;
  --text-secondary: #b5bac5;
  --text-muted: #a1a8b6;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: var(--font-main);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
}

.totem-body {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   CAMADA 1: VÍDEO DA WEBCAM EM TELA CHEIA PERMANENTE NO FUNDO
   ========================================================================== */
.fullscreen-camera-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  overflow: hidden;
  background: #000000;
}

#webcamVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 1;
}

#capturedCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  display: none;
}

.camera-ambient-gradient {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(7, 8, 12, 0.55) 0%,
    rgba(7, 8, 12, 0.10) 30%,
    rgba(7, 8, 12, 0.20) 55%,
    rgba(7, 8, 12, 0.20) 82%,
    rgba(7, 8, 12, 0.97) 100%
  );
}

.kiosk-flash {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
}

.kiosk-flash.active {
  opacity: 0.95;
  transition: none;
}

/* ==========================================================================
   CAMADA 2: HEADER DO TOTEM (LOGO NO TOPO À DIREITA)
   ========================================================================== */
.kiosk-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 24px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 50;
  pointer-events: auto;
}

/* Status no Canto Superior Esquerdo */
.top-left-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Botão Voltar minimalista */
.btn-back-minimal {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--text-main);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.btn-back-minimal:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.35);
}

.kiosk-face-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(18, 20, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  backdrop-filter: blur(12px);
}

.face-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #eab308;
  animation: pulsePill 1.8s infinite;
}

.kiosk-face-pill.detected .face-pulse {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.kiosk-face-pill.detected {
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

@keyframes pulsePill {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* LOGO OFICIAL NO TOPO À DIREITA */
.top-right-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  height: 52px;
  max-width: 170px;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.7));
  border-radius: 8px;
}

.btn-top-util {
  background: rgba(18, 20, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}

.btn-top-util:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--store-color);
  transform: scale(1.05);
}

/* ==========================================================================
   CAMADA 3: MOLDURA GUIA CENTRAL (ETAPA DE CAPTURA)
   ========================================================================= */
.center-capture-guide {
  position: fixed;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.center-capture-guide.hidden {
  opacity: 0;
  pointer-events: none;
}

.totem-face-reticle {
  height: 78vh;
  height: 78dvh;
  width: min(84vw, 43dvh);
  border-radius: 48px;
  border: 2px dashed rgba(255, 146, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 24px;
  box-shadow: 0 0 35px -10px var(--store-color-glow);
}

.totem-face-reticle .corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: var(--store-color);
  border-style: solid;
}

.corner.c-tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-top-left-radius: 46px; }
.corner.c-tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-top-right-radius: 46px; }
.corner.c-bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-bottom-left-radius: 46px; }
.corner.c-br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-bottom-right-radius: 46px; }

.scan-laser {
  position: absolute;
  top: 0;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--store-color), transparent);
  box-shadow: 0 0 12px var(--store-color);
  animation: scanLaserAnim 3.2s ease-in-out infinite;
}

@keyframes scanLaserAnim {
  0% { top: 5%; opacity: 0.2; }
  50% { top: 90%; opacity: 0.9; }
  100% { top: 5%; opacity: 0.2; }
}

.reticle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(12, 14, 20, 0.85);
  border: 1px solid var(--store-color);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: clamp(13px, 1.5vw, 20px);
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--store-color);
  backdrop-filter: blur(12px);
}

/* Contagem Regressiva */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.countdown-overlay.active {
  opacity: 1;
  transform: scale(1);
}

.countdown-overlay span {
  font-family: var(--font-display);
  font-size: 110px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 35px var(--store-color);
}

/* ==========================================================================
   CAMADA 4: DOCK INFERIOR POR PASSOS (INICIAR -> ESTILOS -> LOADING)
   ========================================================================== */
.totem-bottom-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 40;
  padding: 16px 32px 36px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(8, 9, 13, 0.88) 18%,
    rgba(8, 9, 13, 0.98) 100%
  );
  backdrop-filter: blur(25px);
  border-top: 1px solid var(--bg-panel-border);
}

.dock-step {
  display: none;
  flex-direction: column;
  gap: 18px;
  max-width: 900px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.dock-step.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.step-guide-message {
  text-align: center;
}

.step-guide-message h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.step-guide-message p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.step-guide-message.compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dock-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
}

/* Botões do Dock */
.btn-dock-primary {
  position: relative;
  background: var(--store-color);
  color: #111318;
  border: none;
  border-radius: 18px;
  padding: 18px 44px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 12px 32px -4px var(--store-color-glow);
  transition: all 0.25s ease;
  overflow: hidden;
  min-width: 280px;
}

/* Botão solo centralizado (sem irmãos na row) */
.btn-dock-primary.btn-solo {
  min-width: 0;
  width: min(100%, 460px);
  min-height: 64px;
  font-size: clamp(18px, 2.5vw, 26px);
  letter-spacing: 0;
  padding: 18px 28px;
}

.btn-dock-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -2px var(--store-color-glow);
}

.btn-dock-primary:active {
  transform: translateY(1px);
}

.btn-glow-ring {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, var(--store-color), #ffd000, var(--store-color));
  animation: rotateConic 3s linear infinite;
  opacity: 0;
  z-index: 0;
  transition: opacity 0.3s;
}

.btn-dock-primary:hover .btn-glow-ring {
  opacity: 0.5;
}

@keyframes rotateConic {
  to { transform: rotate(360deg); }
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.btn-cam-icon {
  font-size: 22px;
}

/* Grade de Estilos no Dock (Passo 2) */
.styles-selection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.style-select-card {
  background: rgba(18, 20, 30, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.style-select-card:hover {
  background: rgba(26, 29, 44, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.style-select-card.selected {
  background: rgba(255, 146, 0, 0.12);
  border-color: var(--store-color);
  box-shadow: 0 0 20px -4px var(--store-color-glow);
}

.style-card-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.style-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.style-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

/* Passo 3: Loading */
.loading-dock-box {
  display: flex;
  align-items: center;
  gap: 24px;
  background: rgba(18, 20, 30, 0.9);
  border: 1px solid var(--store-color);
  padding: 24px 32px;
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px -5px var(--store-color-glow);
}

.loading-spinner-neon {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(255, 146, 0, 0.2);
  border-top-color: var(--store-color);
  border-radius: 50%;
  animation: spinNeon 0.8s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@keyframes spinNeon {
  to { transform: rotate(360deg); }
}

.spinner-core {
  width: 14px;
  height: 14px;
  background: var(--store-color);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--store-color);
}

.loading-dock-info {
  flex: 1;
}

.loading-dock-info h3 {
  font-family: var(--font-display);
  font-size: 18px;
  color: #ffffff;
}

.loading-dock-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dock-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  margin-top: 10px;
  overflow: hidden;
}

.dock-progress-fill {
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, var(--store-color), #ffd000);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ==========================================================================
   CAMADA 5: TELA DE RESULTADOS — LOOK PRINCIPAL + PREVIEWS VERTICAIS
   ========================================================================== */
.totem-results-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 7, 10, 0.97);
  backdrop-filter: blur(28px);
  display: none;
  flex-direction: column;
}

.totem-results-overlay.active {
  display: flex;
}

/* O QR ocupa sua própria faixa: nunca cobre o corpo do look. */
.results-fullscreen-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(100px, 23vw, 260px);
  flex: 1;
  min-height: 0;
  gap: clamp(10px, 2vw, 24px);
  padding: clamp(10px, 2vw, 28px);
  padding-bottom: 0;
}
.result-look-col {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}
.result-main-image-col {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #101217;
  border: 1px solid var(--bg-panel-border);
  border-radius: 24px;
}
.result-main-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.result-main-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(10, 12, 18, 0.88);
  border: 1px solid var(--bg-panel-border);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: clamp(14px, 1.8vw, 22px);
  font-weight: 600;
}
.result-sidebar-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.result-sidebar-logo { width: 100%; text-align: center; padding: 12px 0; }
.sidebar-logo-img { width: 85%; max-width: 180px; height: 42px; object-fit: contain; }
.results-selector-label { font-size: clamp(14px, 1.8vw, 22px); font-weight: 500; }
.result-previews {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
}
.result-preview-card {
  width: 100%;
  flex: 0 0 auto;
  aspect-ratio: 3 / 4;
  max-height: 23dvh;
  min-height: 64px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #16191f;
  border: 2px solid rgba(255,255,255,0.15);
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}
.result-preview-card:hover, .result-preview-card.active { border-color: var(--store-color); }
.result-preview-card.active { background: #28231c; }
.preview-thumb { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #111318;
  color: #fff;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.result-preview-card.active .preview-badge { background: var(--store-color); color: #111318; }
.result-qrcode-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: clamp(12px, 2vw, 24px);
  background: #15181e;
  border: 1px solid var(--bg-panel-border);
  border-radius: 20px;
}
.result-qr-copy { min-width: 0; }
.result-eyebrow { color: var(--store-color); font-size: clamp(12px, 1.4vw, 18px); }
.result-qr-copy h2 { font-size: clamp(18px, 2.6vw, 32px); font-weight: 600; margin: 6px 0; line-height: 1.15; }
.result-qr-hint { color: var(--text-secondary); font-size: clamp(13px, 1.6vw, 20px); line-height: 1.5; }
.result-qr-frame {
  width: clamp(104px, 17vw, 196px);
  aspect-ratio: 1;
  flex-shrink: 0;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
}
.result-qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.btn-restart-session {
  width: 100%;
  min-height: 52px;
  background: #20242c;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-main);
  padding: 14px 8px;
  border-radius: 14px;
  font-size: clamp(13px, 1.6vw, 20px);
  font-weight: 500;
  cursor: pointer;
}
.btn-restart-session:hover { background: #343a46; }
.kiosk-idle-bar { text-align: center; font-size: 12px; color: var(--text-muted); padding: 10px; flex-shrink: 0; }
.kiosk-idle-bar strong { color: var(--text-main); }

/* ==========================================================================
   MODAL DE CONFIGURAÇÕES (ENGRENAGEM)
   ========================================================================== */
.settings-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.settings-modal-overlay.active {
  display: flex;
}

.settings-dialog {
  background: #11131c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  padding: 28px;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.settings-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: #ffffff;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
}

.settings-field {
  margin-bottom: 16px;
}

.settings-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.settings-field input, .settings-field select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13px;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-control input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--store-color);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-main);
}

.settings-field small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.settings-footer {
  margin-top: 20px;
}

.btn-save-settings {
  width: 100%;
  background: var(--store-color);
  color: #000000;
  border: none;
  padding: 14px;
  border-radius: var(--radius-xl);
  font-weight: 800;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   RESPONSIVIDADE VERTICAL & COMPACTA
   ========================================================================== */
button, input, select { font-family: inherit; }
button:focus-visible { outline: 3px solid white; outline-offset: 3px; }
button:disabled { opacity: 0.6; cursor: wait; transform: none; }
.button-icon { width: 26px; height: 26px; flex-shrink: 0; }
.btn-back-minimal { min-height: 48px; font-size: 16px; }
.style-card-desc { font-size: 13px; line-height: 1.4; }
.style-card-name { font-size: 16px; }
.totem-body, .fullscreen-camera-layer { height: 100dvh; }
.totem-bottom-dock { padding: 12px 24px max(16px, env(safe-area-inset-bottom)); }
.totem-bottom-dock:has(#step1Capture.active) { background: none; backdrop-filter: none; border: 0; }
.reticle-label { text-align: center; margin: 0 12px; }
@media (max-width: 768px) {
  .styles-selection-grid { grid-template-columns: repeat(2, 1fr); }
  .kiosk-top-bar { padding: 16px 20px; }
  .brand-logo-img { height: 36px; max-width: 130px; }
}
@media (max-width: 480px) {
  .result-qrcode-block { flex-direction: column-reverse; gap: 10px; text-align: center; }
  .result-eyebrow { display: none; }
  .result-qr-copy h2 { font-size: 18px; }
  .result-qr-hint { font-size: 13px; }
  .result-sidebar-col { gap: 8px; }
  .sidebar-logo-img { height: 30px; }
  .result-main-badge { top: 8px; left: 8px; padding: 6px 10px; }
  .totem-bottom-dock { padding-inline: 16px; }
}
@media (max-height: 700px) {
  .totem-bottom-dock { max-height: 75dvh; overflow-y: auto; }
  .result-qr-frame { width: 104px; }
  .result-sidebar-logo { padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Fundo claro preserva a leitura da marca original, sem recolorir o logo. */
.brand-logo-img, .sidebar-logo-img { background: #fff; padding: 8px 12px; border-radius: 10px; }
.result-qr-frame[hidden] { display: none; }
