/* ═══════════════════════════════════════════════════════════════════
   NOC OPERATIONAL CONSOLE & CORRELATION ENGINE (PRO EDITION)
   Ativa ISP Manager - Observability Styling
   ═══════════════════════════════════════════════════════════════════ */

/* ── Container Principal ── */
#noc-section {
    padding: 20px;
    background: var(--bg-body, #0a0e17);
    min-height: calc(100vh - 65px);
    color: var(--text-primary, #f1f5f9);
}

/* ── Header do Cockpit ── */
.noc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.noc-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.noc-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(16, 185, 129, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #60a5fa;
}

.noc-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.noc-subtitle {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    margin: 2px 0 0 0;
}

/* ── Badge de Conexão WebSocket ── */
.noc-badge-live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.noc-badge-live.online {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.noc-badge-live.offline {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.noc-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: noc-pulse 2s infinite;
}

.noc-pulse-dot.warning {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

@keyframes noc-pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* ── Grid de KPIs Superiores ── */
.noc-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.noc-kpi-card {
    background: var(--card-bg, #111827);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.noc-kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4);
}

.noc-kpi-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 6px;
}

.noc-kpi-val {
    font-size: 24px;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1;
}

/* ── Barra de Navegação Interna do NOC ── */
.noc-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px;
    margin-bottom: 20px;
}

.noc-nav-tabs {
    display: flex;
    gap: 4px;
}

.noc-nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    padding: 8px 16px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.noc-nav-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.noc-nav-tab.active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* ── Filtros do Desk ── */
.noc-desk-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.noc-p-filters {
    display: flex;
    align-items: center;
    gap: 6px;
}

.noc-p-filter-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #94a3b8);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.noc-p-filter-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.noc-p-filter-btn.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.noc-p-filter-btn.p1.active { background: #ef4444; border-color: #ef4444; }
.noc-p-filter-btn.p2.active { background: #f97316; border-color: #f97316; }
.noc-p-filter-btn.p3.active { background: #eab308; border-color: #eab308; }
.noc-p-filter-btn.p4.active { background: #0284c7; border-color: #0284c7; }

.noc-search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0 10px;
    width: 260px;
}

.noc-search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 12px;
    padding: 6px 8px;
    width: 100%;
}

/* ── Tabela de Incidentes ── */
.noc-incidents-table-wrapper {
    background: var(--card-bg, #111827);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow-x: auto;
}

.noc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    text-align: left;
}

.noc-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted, #94a3b8);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.8px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.noc-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.noc-incident-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.noc-incident-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ── Badges de Prioridade ── */
.noc-p-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    font-family: monospace;
    letter-spacing: 0.5px;
}

.noc-p-badge.p-p1 {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: p1-pulse 2s infinite;
}

.noc-p-badge.p-p2 {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border: 1px solid rgba(249, 115, 22, 0.4);
}

.noc-p-badge.p-p3 {
    background: rgba(234, 179, 8, 0.2);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.4);
}

.noc-p-badge.p-p4 {
    background: rgba(2, 132, 199, 0.2);
    color: #7dd3fc;
    border: 1px solid rgba(2, 132, 199, 0.4);
}

@keyframes p1-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ── Chips e Tags ── */
.noc-pop-tag {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    color: var(--text-secondary, #cbd5e1);
}

.noc-if-tag {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10.5px;
    font-family: monospace;
}

.noc-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.noc-status-chip.open { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.noc-status-chip.investigating { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.noc-status-chip.mitigating { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.noc-status-chip.resolved { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.noc-status-chip.healthy { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.noc-status-chip.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.noc-status-chip.critical { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* ── Barras de Confiança ── */
.noc-conf-bar-bg {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.noc-conf-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ── Cards de Tráfego e POPs ── */
.noc-traffic-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.noc-badge-speed {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: monospace;
    color: var(--text-muted);
}

.noc-pop-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.noc-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.noc-status-indicator.healthy { background: #10b981; box-shadow: 0 0 6px #10b981; }
.noc-status-indicator.warning { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.noc-status-indicator.critical { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

/* ── Anomalias Preditivas ── */
.noc-pred-card {
    background: var(--card-bg, #111827);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.noc-pred-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.noc-horizon-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.noc-pred-evidence-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 10px 12px;
}

/* ── Modal de Investigação e RCA ── */
.noc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.noc-modal-content {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    width: 100%;
    max-width: 980px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.noc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.noc-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.noc-modal-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
}

.noc-detail-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 14px;
}

.noc-detail-card.highlight {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.2);
}

.noc-evidence-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
}
.noc-evidence-box.favorable { border-left: 3px solid #10b981; }
.noc-evidence-box.contrary { border-left: 3px solid #ef4444; }

.noc-diag-box {
    background: #050914;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 10px;
    font-family: monospace;
    font-size: 11px;
    color: #38bdf8;
    max-height: 140px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin: 0;
}

.noc-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.noc-mini-table th {
    text-align: left;
    padding: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.noc-mini-table td {
    padding: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.noc-sev-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.noc-sev-dot.critical { background: #ef4444; }
.noc-sev-dot.warning { background: #f59e0b; }
.noc-sev-dot.info { background: #3b82f6; }

/* ── Chat IA NOC ── */
.noc-chat-container {
    background: var(--card-bg, #111827);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    height: 580px;
    overflow: hidden;
}

.noc-chat-history {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.noc-chat-msg {
    display: flex;
    width: 100%;
}

.noc-chat-msg.user {
    justify-content: flex-end;
}

.noc-chat-msg.bot {
    justify-content: flex-start;
}

.noc-chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.noc-chat-msg.user .noc-chat-bubble {
    background: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.noc-chat-msg.bot .noc-chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

.noc-chat-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
}

.noc-chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.noc-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.noc-quick-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.noc-quick-btn:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: #3b82f6;
    color: #ffffff;
}

/* ── Modo Videowall (Telão 24/7) ── */
.noc-videowall-mode {
    position: fixed !important;
    inset: 0 !important;
    z-index: 10000 !important;
    padding: 24px !important;
    background: #050811 !important;
    overflow-y: auto !important;
}

.noc-videowall-mode .noc-kpi-val {
    font-size: 32px !important;
}

.noc-videowall-mode .noc-table th,
.noc-videowall-mode .noc-table td {
    padding: 16px 18px !important;
    font-size: 14px !important;
}

.noc-videowall-mode .noc-p-badge {
    font-size: 13px !important;
    padding: 4px 10px !important;
}

/* ── Responsividade ── */
@media (max-width: 900px) {
    .noc-modal-grid { grid-template-columns: 1fr; }
    .noc-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
