/* =========================================================
   ALDEMAR STUDIOS — MODO APLICATIVO
   Vale só quando o site está aberto como app instalado
   (o js/app-modo.js coloca a classe "como-app" no <html>).
   No navegador nada daqui se aplica.
========================================================= */

/* ---------- sensação de app: toque, rolagem e textos ---------- */
html.como-app {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
  scroll-padding-top: 72px;
}

html.como-app body {
  overscroll-behavior-y: none;
  min-height: 100dvh;
  animation: app-entrar .22s ease-out both;
}

@keyframes app-entrar {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* sem lupa nem zoom ao tocar em campos (iPhone aumenta tudo abaixo de 16px) */
html.como-app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.como-app select,
html.como-app textarea {
  font-size: max(16px, 1em);
}

/* botões e menus não selecionam texto e respondem ao toque */
html.como-app button,
html.como-app [role="button"],
html.como-app .tab,
html.como-app .app-aba,
html.como-app nav a,
html.como-app .menu-item,
html.como-app .atalho {
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

html.como-app button:active,
html.como-app a[class*="botao"]:active,
html.como-app a[class*="btn"]:active,
html.como-app .atalho:active,
html.como-app .menu-item:active {
  transform: scale(.97);
  transition: transform .08s;
}

html.como-app img {
  -webkit-user-drag: none;
}

/* ---------- topo: respeita o notch e a barra de status ---------- */
html.como-app body {
  padding-top: env(safe-area-inset-top);
}

/* nas telas de atividade a marca no topo leva de volta: mostra a seta */
html.como-app:not(.app-com-abas) .area-topo .marca::before {
  content: "";
  width: 10px;
  height: 10px;
  margin: 0 2px 0 4px;
  border-left: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg);
  flex: 0 0 auto;
  opacity: .85;
}

/* rodapés de site não fazem sentido dentro do app */
html.como-app .area-rodape {
  display: none;
}

/* "Voltar ao painel": o Início já está na barra de abas */
html.como-app .app-redundante {
  display: none !important;
}

/* ---------- barra de abas do app ---------- */
.app-abas {
  display: none;
}

html.como-app .app-abas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 960;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(6, 11, 26, .94);
  border-top: 1px solid rgba(120, 160, 255, .16);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  font-family: "Lexend", "Inter", system-ui, sans-serif;
}

html.como-app .app-aba {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 7px 2px 5px;
  border-radius: 14px;
  color: #8FA3CC;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  transition: color .15s, background .15s;
}

html.como-app .app-aba svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html.como-app .app-aba.ativa {
  color: #fff;
  background: rgba(47, 107, 255, .22);
}

html.como-app .app-aba.ativa svg {
  stroke: #3DD6FF;
}

/* espaço para o conteúdo não ficar por baixo da barra */
html.como-app.app-com-abas body,
html.como-app.app-painel-prof body {
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

/* no painel do professor/admin a barra do app substitui a do painel */
html.como-app.app-painel-prof .tabbar {
  display: none !important;
}

/* a barra do painel (aluno) também respeita a barra do iPhone */
html.como-app .tabbar {
  padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important;
}

html.como-app .tabbar .tab {
  min-height: 52px;
}

/* ---------- botões flutuantes: menores e acima das abas ---------- */
html.como-app .a11y-botao,
html.como-app #a11yBotao {
  width: 46px !important;
  height: 46px !important;
  right: 12px !important;
  bottom: calc(14px + env(safe-area-inset-bottom)) !important;
  font-size: 22px !important;
  border-width: 2px !important;
}

html.como-app.app-com-abas .a11y-botao,
html.como-app.app-com-abas #a11yBotao,
html.como-app.app-painel .a11y-botao,
html.como-app.app-painel #a11yBotao {
  bottom: calc(84px + env(safe-area-inset-bottom)) !important;
}

html.como-app .a11y-painel {
  bottom: calc(140px + env(safe-area-inset-bottom)) !important;
  max-height: calc(100dvh - 170px - env(safe-area-inset-bottom)) !important;
}

/* Lexus: só a esfera, sem o rótulo, para não cobrir o conteúdo */
html.como-app .lexus:not(.aberto) {
  right: 12px;
  bottom: calc(138px + env(safe-area-inset-bottom));
}

html.como-app .lexus:not(.aberto) .lexus-lancador {
  padding: 4px;
  gap: 0;
}

html.como-app .lexus:not(.aberto) .lexus-lancador-texto {
  display: none;
}

html.como-app .lexus.aberto {
  bottom: calc(84px + env(safe-area-inset-bottom));
}

html.como-app .app-convite {
  display: none !important;
}

/* ---------- carregando entre páginas ---------- */
.app-carregando {
  display: none;
}

html.como-app .app-carregando {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  z-index: 100001;
  display: block;
  width: 0;
  height: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #2F6BFF, #3DD6FF);
  box-shadow: 0 0 10px rgba(61, 214, 255, .7);
  opacity: 0;
  pointer-events: none;
}

html.como-app .app-carregando.ativo {
  opacity: 1;
  animation: app-carregar 2.4s cubic-bezier(.1, .7, .3, 1) forwards;
}

@keyframes app-carregar {
  0% { width: 0; }
  40% { width: 55%; }
  100% { width: 88%; }
}

/* ---------- puxar para atualizar ---------- */
.app-puxar {
  display: none;
}

html.como-app .app-puxar {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  z-index: 100000;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0E1833;
  border: 1px solid rgba(61, 214, 255, .5);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translate(-50%, -50px);
  pointer-events: none;
}

html.como-app .app-puxar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #8FA3CC;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html.como-app .app-puxar.pronto svg {
  stroke: #3DD6FF;
}

html.como-app .app-puxar.girando {
  opacity: 1 !important;
  transition: transform .2s;
}

html.como-app .app-puxar.girando svg {
  stroke: #3DD6FF;
  animation: app-girar .7s linear infinite;
}

@keyframes app-girar {
  to { transform: rotate(360deg); }
}

/* ---------- sem internet ---------- */
html.como-app .app-offline {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(10px + env(safe-area-inset-top));
  z-index: 100002;
  padding: 10px 14px;
  border-radius: 12px;
  background: #3A1420;
  border: 1px solid #FF6B81;
  color: #FFE3E8;
  font: 600 14px/1.35 "Lexend", system-ui, sans-serif;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

html.como-app .app-offline[hidden] {
  display: none;
}

/* ---------- entrada (login): direto ao formulário ---------- */
html.como-app .recepcao,
html.como-app .entrada-balao {
  display: none !important;
}

html.como-app .entrada-marca {
  padding-bottom: 8px !important;
}

/* ---------- conteúdo mais compacto no celular ---------- */
@media (max-width: 700px) {
  html.como-app h1 {
    overflow-wrap: anywhere;
  }

  /* telas de abertura enormes: no app basta um cabeçalho */
  html.como-app .hero-arte,
  html.como-app .sp-hero-arte,
  html.como-app .sim-hero-arte {
    max-height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.como-app body,
  html.como-app .app-carregando.ativo {
    animation: none;
  }
}
