/* ==========================================
   VARIÁVEIS DE TEMA (CLARO/MODERNO)
   ========================================== */
:root {
    --bg-app: #f1f5f9;
    --bg-panel: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   LAYOUT PRINCIPAL E GRID
   ========================================== */
.app-wrapper { 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
}

.app-header { 
    background: var(--bg-panel); 
    padding: 15px 24px; 
    border-bottom: 1px solid var(--border); 
    box-shadow: var(--shadow-sm); 
    z-index: 10; 
    display: flex;
    justify-content: space-between; 
    align-items: center;
}

.logo { display: flex; align-items: center; gap: 15px; }

.logo-img { 
    width: 150px; 
    height: auto; 
    object-fit: contain; 
}

.logo h1 { font-size: 18px; margin: 0; font-weight: 700; color: var(--text-main); }
.logo span { color: var(--primary); }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.logout-icon { font-size: 16px; }

.dashboard { 
    display: flex; 
    flex-direction: column; 
    gap: 24px; 
    padding: 24px; 
    flex: 1; 
    overflow-y: auto; 
}

@media (min-width: 1024px) {
    .dashboard { 
        flex-direction: row; 
        display: grid; 
        grid-template-columns: 260px 1fr 650px; 
        overflow: hidden; 
    }
}

.painel { 
    background: var(--bg-panel); 
    border-radius: var(--radius-lg); 
    padding: 24px; 
    box-shadow: var(--shadow-md); 
    display: flex; 
    flex-direction: column; 
    border: 1px solid var(--border); 
}

.sidebar { overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.centro { align-items: center; justify-content: flex-start; }

/* ==========================================
   TIPOGRAFIA E BLOCOS
   ========================================== */
.section-title { font-size: 16px; margin: 0 0 4px 0; font-weight: 700; color: var(--text-main); }
.section-desc { font-size: 13px; color: var(--text-muted); margin: 0 0 20px 0; line-height: 1.4; }
.divisor { border: none; border-top: 1px solid var(--border); margin: 20px 0; width: 100%; }

/* ==========================================
   FORMULÁRIOS, INPUTS E BOTÕES GERAIS
   ========================================== */
input, select { 
    width: 100%; padding: 12px 14px; border-radius: 8px; 
    border: 1px solid var(--border); background: #f8fafc; 
    color: var(--text-main); font-size: 14px; outline: none; 
    transition: all 0.2s; box-sizing: border-box; 
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.linha-inputs { display: flex; gap: 8px; width: 100%; }
.input-curto { flex: 0.35; min-width: 70px; }

button:not(.btn-logout):not(.menu-link) { 
    border: none; border-radius: 8px; cursor: pointer; font-weight: 600; 
    transition: all 0.2s; font-size: 14px; display: flex; align-items: center; justify-content: center; 
}
button:not(.btn-logout):not(.menu-link):active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: white; padding: 12px 20px; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: white; padding: 14px; width: 100%; margin-top: 10px; }
.btn-success:hover { background: var(--success-hover); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }

/* ==========================================
   ✨ NOVO: MENU LATERAL PREMIUM (SAAS) ✨
   ========================================== */
.sidebar-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.menu-nav { 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
}

.menu-link { 
    background-color: transparent; 
    color: var(--text-muted); 
    padding: 8px 12px; 
    font-size: 14px; 
    font-weight: 500;
    text-align: left; 
    border: none; 
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px; 
    cursor: pointer;
    width: 100%;
}

.menu-link .menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #475569;
}

.menu-link:hover { 
    background-color: #f8fafc; 
    color: var(--primary); 
}

.menu-link:hover .menu-icon {
    background-color: #dbeafe; /* Azul clarinho sutil */
    color: var(--primary);
    transform: scale(1.05);
}

.menu-link:active {
    transform: scale(0.98);
}

/* FIM DO NOVO MENU */

.filtro-input {
    width: 100%; padding: 10px 14px; border-radius: 8px; 
    border: 1px solid var(--border); background: #f8fafc; 
    color: var(--text-main); font-size: 13px; margin-bottom: 12px;
    box-sizing: border-box; outline: none; transition: 0.2s;
}
.filtro-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }

/* ==========================================
   ÁREA DA CÂMERA E TERMINAL
   ========================================== */
.terminal-config { width: 100%; margin-bottom: 20px; text-align: center;}
.config-grid { display: flex; flex-direction: column; gap: 10px; margin-top: 10px;}
@media (min-width: 768px) { .config-grid { flex-direction: row; } } 

.status-mensagem { 
    font-size: 15px; margin-bottom: 15px; font-weight: 600; 
    padding: 10px 20px; border-radius: 20px; background: #fef3c7; color: #b45309; 
    text-align: center; width: 100%; box-sizing: border-box;
}

.container-video { 
    position: relative; width: 100%; max-width: 100%; 
    border-radius: var(--radius-md); overflow: hidden; background: #000; 
    box-shadow: var(--shadow-lg); margin-bottom: 20px; border: 4px solid #fff;
}
.container-video video { width: 100%; height: auto; display: block; transform: scaleX(-1); }
.container-video canvas { top: -5; left: 0; width: 100% !important; height: 100% !important; transform: scaleX(-1); }

.btn-toggle { padding: 12px 24px; color: white; border-radius: 30px; box-shadow: var(--shadow-md);}
.btn-toggle.ativo { background-color: var(--danger); } 
.btn-toggle.inativo { background-color: var(--success); } 

/* ==========================================
   FEEDBACK DE CHECK-IN (OVERLAY NA CÂMERA)
   ========================================== */
.checkin-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(16, 185, 129, 0.85); backdrop-filter: blur(8px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: white; z-index: 50; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease; pointer-events: none;
}
.checkin-overlay.ativo { opacity: 1; visibility: visible; }

.overlay-avatar {
    width: 220px; height: 220px; border-radius: 50%; border: 4px solid white;
    object-fit: cover; margin-bottom: 15px; box-shadow: var(--shadow-lg);
    transform: scale(0.8); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.checkin-overlay.ativo .overlay-avatar { transform: scale(1); }

.overlay-content { text-align: center; }
.overlay-icon { font-size: 40px; margin-bottom: 5px; animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
.overlay-content h3 { margin: 0; font-size: 24px; font-weight: 800; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.overlay-content p { margin: 5px 0 0 0; font-size: 16px; font-weight: 500; opacity: 0.9; }

/* ==========================================
   LISTAS E CARDS (LOGS E USUÁRIOS)
   ========================================== */
.cabecalho-logs { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 15px; }
.btn-limpar { background-color: #f1f5f9; color: var(--danger); padding: 6px 12px; font-size: 12px; border: 1px solid #e2e8f0; }
.btn-limpar:hover { background-color: #fee2e2; border-color: #f87171; }

.lista-rolagem { list-style: none; padding: 0; margin: 0; }
.mini-lista { max-height: 350px; overflow-y: auto; padding-right: 5px; }
.grande-lista { flex: 1; overflow-y: auto; padding-right: 5px; }
.lista-rolagem::-webkit-scrollbar { width: 4px; }
.lista-rolagem::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.lista-rolagem li { 
    background: #ffffff; padding: 14px; border-radius: var(--radius-md); 
    margin-bottom: 12px; border: 1px solid var(--border); 
    border-left: 5px solid var(--primary); display: flex; 
    align-items: center; justify-content: space-between; 
    box-shadow: var(--shadow-sm); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lista-rolagem li:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.avatar-container { position: relative; margin-right: 15px; }
.avatar { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; border: 2px solid #e2e8f0; box-shadow: 0 2px 4px rgba(0,0,0,0.05); flex-shrink: 0; }

.user-info, .log-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.log-nome { font-size: 15px; font-weight: 700; color: var(--text-main); letter-spacing: -0.3px; }
.log-local { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.log-tempo { font-size: 11px; color: #475569; background: #f1f5f9; padding: 4px 10px; border-radius: 12px; display: inline-block; width: fit-content; border: 1px solid #e2e8f0; font-weight: 600; }
.log-acoes { display: flex; flex-direction: column; align-items: flex-end; }

.botoes-acao-lista { display: flex; gap: 8px; align-items: center; }
.btn-excluir-item, .btn-excluir-user { background-color: #fee2e2; color: var(--danger); padding: 6px 10px; font-size: 12px; border-radius: 6px; border: none; cursor: pointer; transition: 0.2s; }
.btn-excluir-item:hover, .btn-excluir-user:hover { background-color: var(--danger); color: white; }
.btn-otimizar { background-color: #dbeafe; color: #1d4ed8; padding: 6px 10px; font-size: 12px; border-radius: 6px; border: none; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-otimizar:hover { background-color: #bfdbfe; color: #1e40af; }

.api-status { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05); letter-spacing: -0.2px; }
.api-status .status-icon { font-size: 13px; }
.api-status.enviando { background-color: #fef3c7; color: #b45309; } 
.api-status.sucesso { background-color: #d1fae5; color: #047857; } 
.api-status.erro { background-color: #fee2e2; color: #b91c1c; } 
.api-status.fila { background-color: #dbeafe; color: #1d4ed8; } 

/* ==========================================
   MODAIS E SCANNER VISUAL
   ========================================== */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(5px); justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
.modal.ativo { display: flex; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content { background-color: var(--bg-panel); padding: 30px; border-radius: var(--radius-lg); width: 100%; max-width: 450px; box-shadow: var(--shadow-lg); position: relative; border: 1px solid var(--border); animation: slideUp 0.3s ease-out; }
.modal-lg { max-width: 480px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-content h2 { margin-top: 0; color: var(--text-main); font-size: 20px;}
.modal-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }
.close-btn { color: #cbd5e1; position: absolute; top: 15px; right: 20px; font-size: 28px; font-weight: normal; cursor: pointer; line-height: 1; }
.close-btn:hover { color: var(--danger); }

.lista-modal { max-height: 200px; padding-right: 5px; } 
.lista-modal::-webkit-scrollbar { width: 4px; }
.lista-modal::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
h3.titulo-lista-modal { font-size: 14px; color: var(--text-muted); margin: 0 0 10px 0; }
.msg-progresso { font-weight: 600; color: var(--primary); display: block; margin-top: 10px;}
.badge { background: var(--primary); color: white; padding: 2px 6px; border-radius: 4px; font-size: 12px;}

.slider { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 5px; background: #e2e8f0; outline: none; padding: 0; border: none; margin-top: 10px; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); cursor: pointer; transition: 0.2s; }
.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* SCANNER E THUMBNAILS */
.scanner-container { position: relative; width: 100%; height: 260px; background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 12px; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); border: 2px solid var(--border); }
.video-espelho { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.scanner-overlay { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); background: rgba(15, 23, 42, 0.7); color: white; padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.2); transition: all 0.3s ease; }
.scanner-overlay.scanning { background: var(--primary); border-color: var(--primary); animation: pulse-scan 1s infinite alternate; }
@keyframes pulse-scan { 0% { transform: translateX(-50%) scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); } 100% { transform: translateX(-50%) scale(1.05); box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); } }

.thumbnails-grid { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 15px; }
.thumb-slot { flex: 1; aspect-ratio: 1; background: #f1f5f9; border: 2px dashed #cbd5e1; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 16px; color: #94a3b8; transition: 0.3s; position: relative; }
.thumb-slot img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.thumb-slot.captured { border: 2px solid var(--success); background: #d1fae5; }
.thumb-slot.failed { border: 2px solid var(--danger); background: #fee2e2; color: var(--danger); }
@keyframes popIn { 0% { transform: scaleX(-1) scale(0.5); opacity: 0; } 100% { transform: scaleX(-1) scale(1); opacity: 1; } }

.btn-grande { padding: 16px; font-size: 15px; }