:root {
  /* Paleta da marca Locus360 (extraída de logo.jpg): teal + navy. */
  --color-bg: #0a1420;
  --color-surface: #101d2c;
  --color-surface-alt: #16283b;
  --color-primary: #18c0cc;
  --color-primary-dark: #129aa4;
  --color-navy: #003c6c;
  --color-text: #f2f6f8;
  --color-text-muted: #8ea2b3;
  --color-border: rgba(255, 255, 255, 0.08);

  --color-danger: #e0554a;
  --color-danger-pulse: rgba(224, 85, 74, 0.45);

  /* Cor por tipo de marcador */
  --color-marker-product: #18c0cc;
  --color-marker-product-pulse: rgba(24, 192, 204, 0.45);
  --color-marker-navigation: #2f7fd1;
  --color-marker-navigation-pulse: rgba(47, 127, 209, 0.45);
  --color-marker-info: #a78bfa;
  --color-marker-info-pulse: rgba(167, 139, 250, 0.45);
  --shadow-elevated: 0 16px 40px rgba(0, 0, 0, 0.45);
  --radius-md: 12px;
  --radius-lg: 20px;
  font-family: 'Stem', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
}

.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(11, 13, 18, 0.85), transparent);
  pointer-events: none;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Só quando é o link de verdade (tour público) — #editor-scene-name no
   admin reaproveita esta classe só pelo layout, não é um link. .topbar
   inteiro tem pointer-events:none (pra não atrapalhar o arraste do
   panorama por baixo), igual já é feito pro scene-switcher e o carrinho —
   sem isso o clique atravessa direto pro canvas do visualizador. */
a.topbar__brand {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.topbar__logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

/* Seletor de ambientes */
.scene-switcher {
  position: relative;
  pointer-events: auto;
}

.scenes-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(20, 23, 31, 0.85);
  color: var(--color-text);
  font-size: 0.95rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.scenes-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scenes-button__chevron {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.scenes-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 32px));
  max-height: 320px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
}

.scenes-list[hidden] {
  display: none;
}

/* Ancorada no botão, a lista vaza pra fora da tela em telas estreitas
   (o botão já pode estar deslocado à direita, e min-width:220px não cede).
   Abaixo de 480px vira um painel fixo, largura previsível, desacoplado da
   posição do botão. */
@media (max-width: 480px) {
  .scenes-list {
    position: fixed;
    top: 72px;
    left: 16px;
    right: 16px;
    min-width: 0;
    max-width: none;
  }
}

.scenes-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.scenes-list__item:hover {
  background: var(--color-surface-alt);
}

.scenes-list__item.is-active {
  color: var(--color-marker-navigation);
  font-weight: 600;
}

.scenes-list__badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.7rem;
}

.cart-button {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(20, 23, 31, 0.85);
  color: var(--color-text);
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-count[hidden] {
  display: none;
}

/* Marcador de produto (hotspot) */
.locus360-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-marker-product);
  color: #fff;
  box-shadow: 0 4px 14px var(--color-marker-product-pulse);
  cursor: pointer;
}

.locus360-marker--navigation {
  background: var(--color-marker-navigation);
  box-shadow: 0 4px 14px var(--color-marker-navigation-pulse);
}

.locus360-marker--info {
  background: var(--color-marker-info);
  box-shadow: 0 4px 14px var(--color-marker-info-pulse);
}

.locus360-marker__pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: var(--color-marker-product-pulse);
  animation: locus360-pulse 2s ease-out infinite;
}

.locus360-marker--navigation .locus360-marker__pulse {
  background: var(--color-marker-navigation-pulse);
}

.locus360-marker--info .locus360-marker__pulse {
  background: var(--color-marker-info-pulse);
}

@keyframes locus360-pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Modal de produto */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal.is-open {
  visibility: visible;
  opacity: 1;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 9, 0.7);
  backdrop-filter: blur(2px);
}

.modal__card {
  position: relative;
  width: min(420px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  transform: translateY(12px);
  transition: transform 0.2s ease;
}

.modal.is-open .modal__card {
  transform: translateY(0);
}

.modal__image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-surface-alt);
}

.modal__body {
  padding: 20px 24px 24px;
}

.modal__name {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.modal__price {
  margin: 0 0 12px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
}

.modal__description {
  margin: 0 0 16px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.modal__description[hidden],
.modal__image[hidden],
.modal__price[hidden] {
  display: none;
}

.modal__attributes {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0 0 20px;
  font-size: 0.85rem;
}

.modal__attributes[hidden] {
  display: none;
}

.modal__attributes dt {
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.modal__attributes dd {
  margin: 0;
  color: var(--color-text);
  text-align: right;
}

.modal__add-button {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.modal__add-button:hover {
  background: var(--color-primary-dark);
}

.icon-button {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

/* Painel do carrinho */
.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(340px, 88vw);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-elevated);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.cart-panel.is-open {
  transform: translateX(0);
}

.cart-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border);
}

.cart-panel__header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.cart-items {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  overflow-y: auto;
  flex: 1;
}

.cart-empty {
  padding: 24px 8px;
  color: var(--color-text-muted);
  text-align: center;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-md);
}

.cart-item:hover {
  background: var(--color-surface-alt);
}

.cart-item img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--color-surface-alt);
}

.cart-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
}

.cart-item__name {
  font-weight: 600;
}

.cart-item__meta {
  color: var(--color-text-muted);
}

.cart-item__remove {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.cart-panel__footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 1rem;
}

.cart-panel__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-total-note {
  margin: -4px 0 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.cart-total-note[hidden] {
  display: none;
}

/* Verde do WhatsApp de propósito — é um sinal visual reconhecido pra "isso
   abre o WhatsApp", mais claro do que reusar a cor da marca aqui. */
.whatsapp-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: #25d366;
  color: #06341f;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.whatsapp-button:hover {
  background: #1ebe5a;
}

.whatsapp-button[hidden] {
  display: none;
}

/* Toast de feedback */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 50;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.fatal-error {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.fatal-error[hidden] {
  display: none;
}

.fatal-error p {
  max-width: 360px;
  font-size: 1rem;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .modal__card {
    width: 92vw;
  }

  .cart-panel {
    width: 100vw;
  }
}

/* Telas bem estreitas (~320-380px, iPhone SE e afins): brand + seletor de
   ambientes + carrinho não cabem lado a lado nos tamanhos "normais" — o
   botão do carrinho chega a vazar pra fora da tela. Encolhe tudo. */
@media (max-width: 380px) {
  .topbar {
    padding: 12px 14px;
    gap: 8px;
  }

  .topbar__left {
    gap: 8px;
  }

  .scenes-button {
    max-width: 108px;
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .cart-button {
    padding: 8px 10px;
  }
}
