/* ===================================================================
   Demonstrações — camada SÓ PARA CELULAR.

   Este arquivo é carregado com media="(max-width: 720px), (max-height:
   500px) and (max-width: 960px)": em computador e tablet o navegador
   nem aplica estas regras. Nada aqui afeta o desktop.

   Ele reorganiza a tela cheia das demos no formato de aplicativo:
   topo enxuto, navegação embaixo (polegar) e detalhe em gaveta.
   Os elementos novos (.demo-mini, .demo-nav-ico, gaveta) são criados
   por js/demos-mobile.js, também só no celular.
   =================================================================== */

/* ---------- estrutura geral ---------- */
.demo-shell {
  height: 100vh;
  height: 100dvh; /* desconta a barra do navegador no celular */
}
.demo-root { -webkit-tap-highlight-color: transparent; }
.demo-shell button, .demo-shell a { touch-action: manipulation; }

/* ---------- topo: tudo em uma linha ---------- */
.demo-top {
  flex-wrap: nowrap;
  gap: 8px;
  padding: 8px 12px;
  min-height: 52px;
}
/* a marca nao encolhe (senao o texto vazava por baixo dos botoes) e o grupo
   da direita ocupa o resto, empurrado pra borda */
.demo-top-left { flex: 0 0 auto; gap: 8px; }
.demo-top-right { gap: 8px; margin-left: auto; min-width: 0; }
/* no celular a trilha e o selo grande saem: o aviso vira a faixa fina */
.demo-top .demo-path, .demo-top .demo-badge { display: none; }
.demo-brand { font-size: 15px; }

/* "Tour guiado" vira so "Tour": no celular nao cabe o texto inteiro */
.demo-top .demo-btn-ghost {
  padding: 11px 13px;
  font-size: 0;
  min-height: 40px;
}
.demo-top .demo-btn-ghost::before { content: "Tour"; font-size: 11.5px; }
/* texto curto: o longo quebrava em duas linhas e empurrava o topo */
.demo-top .demo-btn-gold { font-size: 0; padding: 10px 14px; gap: 0; }
.demo-top .demo-btn-gold::before {
  content: "Quero um assim";
  font-size: 11.5px;
  white-space: nowrap;
}
.demo-top .demo-btn-gold .arrow { font-size: 11.5px; margin-left: 6px; }
.demo-close { width: 40px; height: 40px; }

/* ---------- faixa fina (criada pelo JS) ---------- */
.demo-strip { display: none; }      /* a descrição longa sai */
.demo-mini {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-mini b { color: var(--gold-300); font-weight: 700; }

/* ---------- navegação embaixo ---------- */
.demo-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
.demo-menu {
  order: 2;                      /* desce pro fim sem duplicar HTML */
  flex-direction: row;
  gap: 2px;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  border-right: none;
  border-top: 1px solid var(--border);
  background: rgba(8,9,12,0.96);
  overflow: visible;
}
.demo-menu-label, .demo-menu-foot { display: none; }
.demo-menu-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 2px;
  border-radius: 10px;
  font-size: 9.5px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: none;
}
.demo-menu-item.is-on { background: none; color: var(--gold-300); }
.demo-menu-item.is-on::before { display: none; }
.demo-nav-ico {
  width: 20px; height: 20px;
  display: block;
  opacity: 0.75;
}
.demo-menu-item.is-on .demo-nav-ico { opacity: 1; }
.demo-nav-ico svg { width: 20px; height: 20px; }

.demo-stage { order: 1; padding: 16px 14px 28px; }
/* arrastar pro lado troca de tela: a nova entra do lado de onde o dedo veio */
.demo-stage.desliza-esq { animation: demo-entra-esq .26s var(--ease); }
.demo-stage.desliza-dir { animation: demo-entra-dir .26s var(--ease); }
@keyframes demo-entra-esq { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
@keyframes demo-entra-dir { from { opacity: 0; transform: translateX(-34px); } to { opacity: 1; transform: none; } }
.demo-foot { display: none; }    /* o aviso já está na faixa fina */

/* ---------- conteúdo: respiro menor, tipos menores ---------- */
.demo-crumb { margin-bottom: 8px; font-size: 9.5px; }
.demo-h3 { font-size: 19px; }
.demo-sub { font-size: 10.5px; margin-top: 4px; }
.demo-panel { margin-top: 12px; border-radius: 12px; }
.demo-panel-head { padding: 11px 13px; }
.demo-panel-head .demo-hint { display: none; }   /* dica longa quebrava linha */
.demo-title-row { gap: 12px; }
/* os filtros rolam sozinhos; sem o min-width:0 eles empurravam a linha inteira */
.demo-title-row > * { min-width: 0; max-width: 100%; }
.demo-split { gap: 12px; }
.demo-list { padding: 8px; gap: 6px; }
/* itens do checklist tambem precisam de area de toque de dedo */
.demo-check-line { padding: 13px 0; min-height: 44px; }
.demo-item { padding: 12px 13px; gap: 11px; min-height: 52px; }
.demo-item-main strong { font-size: 13.5px; }
.demo-item-main span { font-size: 11.5px; }

/* indicadores: 2 por linha em vez de empilhados */
.demo-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.demo-kpi { padding: 13px 14px; border-radius: 12px; }
.demo-kpi-value { font-size: 20px; margin: 6px 0 4px; }
.demo-label { font-size: 9px; letter-spacing: 0.14em; }
.demo-kpi-note { font-size: 10.5px; }
.demo-kpi-foot { gap: 6px; }
.demo-spark { display: none; }                 /* sem espaço útil no celular */
/* número ímpar de indicadores: o último ocupa a linha toda */
.demo-kpis > .demo-kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* filtros: uma linha, segmentos de largura igual */
.demo-filters { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
.demo-segmented { display: flex; width: 100%; }
.demo-seg { flex: 1 1 0; padding: 13px 6px; font-size: 11.5px; text-align: center; min-height: 44px; }
.demo-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.demo-chips::-webkit-scrollbar { display: none; }
.demo-chip { flex-shrink: 0; padding: 12px 15px; min-height: 44px; }

/* campo de busca: 16px evita o zoom automático do iPhone ao focar */
.demo-search { flex-direction: column; align-items: stretch; gap: 8px; }
.demo-input { max-width: none; width: 100%; font-size: 16px; padding: 12px 16px; }

/* funil: colunas deslizando pro lado, com encaixe */
.demo-funnel {
  grid-template-columns: none;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.demo-funnel::-webkit-scrollbar { display: none; }
.demo-funnel-col {
  flex: 0 0 78%;          /* a próxima coluna aparece pela borda */
  scroll-snap-align: start;
}
.demo-deal { min-height: 52px; }

/* tabelas que não cabem viram cartões (Histórico e Clientes do CRM) */
.demo-table-cards thead { display: none; }
.demo-table-cards, .demo-table-cards tbody, .demo-table-cards tr, .demo-table-cards td { display: block; width: auto; }
.demo-table-cards tr {
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
}
.demo-table-cards tr:last-child { border-bottom: none; }
.demo-table-cards td {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 3px 0;
  border: none;
  font-size: 12.5px;
  text-align: right;
}
.demo-table-cards td::before {
  content: attr(data-col);
  flex-shrink: 0;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
}
/* a primeira célula vira o título do cartão */
.demo-table-cards td:first-child {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 13.5px; font-weight: 700;
  text-align: left;
}
.demo-table-cards td:first-child::before { display: none; }

/* ranking continua tabela, só que enxuta */
.demo-table { font-size: 12.5px; }
.demo-table th, .demo-table td { padding: 10px 8px; }
.demo-table th { padding: 0; }
.demo-th { display: block; width: 100%; padding: 14px 8px; min-height: 44px; }

.demo-cards { gap: 10px; margin-top: 16px; }
.demo-card { padding: 16px 15px; }
.demo-chart { height: 150px; padding: 16px 10px 12px; gap: 6px; }
.demo-donut-wrap { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 14px; }
.demo-donut { width: 104px; height: 104px; align-self: center; }
.demo-notes p { padding: 14px 0; font-size: 13.5px; }
.demo-people { padding: 12px 13px; gap: 14px; }
.demo-btn { min-height: 46px; }
.demo-actions .demo-btn { flex: 1 1 auto; }

/* ---------- gaveta do detalhe (criada pelo JS) ---------- */
.demo-sheet-fundo {
  /* para acima da navegacao: a barra de baixo continua alcancavel com a
     gaveta aberta (--demo-nav-h vem do js/demos-mobile.js) */
  position: absolute; left: 0; right: 0; top: 0; bottom: var(--demo-nav-h, 60px); z-index: 5;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  /* fechado ele nao pode capturar toque, senao bloqueia a navegacao de baixo */
  pointer-events: none;
  visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s;
}
.demo-sheet-fundo.is-on { opacity: 1; pointer-events: auto; visibility: visible; }

.demo-sheet {
  position: absolute; left: 0; right: 0; bottom: var(--demo-nav-h, 60px); z-index: 6;
  max-height: 74%;
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border-gold);
  border-radius: 18px 18px 0 0;
  background: #0a0b0e;
  box-shadow: 0 -20px 60px -20px rgba(0,0,0,0.9);
  transform: translateY(120%);
  /* fora da tela tambem nao recebe toque nem foco de teclado */
  pointer-events: none;
  visibility: hidden;
  transition: transform .3s var(--ease), visibility .3s;
  overscroll-behavior: contain;
}
.demo-sheet.is-on { transform: translateY(0); pointer-events: auto; visibility: visible; }
/* a navegacao fica por cima do escurecido, pra continuar clicavel */
.demo-shell.tem-gaveta .demo-menu { position: relative; z-index: 7; }
.demo-sheet-topo {
  position: relative;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  touch-action: none;             /* o arrasto aqui é da gaveta */
}
.demo-sheet-alca {
  position: absolute; top: 6px; left: 50%;
  width: 38px; height: 4px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: var(--border);
}
.demo-sheet-titulo {
  font-family: var(--font-display);
  font-size: 13.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-sheet-fechar {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
}
.demo-sheet-fechar svg { width: 16px; height: 16px; }
.demo-sheet-corpo {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
/* dentro da gaveta o painel não repete borda nem título */
.demo-sheet-corpo .demo-panel { margin: 0; border: none; border-radius: 0; background: none; }
.demo-sheet-corpo .demo-panel-head { display: none; }
.demo-sheet-corpo .demo-pad { padding: 14px 16px 18px; }
.demo-sheet-corpo .demo-dl { padding: 0; }
.demo-sheet-corpo .demo-badge-sm { margin: 0 0 14px; }

/* a coluna lateral vira gaveta: fora dela, some */
.demo-stage .demo-side[data-sheet] { display: none; }

/* ---------- tour e aviso: acima da navegação ---------- */
.demo-tour {
  bottom: calc(60px + env(safe-area-inset-bottom) + 10px);
  width: calc(100% - 20px);
  padding: 14px 16px;
}
.demo-tour-text { font-size: 13.5px; margin: 10px 0 14px; }
.demo-toast { bottom: calc(60px + env(safe-area-inset-bottom) + 10px); font-size: 12px; }
.demo-shell.tem-gaveta .demo-tour { display: none; }

/* ---------- celular deitado: sobra pouca altura ---------- */
@media (max-height: 500px) {
  .demo-mini { display: none; }
  .demo-menu { padding: 3px 4px; }
  .demo-menu-item { flex-direction: row; gap: 6px; padding: 10px 4px; font-size: 10px; min-height: 40px; }
  .demo-nav-ico, .demo-nav-ico svg { width: 15px; height: 15px; }
  .demo-stage { padding: 12px 14px 20px; }
  .demo-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .demo-kpis > .demo-kpi:last-child:nth-child(odd) { grid-column: auto; }
  .demo-sheet { max-height: 88%; }
  .demo-funnel-col { flex-basis: 46%; }
  .demo-tour, .demo-toast { bottom: calc(40px + env(safe-area-inset-bottom) + 8px); }
}

@media (prefers-reduced-motion: reduce) {
  .demo-sheet, .demo-sheet-fundo { transition: none; }
  .demo-stage.desliza-esq, .demo-stage.desliza-dir { animation: none; }
}
