/* =====================================================
   LOG DETAIL POPUP DIALOG — BIZMETRY DESIGN SYSTEM
   Self-contained — no dependency on AgentLogsDialog.css
   ===================================================== */

/* ── Dialog shell ─────────────────────────────────── */
.log-popup-dialog {
  width: 90vw;
  max-width: 1050px;
  min-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px !important;
  overflow: hidden;
}

/* ── Toolbar ──────────────────────────────────────── */
.log-detail-toolbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18) !important;
  min-height: 72px !important;
  flex-shrink: 0 !important;
}

.log-detail-toolbar .md-toolbar-tools {
  padding: 0 20px !important;
  min-height: 72px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 14px !important;
}

.log-detail-toolbar .md-toolbar-tools>span[flex] {
  flex: 1 !important;
  min-width: 20px;
}

/* Colored icon halo */
.log-popup-toolbar-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.log-icon-wrap-fatal {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.3);
}

.log-icon-wrap-error {
  background: rgba(244, 67, 54, 0.3);
  border-color: rgba(244, 67, 54, 0.4);
}

.log-icon-wrap-warn {
  background: rgba(255, 152, 0, 0.3);
  border-color: rgba(255, 152, 0, 0.4);
}

.log-icon-wrap-info {
  background: rgba(33, 150, 243, 0.3);
  border-color: rgba(33, 150, 243, 0.4);
}

.log-icon-wrap-debug {
  background: rgba(156, 39, 176, 0.3);
  border-color: rgba(186, 104, 200, 0.4);
}

.log-icon-wrap-trace {
  background: rgba(158, 158, 158, 0.3);
  border-color: rgba(189, 189, 189, 0.4);
}

.log-detail-icon {
  color: white !important;
  font-size: 24px !important;
  width: 24px !important;
  height: 24px !important;
}

.log-detail-header-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.log-detail-header-info h2 {
  font-size: 17px;
  font-weight: 600;
  color: white;
  margin: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-popup-toolbar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 400;
  flex-wrap: wrap;
}

.log-popup-toolbar-dot {
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}

.log-popup-close-btn {
  color: rgba(255, 255, 255, 0.85) !important;
  margin: 0 !important;
  flex-shrink: 0;
}

.log-popup-close-btn:hover {
  color: white !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

/* ── Body layout ──────────────────────────────────── */
.log-popup-body {
  display: flex !important;
  flex-direction: row !important;
  flex: 1;
  overflow: hidden !important;
  padding: 0 !important;
  min-height: 0;
}

/* ── LEFT SIDEBAR ─────────────────────────────────── */
.log-popup-sidebar {
  width: 220px;
  min-width: 220px;
  background: #f5f4fb;
  border-right: 1px solid #e4e1f4;
  padding: 24px 20px 24px 20px !important;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.log-popup-sidebar::-webkit-scrollbar {
  width: 4px;
}

.log-popup-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.log-popup-sidebar::-webkit-scrollbar-thumb {
  background: #c5bfe8;
  border-radius: 2px;
}

.log-popup-sidebar-section {
  margin-bottom: 18px;
}

.log-popup-sidebar-section:first-child {
  margin-top: 4px;
}

.log-popup-sidebar-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9c8fc5;
  margin-bottom: 7px;
}

.log-popup-sidebar-divider {
  height: 1px;
  background: #ddd9f0;
  margin: 6px 0 20px;
}

/* Value row — centered icon + text */
.log-popup-sidebar-value {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #424242;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}

.log-popup-sidebar-value md-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  color: #9c8fc5 !important;
  flex-shrink: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  margin: 0 !important;
}

/* Mono variant — top-aligned for multi-line values */
.log-popup-sidebar-mono {
  align-items: flex-start;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #5c5c5c;
}

.log-popup-sidebar-mono md-icon {
  margin-top: 1px !important;
}

/* ── Severity pills (sidebar) ─────────────────────── */
.severity-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.severity-fatal {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef5350;
}

.severity-error {
  background: #ffebee;
  color: #d32f2f;
  border: 1px solid #e57373;
}

.severity-warn {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffb74d;
}

.severity-info {
  background: #e3f2fd;
  color: #1976d2;
  border: 1px solid #90caf9;
}

.severity-debug {
  background: #f3e5f5;
  color: #6a1b9a;
  border: 1px solid #ba68c8;
}

.severity-trace {
  background: #f5f5f5;
  color: #616161;
  border: 1px solid #9e9e9e;
}

/* ── RIGHT MAIN ───────────────────────────────────── */
.log-popup-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 28px 20px;
  background: #ffffff;
  overflow-y: auto;
  min-width: 0;
}

.log-popup-main::-webkit-scrollbar {
  width: 6px;
}

.log-popup-main::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 3px;
}

.log-popup-main::-webkit-scrollbar-thumb {
  background: #c5bfe8;
  border-radius: 3px;
}

.log-popup-main::-webkit-scrollbar-thumb:hover {
  background: #9e90d8;
}

/* Payload label */
.log-popup-message-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-size: 10px;
  color: #9c8fc5;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.log-popup-main {
  align-items: flex-start;
}

.log-popup-toolbar-icon-wrap {
  align-self: center;
}

.log-popup-message-label md-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  color: #9c8fc5 !important;
}

/* Dark console block */
.log-popup-console {
  flex: 1;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #1e293b;
  padding: 20px;
  overflow-y: auto;
  min-height: 200px;
  max-height: calc(88vh - 280px);
}

.log-popup-console::-webkit-scrollbar {
  width: 5px;
}

.log-popup-console::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 3px;
}

.log-popup-console::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}

.log-popup-console::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.log-popup-console pre {
  margin: 0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Actions bar ──────────────────────────────────── */
.log-popup-actions {
  padding: 12px 24px !important;
  background: #f5f4fb !important;
  border-top: 1px solid #e4e1f4 !important;
  display: flex !important;
  align-items: center !important;
  min-height: 56px !important;
}

.log-popup-actions-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #b0a8d4;
  font-style: italic;
}

.log-popup-actions-hint md-icon {
  font-size: 14px !important;
  width: 14px !important;
  height: 14px !important;
  color: #b0a8d4 !important;
}

.log-popup-btn-close {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  letter-spacing: 0.5px !important;
  border-radius: 4px !important;
  padding: 0 20px !important;
  height: 36px !important;
  min-width: 100px !important;
  text-transform: uppercase !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25) !important;
  transition: all 0.2s ease !important;
  margin: 0 !important;
}

.log-popup-btn-close md-icon {
  font-size: 16px !important;
  width: 16px !important;
  height: 16px !important;
  color: white !important;
}

.log-popup-btn-close:hover {
  box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4) !important;
  transform: translateY(-1px) !important;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 760px) {
  .log-popup-dialog {
    min-width: unset;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0 !important;
  }

  .log-popup-body {
    flex-direction: column !important;
  }

  .log-popup-sidebar {
    width: 100%;
    min-width: unset;
    border-right: none;
    border-bottom: 1px solid #e4e1f4;
    padding: 16px !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .log-popup-sidebar-section {
    margin-bottom: 0;
    min-width: 120px;
  }

  .log-popup-console {
    max-height: 300px;
  }
}

md-toolbar.log-detail-toolbar .md-toolbar-tools {
  justify-content: flex-start !important;
  display: flex !important;
  text-align: left !important;
}

.log-popup-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid #d4cef0;
  background: white;
  color: #9c8fc5;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.log-popup-copy-btn:hover {
  background: #f0ecff;
  border-color: #9c8fc5;
  color: #6b5ca5;
}

.log-popup-copy-btn md-icon {
  font-size: 13px !important;
  width: 13px !important;
  height: 13px !important;
  color: inherit !important;
  margin: 0 !important;
}

.log-popup-copy-btn--copied {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
  color: #16a34a !important;
}

/* ── FORCE LEFT ALIGNMENT — override Angular Material toolbar centering ── */
body md-dialog.log-popup-dialog md-toolbar.log-detail-toolbar .md-toolbar-tools {
  justify-content: flex-start !important;
  text-align: left !important;
}

body md-dialog.log-popup-dialog .log-detail-header-info {
  text-align: left !important;
  align-items: flex-start !important;
}

body md-dialog.log-popup-dialog .log-detail-header-info h2 {
  text-align: left !important;
}

body md-dialog.log-popup-dialog .log-popup-toolbar-meta {
  text-align: left !important;
  justify-content: flex-start !important;
}