/* ============================================================================
   Casa Marfori — TEMA MATRIX (exclusivo do painel da casa).
   Camada de override sobre o núcleo compartilhado `automacao.css`: preto puro +
   números verdes caindo atrás (matrix.js). Só a casa carrega este arquivo — o
   dashboard profissional continua no tema slate/navy/gold.
   ========================================================================== */

/* ---- Re-tematiza as variáveis do núcleo para o visual Matrix ---- */
:root {
  --au-bg: #000000;
  --au-bg2: #010402;
  --au-primary: #05210f;            /* fundo do ícone dos cards: verde-escuro */
  --au-gold: #2de66e;               /* accent = verde Matrix (substitui o dourado) */
  --au-gold-dark: #17a14a;
  --au-card: rgba(3, 16, 8, 0.92);  /* card quase opaco: a chuva vaza nos GAPS, e o compositor não re-blura (perf PX30) */
  --au-border: rgba(45, 220, 110, 0.22);
  --au-border-strong: rgba(45, 220, 110, 0.5);
  --au-text: #d9ffe6;
  --au-text-soft: #7fcf9a;
  --au-text-weak: #4f8c66;
  --au-green: #2de66e;
  --au-sombra: 0 10px 30px rgba(0, 0, 0, 0.6);
}

body.au-body {
  background: #000000;
  color: var(--au-text);
}

/* PERF PX30: sem backdrop-filter nos cards (o canvas Matrix repinta a 12fps e
   cada frame forçaria re-blur da região atrás de cada card). O blur fica só na
   tela de login (estática). Sombra reduzida — sobre preto é quase invisível. */
.card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Canvas do Matrix (matrix.js também estiliza inline; reforço aqui) */
#matrix {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* Conteúdo acima da chuva */
.au-shell, .tela { position: relative; z-index: 1; }
.toast-container { z-index: 50; }

.au-header-ponto { background: var(--au-green); box-shadow: 0 0 12px rgba(45, 220, 110, 0.7); }

/* Seta do select em verde (o núcleo usa dourado no data-URI) */
.card-select {
  background: rgba(0, 0, 0, 0.5)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232de66e' d='M6 8L0 0h12z'/%3E%3C/svg%3E")
    no-repeat right 12px center;
}

/* Botão play/volume da música em verde (o gradiente do núcleo herda as vars) */
.btn-play { color: #04150a; }
.sp-slider::-webkit-slider-thumb { border-color: #04150a; }
.sp-slider::-moz-range-thumb { border-color: #04150a; }

/* ======================= TELAS (login / controle) ======================= */

.tela { min-height: 100vh; min-height: 100dvh; width: 100%; }
.tela.hidden { display: none !important; }

.tela-senha { display: flex; align-items: center; justify-content: center; padding: 24px; }

.senha-box {
  width: 100%; max-width: 380px;
  background: var(--au-card);
  border: 1px solid var(--au-border-strong);
  border-radius: 16px;
  box-shadow: var(--au-sombra);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 34px 28px 28px; text-align: center;
}
.senha-marca { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.senha-marca-linha { height: 1px; width: 34px; background: linear-gradient(90deg, transparent, var(--au-green)); }
.senha-marca-linha:last-child { background: linear-gradient(90deg, var(--au-green), transparent); }
.senha-marca-nome {
  font-family: 'EB Garamond', Georgia, serif; letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 0.72rem; color: var(--au-green);
}
.senha-titulo { font-family: 'EB Garamond', Georgia, serif; font-size: 1.8rem; margin: 6px 0 8px; color: var(--au-text); font-weight: 500; }
.senha-sub { color: var(--au-text-soft); font-size: 0.92rem; line-height: 1.45; margin: 0 0 22px; }
.senha-input {
  width: 100%; height: 56px; border-radius: 10px;
  border: 1px solid var(--au-border); background: rgba(0, 0, 0, 0.45); color: var(--au-text);
  font-size: 1.15rem; text-align: center; padding: 0 14px; margin-bottom: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.senha-input:focus { border-color: var(--au-green); box-shadow: 0 0 0 3px rgba(45, 220, 110, 0.18); }
.senha-erro { color: #ef8b7a; font-size: 0.9rem; min-height: 1.2em; margin: 12px 0 0; }

.btn-grande {
  width: 100%; min-height: 52px; border: none; border-radius: 10px;
  font-size: 1.05rem; font-weight: 600; letter-spacing: 0.02em; cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
.btn-grande:active { transform: scale(0.985); }
.btn-entrar {
  color: #04150a;
  background: linear-gradient(135deg, var(--au-green) 0%, var(--au-gold-dark) 100%);
  box-shadow: 0 6px 18px rgba(23, 161, 74, 0.32);
}
.btn-entrar:hover { filter: brightness(1.06); }
.btn-entrar:disabled { opacity: 0.6; cursor: default; }

.tela-controle { display: block; }

/* Painel de parede 480x480 já é coberto pelas media queries do núcleo. */

/* ============================================================================
   RELÓGIO DE INATIVIDADE (screensaver estilo Matrix — relogio-inatividade.js)
   Após 30 s sem toque, cobre a UI com um relógio de números grandes verdes.
   A chuva do matrix.js (canvas #matrix, z-index 0) continua atrás — é o fundo.
   ========================================================================== */
#relogioInatividade {
  position: fixed;
  inset: 0;
  z-index: 45; /* acima da UI (z-1), abaixo dos toasts (z-50) */
  display: flex;
  align-items: center;
  justify-content: center;
  /* Escurece levemente o centro e mais as bordas: recolhe a UI, deixa a chuva vazar. */
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.88) 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  -webkit-tap-highlight-color: transparent;
}
#relogioInatividade.visivel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto; /* o 1º toque é absorvido aqui (acorda), não vaza p/ os botões */
}

/* Enquanto o screensaver está ativo, a UI recua — sobra só a chuva + o relógio. */
body.screensaver-ativa .tela-controle { visibility: hidden; }

.rl-wrap { text-align: center; user-select: none; -webkit-user-select: none; }

.rl-hora {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.14em;
  font-family: ui-monospace, 'SFMono-Regular', 'Courier New', monospace;
  font-variant-numeric: tabular-nums; /* dígitos de largura fixa: não "pula" */
  font-weight: 700;
  line-height: 1;
  color: #c8ffd2;
  text-shadow:
    0 0 6px rgba(45, 230, 110, 0.9),
    0 0 18px rgba(45, 230, 110, 0.55),
    0 0 42px rgba(23, 161, 74, 0.4);
}
.rl-hm { font-size: clamp(3.2rem, 22vmin, 13rem); letter-spacing: 0.03em; }
.rl-seg {
  font-size: clamp(1.2rem, 7vmin, 4rem);
  color: #2de66e;
  opacity: 0.82;
  text-shadow: 0 0 8px rgba(45, 230, 110, 0.6);
}
.rl-data {
  margin-top: 0.55em;
  font-family: ui-monospace, 'SFMono-Regular', 'Courier New', monospace;
  font-size: clamp(0.78rem, 3.4vmin, 1.5rem);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #7fcf9a;
  text-shadow: 0 0 8px rgba(45, 230, 110, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  #relogioInatividade { transition: none; }
}
