/* =====================================================================
   Pascom Cam — estilos compartilhados (painel admin e página do celular).
   A página do OBS NÃO usa este arquivo de propósito (precisa ser ultra leve).

   Identidade: Festa de Nossa Senhora dos Humildes.
     - Azul de céu noturno (do cartaz) como base; vídeo sempre em destaque.
     - Ouro de talha como ÚNICA cor de destaque (botão principal, foco, medalhão).
     - Marfim (paredes caiadas da igreja) para texto.
   Fontes locais (sem CDN, funciona sem internet): Cinzel (marca/títulos),
   Pinyon Script (assinatura), Figtree (interface). Licenças em /shared/fonts/LICENSES.txt.
   ===================================================================== */

@font-face {
  font-family: 'Figtree';
  src: url('/shared/fonts/figtree-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cinzel';
  src: url('/shared/fonts/cinzel-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Pinyon Script';
  src: url('/shared/fonts/pinyon-script-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Azuis (do céu do cartaz, do mais escuro ao mais claro) */
  --noite: #06142b;
  --ceu-900: #0a2147;
  --ceu-800: #0f2d5e;
  --ceu-700: #17407f;
  --ceu-500: #3f7fd6;
  /* Ouro e marfim */
  --ouro: #dcab43;
  --ouro-claro: #f4d584;
  --ouro-escuro: #a97d22;
  --tinta-ouro: #0a1a33; /* texto sobre o ouro (contraste alto) */
  --marfim: #f6f0e0;

  /* Nomes usados pelas folhas de estilo das páginas */
  --bg: var(--noite);
  --surface: var(--ceu-900);
  --surface-2: var(--ceu-800);
  --border: rgba(143, 184, 255, 0.2);
  --border-strong: rgba(143, 184, 255, 0.38);
  --text: var(--marfim);
  --muted: #a9bddd;
  --accent: var(--ouro);
  --accent-hover: var(--ouro-claro);
  --ok: #46d39a;
  --warn: #ffab4a;
  --danger: #ff6b72;

  /* Raios por hierarquia (não um só para tudo) */
  --r-sm: 9px;
  --r-md: 14px;
  --r-lg: 22px;
  --radius: var(--r-md);

  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-script: 'Pinyon Script', 'Snell Roundhand', 'Brush Script MT', cursive;

  --ease: cubic-bezier(0.2, 0.75, 0.2, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Sem isso, "display:flex/grid" em classes sobrescreveria o atributo [hidden]. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
body {
  background:
    radial-gradient(1100px 560px at 50% -12%, rgba(63, 127, 214, 0.42), transparent 62%),
    linear-gradient(180deg, #0a2250 0%, var(--noite) 46%, #040d1f 100%) fixed;
  background-color: var(--noite);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(143, 184, 255, 0.12);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

.muted {
  color: var(--muted);
}

/* ---------- Marca ---------- */
.emblem {
  display: block;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--ceu-900);
  box-shadow:
    0 0 0 2px var(--ouro),
    0 0 0 6px rgba(220, 171, 67, 0.16),
    0 12px 28px -10px rgba(0, 0, 0, 0.75);
}
.emblem-sm {
  width: 42px;
  height: 42px;
  box-shadow: 0 0 0 1.5px var(--ouro), 0 6px 14px -6px rgba(0, 0, 0, 0.7);
}
.emblem-lg {
  width: 96px;
  height: 96px;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--marfim);
}
.brand-script {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--ouro-claro);
  letter-spacing: 0;
}

/* ---------- Botões ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(23, 64, 127, 0.42);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.55rem 0.95rem;
  min-height: 42px; /* alvo de toque confortável no celular */
  border-radius: var(--r-sm);
  cursor: pointer;
  transition:
    background 0.18s var(--ease),
    border-color 0.18s var(--ease),
    transform 0.12s var(--ease),
    box-shadow 0.18s var(--ease),
    opacity 0.18s;
}
.btn:hover:not(:disabled) {
  background: rgba(40, 92, 170, 0.55);
  border-color: var(--ouro-claro);
}
.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}
.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.btn:focus-visible,
.field:focus-visible,
.pick:focus-visible,
.seg button:focus-visible {
  outline: 2px solid var(--ouro-claro);
  outline-offset: 2px;
}
.btn-primary {
  background: linear-gradient(180deg, var(--ouro-claro) 0%, var(--ouro) 58%, #c8963a 100%);
  border-color: rgba(255, 230, 160, 0.65);
  color: var(--tinta-ouro);
  font-weight: 700;
  box-shadow: 0 8px 22px -12px rgba(220, 171, 67, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #fbe3a0 0%, var(--ouro-claro) 60%, var(--ouro) 100%);
  border-color: #fff0c4;
}
.btn-danger {
  color: var(--danger);
  background: rgba(255, 107, 114, 0.06);
}
.btn-danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: rgba(255, 107, 114, 0.14);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-block {
  width: 100%;
}
.btn-lg {
  min-height: 52px;
  font-size: 1.02rem;
  border-radius: var(--r-md);
}

/* ---------- Campos ---------- */
.field {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(4, 13, 31, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s;
}
.field:hover {
  border-color: var(--border-strong);
}
.field:focus {
  border-color: var(--ouro);
  box-shadow: 0 0 0 3px rgba(220, 171, 67, 0.2);
  outline: none;
}
.label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

/* ---------- Selos de estado ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(4, 13, 31, 0.66);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
  transition: border-color 0.3s, color 0.3s;
}
.badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
}
.badge[data-state='online']::before {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(70, 211, 154, 0.6);
  animation: ping 2.2s ease-out infinite;
}
.badge[data-state='connecting']::before,
.badge[data-state='reconnecting']::before {
  background: var(--warn);
  animation: pulse 1s infinite;
}
.badge[data-state='error']::before {
  background: var(--danger);
}
.badge[data-state='disabled']::before {
  background: #5d6b86;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 18px) scale(0.97);
  background: var(--ceu-800);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--ouro);
  color: var(--text);
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-sm);
  font-size: 0.92rem;
  box-shadow: 0 16px 36px -14px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.toast.error {
  border-left-color: var(--danger);
}

/* ---------- Janelas (dialog) ---------- */
.dialog {
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--ouro);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--ceu-800) 0%, var(--ceu-900) 100%);
  color: var(--text);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
}
.dialog::backdrop {
  background: rgba(3, 9, 22, 0.72);
  backdrop-filter: blur(3px);
}
.dialog[open] {
  animation: pop 0.28s var(--ease) both;
}
.dialog[open]::backdrop {
  animation: fade 0.28s ease both;
}
.dialog.is-closing {
  animation: pop-out 0.16s ease forwards;
}
.dialog.is-closing::backdrop {
  animation: fade-out 0.16s ease forwards;
}

/* ---------- Transição entre telas ---------- */
.view-enter {
  animation: rise 0.42s var(--ease) both;
}

/* ---------- Animações ---------- */
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(70, 211, 154, 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px rgba(70, 211, 154, 0);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}
@keyframes pop-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* Quem prefere menos movimento: sem animações contínuas; transições viram instantâneas. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
