:root {
  /* Color Palette - Premium Bistro Vegano */
  --bg-dark: #0a0c10;
  --bg-card: rgba(255, 255, 255, 0.05);
  --primary: #2ecc71; /* Emerald Green */
  --primary-glow: rgba(46, 204, 113, 0.4);
  --secondary: #f1c40f; /* Sunflower Gold */
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --danger: #e74c3c;
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-main: 'Outfit', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Glassmorphism Background Decoration */
.blob {
  position: absolute;
  width: 300px;
  height: 300px;
  background: var(--primary);
  filter: blur(150px);
  z-index: -1;
  opacity: 0.15;
  border-radius: 50%;
}

.blob-1 { top: -50px; left: -50px; }
.blob-2 { bottom: -50px; right: -50px; background: var(--secondary); }

/* Layout Containers */
.kiosk-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 1;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 2rem;
  padding: 1.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
}

/* Typography */
header {
  position: relative;
}

.cloud-indicator {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.cloud-indicator.online {
  background: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.cloud-indicator.error {
  background: var(--danger);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(to bottom right, #fff, #a0a0a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* Clock Display */
.digital-clock {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 0.2rem;
  font-variant-numeric: tabular-nums;
  color: white;
}

.date-display {
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.8rem;
  margin-bottom: 2rem;
}

/* Camera Preview */
.camera-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 1.5rem;
}

.camera-container {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--glass-border);
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video, #reg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center; /* Centralização absoluta nos dois eixos */
  transform: scaleX(-1); /* Espelhamento Selfie */
}

.camera-overlay {
  position: absolute;
  inset: -8px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  pointer-events: none;
  animation: pulse 2s infinite;
  box-shadow: 0 0 20px var(--primary-glow);
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1); opacity: 0.5; }
}

/* Buttons */
.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 1rem 0.5rem;
  border-radius: 1rem;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.75;
}

.action-btn.recommended-action {
  opacity: 1;
  border-color: var(--primary);
  background: rgba(46, 204, 113, 0.1);
  box-shadow: 0 0 15px var(--primary-glow);
  animation: recommendedPulse 2s infinite;
}

@keyframes recommendedPulse {
  0% { box-shadow: 0 0 10px var(--primary-glow); transform: scale(1); }
  50% { box-shadow: 0 0 25px var(--primary); transform: scale(1.02); }
  100% { box-shadow: 0 0 10px var(--primary-glow); transform: scale(1); }
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-3px);
  border-color: var(--primary);
}

.action-btn svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.action-btn.primary-action {
  grid-column: span 2;
  background: var(--primary);
  color: var(--bg-dark);
  border: none;
  font-size: 1.1rem;
  padding: 1.5rem;
  opacity: 1;
}

.action-btn.primary-action svg {
  color: var(--bg-dark);
}

.action-btn.primary-action:hover {
  box-shadow: 0 0 30px var(--primary-glow);
  transform: scale(1.02);
}

/* Animations */
.fade-in {
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Modal and Forms */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.registration-panel {
  max-width: 450px;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  color: white;
  font-family: var(--font-main);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.input-group input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 15px var(--primary-glow);
}

.mini-camera {
  width: 180px;
  height: 180px;
  margin: 1.5rem auto;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
}

.admin-panel {
  max-width: 600px;
  width: 95%;
  max-height: 85vh; /* Flexível para não estourar a tela */
  display: flex;
  flex-direction: column;
  padding: 1rem !important;
  overflow-y: auto; /* Permite rolar o painel todo se necessário */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.close-btn:hover {
    color: var(--danger);
}

.logs-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  margin: 0.5rem 0;
  text-align: left;
  padding-right: 0.5rem;
  /* Removido touch-action e forçamento de scroll */
}

/* Estilização da barra de rolagem para visibilidade */
.logs-container::-webkit-scrollbar {
  width: 6px;
}
.logs-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.logs-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.log-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-info h4 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.log-info span {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
}

.log-time {
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--text-muted);
}

/* Feedback Effects */
#flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

.flash-animation {
  animation: flash-blink 0.4s ease-out;
}

@keyframes flash-blink {
  0% { opacity: 0.8; }
  100% { opacity: 0; }
}

#countdown-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 6rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 0 30px rgba(0,0,0,0.5);
  z-index: 11;
  pointer-events: none;
  font-family: var(--font-main);
}

/* Fix for Select Options contrast */
#export-filter option {
    color: #333 !important;
    background: white;
}

/* Low Light Booster - Front Flash Effect */
.low-light-boost {
  background-color: #ffffff !important;
}
.low-light-boost .glass-panel {
  background: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 0 50px rgba(255, 255, 255, 1) !important;
}
.low-light-boost h1, 
.low-light-boost .subtitle,
.low-light-boost .digital-clock,
.low-light-boost .date-display {
  color: #000 !important;
  text-shadow: none !important;
  -webkit-text-fill-color: #000 !important;
}

/* Success Modal Specifics (LRD Phase 2) */
.success-icon {
    margin-bottom: 1rem;
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

#success-photo {
    transition: transform 0.3s ease;
}

#success-photo:hover {
    transform: scale(1.1);
}

/* 9. ADMIN V2 (Gestão de Funcionários) */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

/* Garantir que as seções ocupem o espaço disponível e permitam scroll interno */
#logs-section, #employees-section, #settings-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Permite que os filhos encolham e o scroll funcione */
    overflow: hidden;
}

.tab-btn.active {
    background: rgba(46, 204, 113, 0.1);
    color: var(--primary);
}

.employees-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.employee-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease;
}

.employee-item:hover {
    transform: translateX(5px);
    background: rgba(255,255,255,0.05);
}

.emp-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.1);
}

.emp-info {
    flex: 1;
}

.emp-info h4 {
    margin: 0;
    font-size: 0.85rem;
}

.emp-info p {
    margin: 0;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.emp-status-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-active { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.status-inactive { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }

.emp-actions {
    display: flex;
    gap: 8px;
}

.mini-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.mini-btn:hover {
    background: rgba(255,255,255,0.1);
}

.mini-btn.danger:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: #e74c3c;
    color: #e74c3c;
}

/* Ajustes Responsivos para o Footer do Admin */
.admin-footer-actions {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 5px !important;
    margin-top: 10px;
}

.admin-footer-actions .action-btn {
    padding: 0.8rem 0.2rem !important;
    font-size: 0.7rem !important;
}

@media (max-width: 480px) {
    .digital-clock { font-size: 3rem; }
    .btn-grid { gap: 10px; }
    .action-btn { padding: 1rem; font-size: 0.9rem; }
    
    /* App Inteiro Nativo no Mobile (Sem caixa/moldura) */
    .glass-panel {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
        padding: 2rem 1rem !important;
        background: transparent !important; /* Remove o fundo da caixa */
        backdrop-filter: none !important;    /* Remove o desfoque da caixa */
        box-shadow: none !important;         /* Remove a sombra da caixa */
    }

    /* Modal vira uma seção comum */
    .modal-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        min-height: 100vh;
        background: var(--bg-dark);
        display: block;
        const constraints = { 
            video: { 
                facingMode: 'user', 
                width: { ideal: 1920 }, 
                height: { ideal: 1080 } 
            } 
        };
        z-index: 9999;
    }
