/* ═══════════════════════════════════════════════════════════════
   NOC LOG PORTAL — PROFESSIONAL ISP MONITORING DASHBOARD
   Font: IBM Plex Mono + IBM Plex Sans
   Theme: Industrial dark, enterprise-grade
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

/* ─── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  --bg-base:       #0a0c0f;
  --bg-panel:      #0f1318;
  --bg-row:        #131820;
  --bg-row-alt:    #111519;
  --bg-header:     #0c1016;
  --border:        #1e2730;
  --border-light:  #243040;

  --text-primary:  #ccd6e0;
  --text-secondary:#7a8fa0;
  --text-dim:      #3d5060;
  --text-mono:     #b8c8d8;

  --accent-blue:   #1a8fff;
  --accent-cyan:   #00c3cc;

  --color-error:   #ff3d3d;
  --color-error-bg:#1f0808;
  --color-error-bd:#3d0f0f;

  --color-success:  #00d084;
  --color-success-bg:#061810;
  --color-success-bd:#0a3020;

  --color-warn:    #ff8c00;
  --color-warn-bg: #1a0e00;
  --color-warn-bd: #3a2000;

  --color-notice:  #f0c040;
  --color-notice-bg:#1a1400;
  --color-notice-bd:#352a00;

  --color-info:    #7a9ab8;

  --status-live:   #00ff88;

  --font-ui:   'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius:    3px;
  --row-h:     36px;
}

/* ─── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ─── LAYOUT ─────────────────────────────────────────────────── */
.noc-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ─── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0a3a6a 0%, #1a8fff 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  letter-spacing: -1px;
  font-family: var(--font-mono);
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

/* Live indicator */
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--status-live);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-live);
  box-shadow: 0 0 6px var(--status-live);
  animation: pulse 2s infinite;
}

.live-dot.paused {
  background: var(--text-dim);
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.server-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* ─── STAT BAR ───────────────────────────────────────────────── */
.stat-bar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.stat-chip:hover { border-color: var(--border-light); }
.stat-chip.active { border-color: currentColor; }

.stat-chip.all      { color: var(--text-secondary); }
.stat-chip.c-error  { color: var(--color-error);   }
.stat-chip.c-success{ color: var(--color-success); }
.stat-chip.c-warn   { color: var(--color-warn);    }
.stat-chip.c-notice { color: var(--color-notice);  }
.stat-chip.c-info   { color: var(--color-info);    }

.stat-chip.all.active      { background: rgba(122,143,160,0.08); }
.stat-chip.c-error.active  { background: var(--color-error-bg);   border-color: var(--color-error-bd); }
.stat-chip.c-success.active{ background: var(--color-success-bg); border-color: var(--color-success-bd); }
.stat-chip.c-warn.active   { background: var(--color-warn-bg);    border-color: var(--color-warn-bd); }
.stat-chip.c-notice.active { background: var(--color-notice-bg);  border-color: var(--color-notice-bd); }

.stat-chip .s-label { font-size: 10px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-chip .s-count { font-weight: 600; font-size: 13px; }

.stat-sep {
  flex: 1;
}

/* ─── TOOLBAR ────────────────────────────────────────────────── */
.toolbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  height: 26px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 0 8px 0 28px;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus { border-color: var(--accent-blue); }
.search-box input::placeholder { color: var(--text-dim); }

.search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 11px;
  pointer-events: none;
}

.btn {
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn:hover {
  background: var(--border);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn.active, .btn.btn-pause.paused {
  background: rgba(26,143,255,0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn.btn-clear:hover {
  background: rgba(255,61,61,0.08);
  border-color: var(--color-error-bd);
  color: var(--color-error);
}

.btn-icon { font-size: 12px; }

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.log-count-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── LOG TABLE CONTAINER ────────────────────────────────────── */
.log-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--bg-base);
  position: relative;
}

/* Custom scrollbar */
.log-container::-webkit-scrollbar { width: 6px; height: 6px; }
.log-container::-webkit-scrollbar-track { background: var(--bg-base); }
.log-container::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.log-container::-webkit-scrollbar-thumb:hover { background: #304050; }

/* ─── LOG TABLE ──────────────────────────────────────────────── */
.log-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  table-layout: fixed;
}

.log-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-panel);
}

.log-table thead th {
  padding: 0 10px;
  height: 28px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.col-ts     { width: 148px; }
.col-lvl    { width: 82px; }
.col-router { width: 130px; }
.col-msg    { width: auto; }

.log-table tbody tr {
  border-bottom: 1px solid var(--border);
  height: var(--row-h);
  transition: background 0.1s;
}

.log-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.log-table tbody tr:hover            { background: var(--bg-row); }

.log-table tbody td {
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* New row highlight animation */
@keyframes rowIn {
  from { background: rgba(26,143,255,0.12); }
  to   { background: transparent; }
}

.log-table tbody tr.row-new {
  animation: rowIn 1.2s ease-out forwards;
}

/* Timestamps */
.td-ts {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.03em;
}

/* Level badges */
.lvl-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.lvl-error   { color: var(--color-error);   background: var(--color-error-bg);   border-color: var(--color-error-bd); }
.lvl-success { color: var(--color-success); background: var(--color-success-bg); border-color: var(--color-success-bd); }
.lvl-warn    { color: var(--color-warn);    background: var(--color-warn-bg);    border-color: var(--color-warn-bd); }
.lvl-notice  { color: var(--color-notice);  background: var(--color-notice-bg);  border-color: var(--color-notice-bd); }
.lvl-info    { color: var(--color-info);    background: rgba(122,154,184,0.06);  border-color: rgba(122,154,184,0.15); }

/* Message colors */
tr.lvl-error-row   .td-msg { color: #ff9090; }
tr.lvl-success-row .td-msg { color: #80f0c0; }
tr.lvl-warn-row    .td-msg { color: #ffba60; }
tr.lvl-notice-row  .td-msg { color: #f0d080; }
tr.lvl-info-row    .td-msg { color: var(--text-mono); }

.td-router {
  color: var(--accent-cyan);
  font-size: 11px;
}

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 10px;
}

.empty-icon {
  font-size: 32px;
  opacity: 0.15;
}

.empty-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* ─── STATUS BAR ─────────────────────────────────────────────── */
.statusbar {
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 0 16px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.sb-item .sb-val {
  color: var(--text-secondary);
}

.sb-conn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: auto;
}

.sb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-live);
}

.sb-dot.offline { background: var(--color-error); }

.sb-conn-text { color: var(--text-dim); }

/* ─── TOAST NOTIFICATIONS ────────────────────────────────────── */
.toast-area {
  position: fixed;
  bottom: 40px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  animation: toastIn 0.2s ease-out;
  pointer-events: all;
}

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

/* ─── SCROLL TO BOTTOM FAB ───────────────────────────────────── */
.scroll-fab {
  position: fixed;
  bottom: 44px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}

.scroll-fab.visible {
  opacity: 1;
  pointer-events: all;
}

.scroll-fab:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* ─── AUTOSCROLL TOGGLE ──────────────────────────────────────── */
.autoscroll-btn.active {
  background: rgba(0,208,132,0.08);
  border-color: rgba(0,208,132,0.3);
  color: var(--color-success);
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .brand-sub { display: none; }
  .col-router { width: 90px; }
  .col-ts { width: 110px; }
  .col-lvl { width: 70px; }

  .toolbar { flex-wrap: wrap; height: auto; padding: 6px 12px; gap: 6px; }
  .search-box { max-width: 100%; }
  .toolbar-right { margin-left: 0; }

  .stat-bar { overflow-x: auto; }
  .stat-bar::-webkit-scrollbar { display: none; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .server-time { display: none; }
  .col-router { display: none; }
}
