/* ==========================================================================
   ATELIÊ ÓTICO - PROVADOR VIRTUAL AR & ANÁLISE MORFOLÓGICA EM TEMPO REAL
   Estética de Alta Joalharia Ótica - 100% Português de Portugal
   ========================================================================== */

:root {
  --tryon-bg: #FAF7F2;
  --tryon-surface: #FFFFFF;
  --tryon-border: rgba(17, 17, 17, 0.08);
  --tryon-gold: #c5a880;
  --tryon-gold-dark: #9f835b;
  --tryon-text-primary: #111111;
  --tryon-text-muted: #666666;
  --tryon-radius: 16px;
  --tryon-shadow: 0 20px 50px -10px rgba(17, 17, 17, 0.12);
}

.tryon-page-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  color: var(--tryon-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Header Editorial */
.tryon-header {
  text-align: center;
  margin-bottom: 28px;
}
.tryon-tagline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tryon-gold-dark);
  margin-bottom: 8px;
}
.tryon-tagline::before,
.tryon-tagline::after {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--tryon-gold);
}
.tryon-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: #111;
}
.tryon-subtitle {
  font-size: 15px;
  color: var(--tryon-text-muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Layout Principal: Espelho + Diagnóstico */
.tryon-main-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 992px) {
  .tryon-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Secção do Espelho AR */
.tryon-mirror-section {
  position: relative;
  display: flex;
  flex-direction: column;
}

.tryon-mirror-card {
  position: relative;
  background: #111111;
  border-radius: var(--tryon-radius);
  overflow: hidden;
  box-shadow: var(--tryon-shadow);
  border: 1px solid var(--tryon-border);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Elementos de Vídeo e Canvas Sobrepostos */
.tryon-video-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Efeito de espelho natural */
}

.tryon-render-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  pointer-events: none;
  z-index: 2;
}

/* Guia de Alinhamento Ótico Oval */
.tryon-alignment-guide {
  position: absolute;
  inset: 12% 24%;
  border: 1px dashed rgba(197, 168, 128, 0.4);
  border-radius: 50% / 60%;
  pointer-events: none;
  z-index: 3;
  display: none;
}

/* Barra Superior no Espelho (HUD) */
.tryon-mirror-topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}
.tryon-mirror-topbar > * {
  pointer-events: auto;
}

.tryon-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(17, 17, 17, 0.75);
  backdrop-filter: blur(10px);
  padding: 6px 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.tryon-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: tryonPulse 2s infinite;
}
@keyframes tryonPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.tryon-actions-group {
  display: flex;
  gap: 8px;
}
.tryon-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tryon-icon-btn:hover {
  background: var(--tryon-gold-dark);
  border-color: var(--tryon-gold);
  transform: scale(1.05);
}

/* Overlay Inicial / Carregamento / Permissão */
.tryon-state-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  z-index: 20;
  color: #fff;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tryon-state-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tryon-spinner-ring {
  width: 44px;
  height: 44px;
  border: 2px solid rgba(197, 168, 128, 0.2);
  border-top-color: var(--tryon-gold);
  border-radius: 50%;
  animation: tryonSpin 0.9s linear infinite;
  margin-bottom: 18px;
}
@keyframes tryonSpin {
  to { transform: rotate(360deg); }
}
.tryon-state-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  margin: 0 0 8px;
  font-weight: 500;
}
.tryon-state-desc {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.7);
  max-width: 380px;
  margin: 0 0 24px;
  line-height: 1.5;
}
.tryon-btn-primary {
  background: var(--tryon-gold);
  color: #111;
  border: none;
  padding: 13px 28px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
}
.tryon-btn-primary:hover {
  background: #dfc299;
  transform: translateY(-1px);
}
.tryon-btn-secondary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tryon-btn-secondary:hover {
  border-color: #fff;
}

/* Painel de Diagnóstico Morfológico Facial */
.tryon-diagnostic-panel {
  background: var(--tryon-surface);
  border-radius: var(--tryon-radius);
  border: 1px solid var(--tryon-border);
  box-shadow: var(--tryon-shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tryon-diag-header {
  border-bottom: 1px solid var(--tryon-border);
  padding-bottom: 16px;
}
.tryon-diag-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--tryon-gold-dark);
  margin-bottom: 4px;
}
.tryon-diag-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  margin: 0;
  color: #111;
}

/* Cartão do Formato Detectado */
.tryon-faceshape-card {
  background: var(--tryon-bg);
  border-radius: 12px;
  border: 1px solid rgba(197, 168, 128, 0.3);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.tryon-faceshape-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--tryon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tryon-gold-dark);
  flex-shrink: 0;
}
.tryon-faceshape-meta {
  flex-grow: 1;
}
.tryon-faceshape-label {
  font-size: 11px;
  color: var(--tryon-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.tryon-faceshape-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #111;
  margin: 0 0 2px;
}
.tryon-faceshape-confidence {
  font-size: 12px;
  color: var(--tryon-gold-dark);
  font-weight: 500;
}

/* Parecer / Conselho de Visagismo */
.tryon-advice-box {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--tryon-border);
  padding: 16px 18px;
}
.tryon-advice-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tryon-advice-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: #444;
  margin: 0;
}

/* Ações do Diagnóstico */
.tryon-diag-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.tryon-btn-filter-recommended {
  width: 100%;
  padding: 13px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.tryon-btn-filter-recommended:hover {
  background: var(--tryon-gold-dark);
}

/* Notificação Toast de Captura */
.tryon-toast-alert {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #111;
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 100000;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tryon-toast-alert.is-shown {
  transform: translateX(-50%) translateY(0);
}

/* Modal Virtual Try-On nas Páginas de Produto */
.tryon-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.tryon-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   CARTÃO CENTRAL DE PERMISSÃO / PRIVACIDADE (CENTRAL PERMISSION MODAL)
   ========================================================================== */
.tryon-consent-card {
  background: #FAF7F2;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  padding: 36px 32px 30px;
  text-align: center;
  position: relative;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(197, 168, 128, 0.25);
  animation: tryonPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tryonPopIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tryon-consent-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #555;
}
.tryon-consent-close-btn:hover {
  background: #111;
  color: #fff;
}

.tryon-consent-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(197, 168, 128, 0.12);
  border: 1.5px solid rgba(197, 168, 128, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.tryon-consent-product-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid rgba(17, 17, 17, 0.08);
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  margin-bottom: 20px;
  max-width: 100%;
}
.tryon-consent-product-thumb {
  width: 44px;
  height: 26px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 6px;
  padding: 2px;
}
.tryon-consent-product-info {
  text-align: left;
  line-height: 1.2;
}
.tryon-consent-product-tag {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #c5a880;
}
.tryon-consent-product-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.tryon-consent-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  color: #111;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.tryon-consent-subtitle {
  font-size: 13.5px;
  line-height: 1.55;
  color: #666;
  margin: 0 0 24px;
}

.tryon-privacy-box {
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(17, 17, 17, 0.07);
  padding: 16px 18px;
  text-align: left;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tryon-privacy-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
}
.tryon-privacy-check {
  color: #2e7d32;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}
.tryon-privacy-item strong {
  display: block;
  font-size: 12.5px;
  color: #111;
  margin-bottom: 2px;
}
.tryon-privacy-item p {
  margin: 0;
  color: #666;
  line-height: 1.4;
  font-size: 11.5px;
}

.tryon-consent-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tryon-btn-accept {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.tryon-btn-accept:hover {
  background: #c5a880;
  border-color: #c5a880;
  color: #111;
  transform: translateY(-1px);
}
.tryon-btn-deny {
  background: transparent;
  border: none;
  color: #777;
  font-size: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.tryon-btn-deny:hover {
  color: #111;
  text-decoration: underline;
}

/* ==========================================================================
   ESPELHO AR CENTRADO EM TEMPO REAL
   ========================================================================== */
.tryon-ar-viewport {
  width: 100%;
  max-width: min(920px, calc(100vw - 40px));
  position: relative;
  animation: tryonPopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
}
.tryon-ar-close-btn {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tryon-ar-close-btn:hover {
  background: #fff;
  color: #111;
}
.tryon-modal-inner-app {
  background: #111;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(197, 168, 128, 0.3);
  width: 100%;
}
.tryon-modal-mirror-card {
  border-radius: 0;
  aspect-ratio: 16 / 10;
  max-height: 70vh;
  margin-bottom: 0;
  background: #111;
}
.tryon-product-model-name-pill {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 11.5px;
  color: #fff;
  font-weight: 500;
}
.tryon-floating-hud {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: auto;
  display: grid;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
  max-width: min(320px, calc(100% - 36px));
}
.tryon-hud-pill {
  background: rgba(250, 247, 242, 0.88);
  backdrop-filter: blur(14px);
  padding: 7px 12px;
  border-radius: 4px;
  border: 1px solid rgba(197, 168, 128, 0.35);
  font-size: 11.5px;
  color: #111;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tryon-hud-pill.tryon-hud-sub {
  font-size: 10.5px;
  color: #6f5b3f;
  background: rgba(250, 247, 242, 0.78);
  border-color: rgba(197, 168, 128, 0.25);
  padding: 4px 10px;
}

.tryon-bottom-product-bar {
  background: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(17, 17, 17, 0.08);
}
.tryon-bottom-info {
  display: flex;
  flex-direction: column;
}
.tryon-bottom-tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #c5a880;
  text-transform: uppercase;
}
.tryon-bottom-product-name {
  font-size: 15px;
  color: #111;
  font-weight: 600;
}
.tryon-bottom-product-price {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}
.tryon-bottom-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tryon-btn-add-cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 12px 22px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tryon-btn-add-cart:hover {
  background: #c5a880;
  color: #111;
}
.tryon-link-full-studio {
  font-size: 12px;
  color: #777;
  text-decoration: none;
  transition: color 0.2s;
}
.tryon-link-full-studio:hover {
  color: #111;
  text-decoration: underline;
}

/* ==========================================================================
   BOTÃO DE PROVADOR DEBAIXO DA GALERIA (PRODUCT GALLERY TRIGGER)
   ========================================================================== */
.product-gallery-tryon-container {
  margin-top: 16px;
  width: 100%;
}
.btn-product-gallery-tryon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 18px;
  background: #FAF7F2;
  border: 1.5px solid #c5a880;
  border-radius: 4px;
  color: #111;
  cursor: pointer;
  text-align: left;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: none;
  font-family: inherit;
}
.btn-product-gallery-tryon:hover {
  background: #fff;
  border-color: #111;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(17, 17, 17, 0.08);
}
.tryon-btn-icon-pulse {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(197, 168, 128, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c5a880;
  flex-shrink: 0;
}
.tryon-pulse-beacon {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid #c5a880;
  opacity: 0.8;
  animation: tryonBeaconPulse 2s infinite cubic-bezier(0.25, 1, 0.5, 1);
}
@keyframes tryonBeaconPulse {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}
.tryon-btn-labels {
  display: flex;
  flex-direction: column;
  margin-left: 14px;
  flex-grow: 1;
}
.tryon-btn-main {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: #111;
  text-transform: uppercase;
}
.tryon-btn-sub {
  font-size: 11.5px;
  color: #6b6257;
  margin-top: 2px;
}
.tryon-btn-live-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: #111;
  color: #FAF7F2;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  margin-left: 12px;
}

/* Botão Disparador na Barra Lateral de Compra */
.tryon-product-page-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  margin-bottom: 12px;
  background: #FAF7F2;
  border: 1.5px solid #c5a880;
  border-radius: 4px;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
}
.tryon-product-page-trigger:hover {
  background: #111;
  border-color: #111;
  color: #fff;
}
.tryon-btn-chip {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #c5a880;
  color: #111;
  padding: 2px 7px;
  border-radius: 999px;
}
.tryon-product-page-trigger:hover .tryon-btn-chip {
  background: #fff;
  color: #111;
}

@media (max-width: 768px) {
  .tryon-consent-card {
    padding: 24px 20px 20px;
  }
  .tryon-bottom-product-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 18px;
  }
  .tryon-bottom-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .tryon-btn-add-cart {
    justify-content: center;
  }
  .tryon-link-full-studio {
    text-align: center;
  }
  .btn-product-gallery-tryon {
    padding: 12px 14px;
  }
  .tryon-btn-main {
    font-size: 12.5px;
  }
  .tryon-btn-sub {
    font-size: 10.5px;
  }
}
