/*
 * =====================================================
 * INTERFACE PÚBLICA LUNNIA
 * =====================================================
 */

:root {
  --publico-cor-principal: #243b53;
  --publico-cor-principal-escura: #1d344a;

  --publico-cor-fundo: #f7f7fa;
  --publico-cor-superficie: #ffffff;

  --publico-cor-texto: #24242c;
  --publico-cor-texto-secundario: #777784;
  --publico-cor-borda: #e6e6ed;

  --publico-altura-topbar: 66px;

  --publico-sombra-topbar: 0 3px 12px rgba(15, 31, 46, 0.18);

  --publico-sombra-loading: 0 18px 50px rgba(20, 34, 48, 0.12);
}

/*
 * =====================================================
 * BASE
 * =====================================================
 */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;

  margin: 0;

  overflow: hidden;

  overscroll-behavior: none;
}

html {
  background: var(--publico-cor-fundo);

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: fixed;

  inset: 0;

  background: var(--publico-cor-fundo);

  color: var(--publico-cor-texto);

  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;

  -webkit-font-smoothing: antialiased;

  -moz-osx-font-smoothing: grayscale;
}

/*
 * =====================================================
 * APLICAÇÃO
 * =====================================================
 */

.publico-app {
  position: fixed;

  inset: 0;

  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100dvh;

  overflow: hidden;

  background: var(--publico-cor-fundo);
}

.publico-app[hidden] {
  display: none;
}

/*
 * =====================================================
 * CABEÇALHO
 * =====================================================
 */

.publico-topbar {
  position: relative;
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: space-between;

  flex: 0 0 calc(84px + env(safe-area-inset-top));

  width: 100%;
  min-height: calc(84px + env(safe-area-inset-top));

  padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0
    max(14px, env(safe-area-inset-left));

  overflow: hidden;

  background: linear-gradient(
    135deg,
    var(--publico-cor-principal) 0%,
    var(--publico-cor-principal-escura) 100%
  );

  box-shadow: var(--publico-sombra-topbar);

  touch-action: manipulation;
}

.publico-topbar__identidade {
  display: flex;
  align-items: center;

  min-width: 0;

  gap: 12px;
}

.publico-topbar__logo {
  display: block;

  flex: 0 0 46px;

  width: 46px;
  height: 46px;

  object-fit: contain;

  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.publico-topbar__textos {
  flex: 1 1 auto;

  display: flex;
  flex-direction: column;
  justify-content: center;

  min-width: 0;

  overflow: hidden;
}

.publico-topbar__representado {
  overflow: hidden;

  color: #ffffff;

  font-size: 18px;
  font-weight: 500;
  line-height: 1.18;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.publico-topbar__representado:empty::before {
  content: "\00a0";
}

.publico-topbar__assinatura {
  display: flex;
  align-items: center;

  min-width: 0;

  gap: 5px;

  margin-top: 6px;

  overflow: hidden;

  color: rgba(255, 255, 255, 0.76);

  font-size: 12px;
  line-height: 1;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.publico-topbar__marca-nome {
  flex: 0 0 auto;

  color: rgba(255, 255, 255, 0.88);

  font-weight: 500;
}

.publico-topbar__separador {
  color: rgba(255, 255, 255, 0.42);
}

.publico-topbar__status-ponto {
  flex: 0 0 6px;

  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: rgba(126, 231, 169, 0.95);

  box-shadow: 0 0 0 2px rgba(126, 231, 169, 0.1);
}

.publico-topbar__status-icone {
  font-size: 11px;
  color: #79e7a5;
}

.publico-topbar__reiniciar {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  flex: 0 0 42px;

  width: 42px;
  height: 42px;

  margin-left: 12px;
  padding: 0;

  border: 0;
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.09);

  color: #ffffff;

  font: inherit;
  font-size: 17px;

  cursor: pointer;

  transition:
    background-color 0.16s ease,
    opacity 0.16s ease,
    transform 0.12s ease;
}

.publico-topbar__reiniciar:hover {
  background: rgba(255, 255, 255, 0.16);
}

.publico-topbar__reiniciar:active {
  transform: scale(0.94);
}

.publico-topbar__reiniciar:disabled {
  opacity: 0.42;

  cursor: default;
}

/*
 * =====================================================
 * CONTEÚDO
 * =====================================================
 */

.publico-conteudo {
  position: relative;

  flex: 1 1 auto;

  width: 100%;
  min-width: 0;
  min-height: 0;

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;

  -webkit-overflow-scrolling: touch;

  background: var(--publico-cor-fundo);

  touch-action: pan-y;
}

/*
 * =====================================================
 * RODAPÉ DA LUNNIA
 * =====================================================
 */

.publico-rodape {
  position: relative;
  z-index: 90;

  display: flex;
  align-items: center;
  justify-content: space-between;

  flex: 0 0 40px;

  width: 100%;
  min-height: 40px;

  padding: 0 max(14px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
    max(14px, env(safe-area-inset-left));

  border-top: 1px solid #ececec;

  background: rgba(255, 255, 255, 0.98);

  color: var(--publico-cor-texto-secundario);

  font-size: 12px;
  line-height: 1;

  box-shadow: 0 -2px 8px rgba(20, 34, 48, 0.025);
}

.publico-rodape__assinatura {
  display: flex;
  align-items: center;

  min-width: 0;

  gap: 4px;

  overflow: hidden;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.publico-rodape__magia {
  flex: 0 0 auto;

  font-size: 11px;
}

.publico-rodape__logo {
  display: block;

  flex: 0 0 14px;

  width: 14px;
  height: 14px;

  object-fit: contain;
}

.publico-rodape__marca {
  color: var(--publico-cor-principal);

  font-weight: 600;
}

.publico-rodape__link {
  display: inline-flex;
  align-items: center;

  flex: 0 0 auto;

  gap: 5px;

  margin-left: 12px;

  color: var(--publico-cor-principal);

  font-size: 12px;
  font-weight: 600;

  text-decoration: none;

  cursor: pointer;

  transition:
    opacity 0.15s ease,
    transform 0.12s ease;
}

.publico-rodape__link i {
  font-size: 10px;

  transition: transform 0.15s ease;
}

.publico-rodape__link:hover {
  opacity: 0.78;
}

.publico-rodape__link:hover i {
  transform: translateX(2px);
}

.publico-rodape__link:active {
  transform: scale(0.97);
}

.publico-rodape__link:focus-visible {
  outline: 2px solid var(--publico-cor-principal);

  outline-offset: 3px;

  border-radius: 3px;
}

/*
 * =====================================================
 * CARREGAMENTO EM TELAS PEQUENAS
 * =====================================================
 */

@media (max-width: 480px) {
  .publico-rodape {
    flex-basis: calc(40px + env(safe-area-inset-bottom));

    min-height: calc(40px + env(safe-area-inset-bottom));

    padding: 0 max(12px, env(safe-area-inset-right)) env(safe-area-inset-bottom)
      max(12px, env(safe-area-inset-left));

    font-size: 12px;
  }

  .publico-rodape__assinatura {
    gap: 3px;
  }

  .publico-rodape__magia {
    font-size: 10px;
  }

  .publico-rodape__logo {
    flex-basis: 13px;

    width: 13px;
    height: 13px;
  }

  .publico-rodape__link {
    gap: 4px;

    margin-left: 8px;

    font-size: 12px;
  }
}

/*
 * =====================================================
 * MOBILE
 * =====================================================
 */

@media (max-width: 480px) {
  .publico-topbar {
    flex-shrink: 0;

    overflow: hidden;

    overscroll-behavior: none;

    touch-action: manipulation;
  }

  .publico-topbar__identidade {
    gap: 10px;
  }

  .publico-topbar__logo {
    flex-basis: 46px;

    width: 46px;
    height: 46px;
  }

  .publico-topbar__representado {
    font-size: 18px;
    font-weight: 500;
  }

  .publico-topbar__assinatura {
    gap: 4px;

    margin-top: 6px;

    font-size: 12px;

    color: rgba(255, 255, 255, 0.78);
  }

  .publico-topbar__status-ponto {
    flex: 0 0 6px;

    width: 6px;
    height: 6px;

    margin-left: 2px;
  }

  .publico-topbar__status-icone {
    font-size: 11px;
    color: #79e7a5;
  }

  .publico-topbar__reiniciar {
    flex-basis: 40px;

    width: 40px;
    height: 40px;

    margin-left: 8px;
  }
}

.publico-topbar__status-ponto {
  flex: 0 0 6px;

  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: #7fe3a8;

  box-shadow: 0 0 0 1px rgba(127, 227, 168, 0.18);
}

/*
 * =====================================================
 * ESTILO CRÍTICO DO APP LOADING
 * =====================================================
 *
 * Evita que o loading apareça sem formatação enquanto
 * o CSS específico do componente ainda está carregando.
 */

.publico-app-loading {
  position: fixed;

  inset: 0;

  z-index: 11000;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;

  overflow: hidden;

  background: #f7f7fa;
}

.publico-app-loading[hidden] {
  display: none;
}

.publico-app-loading__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: min(calc(100% - 28px), 292px);

  min-height: 245px;

  padding: 30px 24px;

  border-radius: 20px;

  background: #ffffff;

  text-align: center;
}

.publico-app-loading__logo {
  display: block;

  width: 70px;
  height: 70px;

  object-fit: contain;
}

.publico-app-loading__mensagem {
  margin-top: 18px;

  color: #243b53;

  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

.publico-app-loading__pontos {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 7px;

  min-height: 18px;

  margin-top: 16px;
}

.publico-app-loading__pontos span {
  display: block;

  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: #243b53;

  opacity: 0.28;
}
