@font-face {
    font-family: 'IntelbrasFont';
    src: url('fonts/Intelbras-Sans-normal-normal-1cc9831f.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'IntelbrasFont';
    src: url('fonts/Intelbras-Sans-500-normal-e922ebb9.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'IntelbrasFont';
    src: url('fonts/Intelbras-Sans-bold-normal-24c647cd.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'IntelbrasFont';
    src: url('fonts/Intelbras-Sans-900-normal-39666f3d.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
}

:root {
    /* Cores Cockpit / Industrial Dark */
    --bg-base: #0B0E11; /* Preto profundo */
    --bg-surface: #12161B;
    --bg-header: #181E25;
    --border-color: #1E252D;
    --border-hover: #2C3642;
    
    /* Textos */
    --text-primary: #E5E7EB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    /* Acentos Intelbras */
    --primary-green: #00A335;
    --primary-hover: #00882B;
    --red-alert: #EF4444;
    
    /* Badges de Classificação */
    --badge-human-bg: #0D3B66;
    --badge-human-border: #00A3E0;
    --badge-vehicle-bg: #064E3B;
    --badge-vehicle-border: #00A335;
    --badge-animal-bg: #78350F;
    --badge-animal-border: #F59E0B;
    --badge-other-bg: #1E293B;
    --badge-other-border: #64748B;

    /* Fontes */
    --font-ui: 'IntelbrasFont', 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden; /* Fixo 100vh */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilitários */
.mono { font-family: var(--font-mono); }
.text-green { color: var(--primary-green) !important; }
.text-red { color: var(--red-alert) !important; }

/* Container Principal */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* =========================================
   TELA DE LOGIN INSTITUCIONAL (#components-login)
========================================= */
.login-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 50% -20%, rgba(0, 163, 53, 0.05) 0%, transparent 60%),
        radial-gradient(circle at 50% 120%, rgba(0, 163, 53, 0.03) 0%, transparent 60%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 360px;
    background-color: transparent;
    padding: 24px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand-img {
    height: 42px;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-subtitle {
    color: #8b979f;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b979f;
    font-size: 14px;
    transition: color 0.2s;
}

.input-group input {
    width: 100%;
    height: 44px;
    background-color: #15191E;
    border: 1px solid #2E3842;
    border-radius: 4px;
    padding: 0 40px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input::placeholder {
    color: #8b979f;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(0, 163, 53, 0.2);
}

.input-group input:focus + .input-icon, 
.input-group input:focus ~ .input-icon {
    color: var(--primary-green);
}

.btn-toggle-pass {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #8b979f;
    cursor: pointer;
    padding: 4px;
}

.btn-toggle-pass:hover { color: var(--text-primary); }

.btn-login {
    background-color: var(--primary-green);
    color: white;
    border: none;
    width: 100%;
    height: 44px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-login:hover { background-color: var(--primary-hover); }
.btn-login:disabled { background-color: #1E4620; color: rgba(255,255,255,0.5); cursor: not-allowed; }

.login-error {
    color: var(--red-alert);
    font-size: 13px;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}


/* =========================================
   HEADER GLOBAL
========================================= */
.global-header {
    height: 52px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    margin-right: 32px;
}

.header-brand-img {
    height: 18px;
    display: block;
}

.divider {
    color: #4B5563;
    margin: 0 10px;
}

.product-text {
    font-weight: 600;
    color: #E5E7EB;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.badge-enterprise {
    font-size: 10px;
    background: #1F2937;
    color: #9CA3AF;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 700;
    letter-spacing: 1px;
}

.module-tabs {
    display: flex;
    height: 100%;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.02);
}

.tab.active {
    color: var(--primary-green);
    border-bottom-color: var(--primary-green);
    background: rgba(0, 163, 53, 0.05);
}

/* Header Right */
.system-status {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-right: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.3);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #1c261e;
}

.led-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse-green {
    background-color: var(--primary-green);
    box-shadow: 0 0 8px var(--primary-green);
    animation: pulseG 2s infinite;
}

.pulse-red {
    background-color: var(--red-alert);
    box-shadow: 0 0 8px var(--red-alert);
    animation: pulseR 1s infinite;
}

@keyframes pulseG { 0% { opacity: 0.8; } 50% { opacity: 0.3; } 100% { opacity: 0.8; } }
@keyframes pulseR { 0% { opacity: 1; } 50% { opacity: 0.2; } 100% { opacity: 1; } }

.status-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-green);
    letter-spacing: 0.5px;
}

.telemetry-bar {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: #000;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.precision-clock {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
    margin-right: 20px;
    background: #000;
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

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

.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--primary-green);
    border-color: var(--primary-green);
    background: rgba(0, 163, 53, 0.1);
}

/* =========================================
   WORKSPACE GLOBAL
========================================= */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* =========================================
   PAINEL ESQUERDO
========================================= */
.left-panel {
    width: 280px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.panel-section.flex-grow {
    flex-grow: 1;
    overflow-y: auto;
}

.section-header {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

/* Device Tree */
.tree-node {
    font-size: 13px;
    padding: 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.group-node { color: var(--text-primary); font-weight: 600; }
.device-node { padding-left: 20px; transition: 0.2s; }
.device-node:hover { color: var(--text-primary); }
.device-node.active { color: var(--primary-green); }

.device-status-ok {
    font-size: 10px;
    background: rgba(0, 163, 53, 0.15);
    color: var(--primary-green);
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: auto;
    font-weight: 700;
}

/* Filtros */
.filter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
}

.filter-item:hover {
    background: rgba(255,255,255,0.03);
}

.filter-item input { display: none; }

.checkmark {
    width: 16px;
    height: 16px;
    border: 1px solid var(--text-muted);
    border-radius: 3px;
    margin-right: 10px;
    position: relative;
    transition: 0.2s;
}

.filter-item input:checked ~ .checkmark {
    border-color: var(--primary-green);
    background-color: var(--primary-green);
}

.filter-item input:checked ~ .checkmark.blue { border-color: #00A3E0; background-color: #00A3E0; }
.filter-item input:checked ~ .checkmark.green { border-color: var(--primary-green); background-color: var(--primary-green); }
.filter-item input:checked ~ .checkmark.amber { border-color: #F59E0B; background-color: #F59E0B; }
.filter-item input:checked ~ .checkmark.slate { border-color: #64748B; background-color: #64748B; }

.filter-item input:checked ~ .checkmark::after {
    content: ''; position: absolute;
    left: 4px; top: 1px; width: 4px; height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    flex-grow: 1;
}

.counter {
    font-family: var(--font-mono);
    font-size: 11px;
    background: #1F2937;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

/* Ranges */
.date-ranges {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.range-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.range-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.range-btn.active {
    background: rgba(0, 163, 53, 0.1);
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.native-date-picker {
    width: 100%;
    background: #000;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 4px;
    color-scheme: dark;
    font-family: var(--font-ui);
    font-size: 13px;
}

/* =========================================
   PAINEL CENTRAL
========================================= */
.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-base);
}

/* Visualizador Principal */
.viewer-container {
    height: 45%;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.viewer-wrapper {
    background: #000;
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.video-player {
    flex: 1;
    position: relative;
    background-color: #000;
    background-image: linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%, #111), linear-gradient(45deg, #111 25%, transparent 25%, transparent 75%, #111 75%, #111);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
}

.osd-top-left, .osd-top-right, .osd-bottom-left {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: #FFF;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

.osd-top-left { top: 16px; left: 16px; }
.osd-top-right { top: 16px; right: 16px; }
.osd-bottom-left { bottom: 16px; left: 16px; display: flex; align-items: center; gap: 8px; }

.crosshair {
    position: absolute;
    top: 50%; left: 50%;
    width: 40px; height: 40px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.3;
}
.crosshair::before, .crosshair::after {
    content: ''; position: absolute; background: white;
}
.crosshair::before { top: 50%; left: 0; width: 100%; height: 1px; }
.crosshair::after { top: 0; left: 50%; width: 1px; height: 100%; }

.player-toolbar {
    height: 40px;
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.toolbar-group { display: flex; gap: 8px; }

.tool-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 28px; height: 28px;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}

.tool-btn:hover { background: rgba(255,255,255,0.1); color: white; }

.sensor-status { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* Grid Forense */
.forensic-grid-container {
    flex: 1;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.grid-header {
    height: 40px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-header);
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.grid-actions .view-mode {
    color: var(--text-muted);
    margin-left: 12px;
    cursor: pointer;
}
.grid-actions .view-mode.active { color: var(--primary-green); }

.grid-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    align-content: flex-start;
}

/* Cards Forenses */
.forensic-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
}

.forensic-card:hover {
    border-color: var(--primary-green);
    box-shadow: 0 0 10px rgba(0, 163, 53, 0.15);
}

.forensic-card.active-card {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 1px var(--primary-green);
}

.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.card-info { padding: 12px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.ai-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 2px;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.badge-human { background-color: var(--badge-human-bg); border-color: var(--badge-human-border); }
.badge-vehicle { background-color: var(--badge-vehicle-bg); border-color: var(--badge-vehicle-border); }
.badge-animal { background-color: var(--badge-animal-bg); border-color: var(--badge-animal-border); }
.badge-other { background-color: var(--badge-other-bg); border-color: var(--badge-other-border); }

.conf-score {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.card-time {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-meta {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* =========================================
   PAINEL DIREITO (Auditoria)
========================================= */
.right-panel {
    width: 340px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-right 0.3s;
}

.right-panel.hidden {
    display: none;
}

.audit-header {
    height: 50px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: var(--bg-header);
}

.audit-header h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-green);
    letter-spacing: 0.5px;
}

.close-audit {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}
.close-audit:hover { color: white; }

.audit-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.audit-image-box {
    width: 100%;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.audit-image-box img {
    width: 100%;
    display: block;
}

.ai-box-overlay {
    position: absolute;
    border: 2px solid var(--primary-green);
    background: rgba(0, 163, 53, 0.1);
    top: 20%; left: 30%; width: 40%; height: 50%;
    display: none;
}

.metadata-table {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 24px;
}

.meta-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-base);
}
.meta-row:last-child { border-bottom: none; }

.meta-label {
    width: 40%;
    padding: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
    border-right: 1px solid var(--border-color);
}

.meta-value {
    width: 60%;
    padding: 10px;
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.btn-export {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-export:hover {
    background: var(--primary-green);
    color: white;
}

/* Scrollbar Style */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4B5563; }
