/* ============================================================
   totem/totem.css — Estilos do Modo Totem (Fullscreen)
   ARQUIVO PARA SUBDOMÍNIO: deploy separado na Hostinger
============================================================ */

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-variant: #1a2744;
    --primary: #38bdf8;
    --on-primary: #0f172a;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --error: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
    --border: rgba(255,255,255,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Tela Inicial (Idle) ── */
#totem-idle {
    position: fixed; inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    cursor: pointer;
    transition: opacity 0.4s;
}
#totem-idle .logo-area {
    text-align: center;
}
#totem-idle .logo-area h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}
#totem-idle .logo-area p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 8px;
}
#totem-idle .pulse-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(56,189,248,0.15);
    border: 2px solid rgba(56,189,248,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(56,189,248,0.4); }
    50%       { box-shadow: 0 0 0 20px rgba(56,189,248,0); }
}
#totem-idle .clock {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}
#totem-idle .date-str {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Tela de Login ── */
#totem-login {
    position: fixed; inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 32px;
    background: var(--bg);
}
.totem-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
}
.totem-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
    text-align: center;
}
.totem-input {
    width: 100%;
    background: var(--surface-variant);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    outline: none;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}
.totem-input:focus { border-color: var(--primary); }
.totem-btn-primary {
    width: 100%;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: filter 0.2s, transform 0.1s;
}
.totem-btn-primary:hover  { filter: brightness(1.1); }
.totem-btn-primary:active { transform: scale(0.98); }
.totem-btn-outline {
    width: 100%;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 8px;
}

/* ── Câmera Retrato ── */
#totem-camera {
    position: fixed; inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg);
}
#totem-camera h3 {
    font-size: 1.2rem; font-weight: 700;
    color: var(--text-main); text-align: center;
}
.totem-viewfinder {
    position: relative;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 3 / 4;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
}
#totem-video {
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Espelho padrão */
    border-radius: 16px;
}
#totem-canvas { display: none; }
.totem-corner {
    position: absolute;
    width: 28px; height: 28px;
    border-color: var(--primary);
    border-style: solid;
    border-width: 0;
}
.totem-corner.tl { top: 12px; left: 12px; border-top-width: 3px; border-left-width: 3px; border-radius: 4px 0 0 0; }
.totem-corner.tr { top: 12px; right: 12px; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.totem-corner.bl { bottom: 12px; left: 12px; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 4px; }
.totem-corner.br { bottom: 12px; right: 12px; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }
.totem-scan-line {
    position: absolute; left: 12px; right: 12px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scanDown 2s linear infinite;
}
@keyframes scanDown {
    0%   { top: 12px; }
    100% { top: calc(100% - 12px); }
}

/* ── Resultado ── */
#totem-resultado {
    position: fixed; inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 32px 16px;
    background: var(--bg);
    text-align: center;
    overflow-y: auto;
    justify-content: flex-start; /* Evita cortar o topo em telas pequenas */
.resultado-icon {
    font-size: 5rem;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.resultado-nome {
    font-size: 1.8rem; font-weight: 800;
    color: var(--text-main);
}
.resultado-msg {
    font-size: 1rem; color: var(--text-muted);
    max-width: 360px;
}
.resultado-bar {
    width: 100%; max-width: 360px;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}
.resultado-bar-fill {
    height: 100%;
    border-radius: 3px;
    animation: shrink linear forwards;
}
.resultado-bar-fill.aprovado { background: var(--success); }
.resultado-bar-fill.negado   { background: var(--error); }
.resultado-bar-fill.erro     { background: var(--warning); }
@keyframes shrink {
    from { width: 100%; }
    to   { width: 0%; }
}
@keyframes shrink-countdown {
    0%   { width: 100%; background: var(--success); }
    60%  { width: 40%; background: var(--warning); }
    100% { width: 0%; background: var(--error); }
}

/* ── Troca de Emergência (dentro da tela de resultado) ── */
#totem-troca-emergencia {
    display: none;
    width: 100%; max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-top: 16px;
    text-align: left;
    margin-bottom: 32px; /* Espaço extra no final do scroll */
}
#totem-troca-emergencia h4 {
    font-size: 1rem; font-weight: 700;
    color: var(--warning);
    margin-bottom: 12px;
}
.totem-troca-colaborador {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.15s;
    display: flex; justify-content: space-between; align-items: center;
}
.totem-troca-colaborador:hover { background: rgba(255,255,255,0.05); }
.totem-troca-colaborador.selected { border-color: var(--primary); background: rgba(56,189,248,0.08); }

#totem-ausentes-lista {
    max-height: 35vh;
    overflow-y: auto;
    padding-right: 8px;
}
#totem-ausentes-lista::-webkit-scrollbar { width: 6px; }
#totem-ausentes-lista::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
