/* style.css (compartilhado) já define :root, reset, .topbar, .icon-button,
   .locus360-marker* e .viewer. Este arquivo cobre só o que é específico do
   admin: telas de auth/dashboard, formulários e o painel do editor. */

html, body {
  height: auto;
  min-height: 100%;
}

body {
  font-family: 'Stem', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Controles de formulário genéricos ------------------------------------- */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Regra de autor (mesmo uma tag genérica como `label`) sempre vence o
   [hidden] nativo do navegador — são origens de cascata diferentes, a
   especificidade nem chega a ser comparada. Qualquer seletor que dá
   `display` a um elemento alternado por `hidden` precisa do próprio
   [hidden] explícito. */
#marker-field-price[hidden],
#marker-field-image[hidden],
#marker-field-target[hidden],
#marker-field-quote[hidden] {
  display: none;
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  width: auto;
  cursor: pointer;
}

input,
select,
textarea {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-marker-navigation);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

.slug-input {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
}

.slug-input input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
}

.slug-input input:focus {
  outline: none;
}

.form-error {
  margin: -6px 0 14px;
  color: var(--color-danger);
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* Botões ------------------------------------------------------------------ */

.primary-button,
.secondary-button,
.danger-button,
.link-button {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.primary-button {
  background: var(--color-primary);
  color: #fff;
}

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

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-button {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.secondary-button:hover {
  background: var(--color-surface-alt);
}

.danger-button {
  background: transparent;
  border-color: rgba(224, 85, 74, 0.4);
  color: var(--color-danger);
}

.danger-button:hover {
  background: rgba(224, 85, 74, 0.12);
}

.link-button {
  background: none;
  border: none;
  padding: 4px 0;
  color: var(--color-marker-navigation);
  font-weight: 500;
}

.topbar-action-button {
  flex-shrink: 0;
  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.9rem;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

/* Nome da cena no topbar do editor: trunca em vez de quebrar linha (o
   .topbar__brand compartilhado com o tour público não define isso porque
   lá o conteúdo é sempre "Locus360", nunca varia de tamanho). */
#editor-scene-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 380px) {
  .topbar-action-button {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
}

.topbar .icon-button,
.topbar-action-button {
  pointer-events: auto;
}

/* Tela de login/cadastro --------------------------------------------------- */

.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* .auth-view/.dashboard-view/.editor-view são alternadas via atributo
   `hidden` (não classe) — qualquer regra própria com `display` aqui
   precisa de um [hidden] explícito, senão [hidden] perde a especificidade
   pro seletor de classe e o elemento continua visível. */
.auth-view[hidden],
.dashboard-view[hidden],
.editor-view[hidden] {
  display: none;
}

.auth-card {
  width: min(380px, 100%);
  padding: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
}

.auth-card__logo {
  display: block;
  height: 44px;
  margin: 0 auto 6px;
}

.auth-card__subtitle {
  margin: 0 0 24px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.is-active {
  background: var(--color-primary);
  color: #fff;
}

/* Dashboard ----------------------------------------------------------------- */

.admin-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--color-border);
}

.admin-topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1.1rem;
  font-weight: 700;
}

.admin-topbar__logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
}

.admin-topbar__company {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 200px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.admin-topbar__actions {
  display: flex;
  gap: 10px;
}

.icon-only-button {
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 1rem;
  line-height: 1;
}

/* Abaixo de ~500px o brand e as ações não cabem lado a lado sem espremer
   texto (botão quebrando linha, nome cortado) — cada um vira sua própria
   linha. */
@media (max-width: 460px) {
  .admin-topbar {
    padding: 14px 20px;
  }

  .admin-topbar__brand,
  .admin-topbar__actions {
    flex: 1 1 100%;
  }

  .admin-topbar__actions {
    justify-content: flex-end;
  }
}

.dashboard-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px;
}

.dashboard-content__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.dashboard-content__header h1 {
  margin: 0;
  font-size: 1.3rem;
}

/* Configurações da empresa (WhatsApp + cores dos marcadores) ---------------- */

.settings-form label {
  max-width: 320px;
}

.marker-colors-field {
  margin-bottom: 14px;
}

.marker-colors-field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.marker-colors-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.marker-colors-row label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  max-width: none;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.marker-colors-row input[type='color'] {
  width: 40px;
  height: 32px;
  padding: 2px;
  cursor: pointer;
}

.settings-success {
  margin: -6px 0 14px;
  color: var(--color-primary);
  font-size: 0.85rem;
}

.scenes-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.scenes-grid__empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted);
}

.scene-card {
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.scene-card__thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--color-surface-alt);
}

.scene-card__body {
  padding: 14px 16px;
}

.scene-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}

.scene-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scene-card__actions .secondary-button,
.scene-card__actions .danger-button {
  padding: 6px 10px;
  font-size: 0.8rem;
}

/* Modal genérico (novo ambiente) --------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 9, 0.7);
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(360px, 90vw);
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
}

.modal-card h2 {
  margin: 0 0 18px;
  font-size: 1.1rem;
}

/* Editor visual --------------------------------------------------------------- */

.editor-view {
  position: relative;
}

.marker-form-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(340px, 90vw);
  overflow-y: auto;
  padding: 20px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-elevated);
}

.marker-form-panel[hidden] {
  display: none;
}

.marker-form__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.marker-form__header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.marker-form__attributes {
  margin-bottom: 14px;
  padding-top: 4px;
}

.marker-form__attributes[hidden] {
  display: none;
}

.marker-form__attributes-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.attribute-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.attribute-row input {
  flex: 1;
  min-width: 0;
}

.attribute-remove {
  flex-shrink: 0;
  width: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Pin de rascunho no editor (marcador ainda não salvo) */
.locus360-marker--draft {
  background: #ffffff;
  border: 2px dashed rgba(11, 13, 18, 0.55);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.5);
}

.locus360-marker--draft .locus360-marker__pulse {
  background: rgba(255, 255, 255, 0.5);
}

@media (max-width: 560px) {
  .marker-form-panel {
    width: 100vw;
  }

  .dashboard-content {
    padding: 20px;
  }
}
