/* WebAR - painel na parede | Focus Media
   Paleta herdada do protótipo original do time de design. */

:root {
  --accent: #36d1c4;
  --accent2: #5b7cff;
  --bg: #05070c;
  --texto: #f2f4f8;
  --texto-fraco: #8890a0;
  --borda: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
}

/* Qualquer regra de display propria (flex, block) sobrepoe o [hidden] da
   folha do navegador, e o elemento continua visivel depois de um
   el.hidden = true. Como varios elementos aqui sao ligados e desligados por
   JS, a regra vale de forma geral em vez de caso a caso. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

model-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  --poster-color: var(--bg);
  background: radial-gradient(circle at 50% 30%, #101a2e 0%, var(--bg) 75%);
}

/* --- barra do topo ------------------------------------------------------ */

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(180deg, rgba(5, 7, 12, 0.85), rgba(5, 7, 12, 0));
  pointer-events: none;
}

.dims-chip {
  pointer-events: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: rgba(54, 209, 196, 0.12);
  border: 1px solid rgba(54, 209, 196, 0.35);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--borda);
  color: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

/* --- avisos ------------------------------------------------------------- */

#notices {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(58px + env(safe-area-inset-top));
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notice {
  pointer-events: auto;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid;
  backdrop-filter: blur(6px);
}

.notice strong {
  display: block;
  margin-bottom: 2px;
}

.notice em {
  font-style: normal;
  color: #fff;
  white-space: nowrap;
}

.notice--warn {
  color: #ffe08a;
  background: rgba(255, 196, 0, 0.12);
  border-color: rgba(255, 196, 0, 0.4);
}

.notice--info {
  color: #bcd2ff;
  background: rgba(91, 124, 255, 0.12);
  border-color: rgba(91, 124, 255, 0.4);
}

.notice--error {
  color: #ffb4b4;
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.4);
}

/* --- botao de RA -------------------------------------------------------- */

#ar-cta {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 22;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #04101a;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(54, 209, 196, 0.35);
  white-space: nowrap;
  max-width: 92vw;
}

#ar-cta:active {
  transform: translateX(-50%) scale(0.97);
}

/* --- instrucao do rodape ----------------------------------------------- */

#hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(
    180deg,
    rgba(5, 7, 12, 0) 0%,
    rgba(5, 7, 12, 0.9) 45%,
    rgba(5, 7, 12, 0.97) 100%
  );
  pointer-events: none;
}

#hint p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--texto-fraco);
  text-align: center;
  text-wrap: pretty;
}

#hint strong {
  color: #c7ccd6;
}

/* --- carregamento ------------------------------------------------------ */

#loading {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  transition: opacity 0.35s ease;
}

#loading.is-fading {
  opacity: 0;
  pointer-events: none;
}

#loading p {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--texto-fraco);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: gira 0.9s linear infinite;
}

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

/* Respeita quem pediu menos animacao no sistema. */
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
  #loading {
    transition: none;
  }
  #ar-cta:active {
    transform: translateX(-50%);
  }
}

/* Em tela baixa (celular na horizontal) o rodape come a tela toda: encolhe. */
@media (max-height: 460px) {
  #hint p {
    font-size: 11px;
  }
  #ar-cta {
    bottom: calc(64px + env(safe-area-inset-bottom));
    padding: 11px 20px;
  }
}

/* --- overlay de cotas e referencia de tamanho -------------------------- */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#overlay.is-visivel {
  opacity: 1;
}

.ov-cota {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.ov-porta {
  fill: rgba(255, 255, 255, 0.035);
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1.5;
  stroke-dasharray: 7 5;
}

.ov-piso {
  fill: none;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
}

.ov-rotulo {
  fill: var(--accent);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: rgba(5, 7, 12, 0.85);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.ov-rotulo--fraco {
  fill: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  font-size: 11.5px;
}

/* --- botao secundario -------------------------------------------------- */

.pill-btn {
  pointer-events: auto;
  display: block;
  margin: 0 auto 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--borda);
  color: #dfe3ea;
  font-family: inherit;
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.pill-btn.is-ativo {
  background: rgba(54, 209, 196, 0.16);
  border-color: rgba(54, 209, 196, 0.45);
  color: var(--accent);
}

.icon-btn--quadrado {
  min-width: 30px;
  padding: 7px 8px;
  font-size: 13px;
  line-height: 1;
}

/* --- tutorial ---------------------------------------------------------- */

#tutorial {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 5, 9, 0.82);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

#tutorial.is-visivel {
  opacity: 1;
}

.tut-card {
  width: 100%;
  max-width: 360px;
  max-height: 100%;
  overflow-y: auto;
  background: #0c1220;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.tut-card h1 {
  margin: 0 0 16px;
  font-size: 19px;
  color: #fff;
}

.tut-passos {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tut-passos li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #c7ccd6;
}

.tut-passos strong {
  color: #fff;
}

.tut-icone {
  flex: 0 0 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 16px;
  border-radius: 9px;
  background: rgba(54, 209, 196, 0.14);
  border: 1px solid rgba(54, 209, 196, 0.32);
  color: var(--accent);
}

.tut-nota {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #ffe08a;
  background: rgba(255, 196, 0, 0.1);
  border: 1px solid rgba(255, 196, 0, 0.32);
  border-radius: 9px;
  padding: 9px 11px;
}

.tut-ok {
  width: 100%;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #04101a;
  font-family: inherit;
  font-weight: 700;
  font-size: 14.5px;
  padding: 13px;
  border: none;
  border-radius: 11px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  #overlay,
  #tutorial {
    transition: none;
  }
}
