/* =====================================================
   AGENT LOGS DIALOG — BizMetry Design System
   Prefix: ald-
   ===================================================== */

/* ─── Tokens ─────────────────────────────────────── */
.ald-dialog {
  --ald-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --ald-primary: #667eea;
  --ald-shadow-sm: 0 2px 6px rgba(102, 126, 234, 0.18);
  --ald-shadow-md: 0 4px 14px rgba(102, 126, 234, 0.28);
  --ald-text: #1e2535;
  --ald-text-muted: #6b7494;
  --ald-text-faint: #9aa0b8;
  --ald-border: #e8eaf0;
  --ald-bg-canvas: #f0f2f7;
  --ald-bg-white: #ffffff;
  --ald-bg-section: #f7f8fc;
  --ald-r-dialog: 14px;
  --ald-r-card: 10px;
  --ald-r-btn: 8px;
  --ald-ease: all 0.2s ease;

  width: 98vw !important;
  max-width: 1800px !important;
  height: 92vh !important;
  max-height: 92vh !important;
  border-radius: var(--ald-r-dialog) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22) !important;
}

/* ─── Toolbar ────────────────────────────────────── */
.ald-toolbar {
  background: var(--ald-gradient) !important;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3) !important;
  min-height: 68px !important;
  flex-shrink: 0 !important;
}

.ald-toolbar-tools {
  padding: 0 20px !important;
  min-height: 68px !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px;
}

.ald-toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ald-toolbar-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ald-toolbar-icon-wrap md-icon {
  font-size: 22px !important;
  width: 22px !important;
  height: 22px !important;
  color: white !important;
}

.ald-toolbar-title {
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.ald-toolbar-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin: 2px 0 0;
}

.ald-refreshing-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.ald-refreshing-spinner circle {
  stroke: white !important;
}

.ald-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.ald-status-badge md-icon {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  color: inherit !important;
}

.ald-status-online {
  background: rgba(76, 175, 80, 0.22);
  color: #c8e6c9;
  border: 1px solid rgba(200, 230, 201, 0.3);
}

.ald-status-offline {
  background: rgba(244, 67, 54, 0.22);
  color: #ffcdd2;
  border: 1px solid rgba(255, 205, 210, 0.3);
}

.ald-close-btn {
  color: rgba(255, 255, 255, 0.8) !important;
  transition: var(--ald-ease) !important;
}

.ald-close-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}

.ald-close-btn md-icon {
  color: inherit !important;
}

/* ─── Content ────────────────────────────────────── */
.ald-content {
  background: var(--ald-bg-canvas) !important;
  padding: 0 !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

/* ─── Controls bar ───────────────────────────────── */
.ald-controls-wrap {
  padding: 16px 20px 0;
  flex-shrink: 0;
}

.ald-controls-card {
  background: var(--ald-bg-white);
  border-radius: var(--ald-r-card);
  border: 1px solid var(--ald-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  margin-bottom: 16px;
}

/* Section header shared with other dialogs */
.ald-section-header {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 9px;
  padding: 11px 16px;
  background: var(--ald-bg-section);
  border-bottom: 1px solid var(--ald-border);
  position: relative;
}

.ald-section-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ald-gradient);
}

.ald-section-header md-icon {
  font-size: 16px !important;
  width: 16px !important;
  height: 16px !important;
  color: var(--ald-primary) !important;
  flex-shrink: 0;
}

.ald-section-header>span {
  font-size: 11px;
  font-weight: 700;
  color: #5a6080;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex: 1;
}

.ald-section-count {
  font-size: 11px !important;
  font-weight: 700 !important;
  background: rgba(102, 126, 234, 0.1);
  color: var(--ald-primary) !important;
  padding: 2px 10px;
  border-radius: 10px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  flex: 0 0 auto !important;
}

/* ─── Controls row ───────────────────────────────── */
.ald-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f2f4f9;
}

.ald-ctrl-sep {
  width: 1px;
  height: 32px;
  background: var(--ald-border);
  flex-shrink: 0;
}

.ald-ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ald-ctrl-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ald-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Native selects ─────────────────────────────── */
.ald-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ald-select {
  appearance: none;
  height: 34px;
  padding: 0 30px 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ald-text);
  background: #f5f6fa;
  border: 1px solid var(--ald-border);
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: var(--ald-ease);
  min-width: 130px;
}

.ald-select:hover {
  background: #eef0f7;
  border-color: #c5c9d6;
}

.ald-select:focus {
  background: white;
  border-color: var(--ald-primary);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.12);
}

.ald-select-sm {
  min-width: 80px;
}

.ald-select-caret {
  position: absolute;
  right: 6px;
  pointer-events: none;
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
  color: var(--ald-text-faint) !important;
}

/* ─── Pagination ─────────────────────────────────── */
.ald-pagination-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ald-page-btn {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: white !important;
  border: 1px solid var(--ald-border) !important;
  border-radius: 6px !important;
  transition: var(--ald-ease) !important;
}

.ald-page-btn md-icon {
  font-size: 22px !important;
  width: 22px !important;
  height: 22px !important;
  color: var(--ald-primary) !important;
}

.ald-page-btn:not([disabled]):hover {
  background: var(--ald-gradient) !important;
  border-color: transparent !important;
  box-shadow: var(--ald-shadow-sm) !important;
}

.ald-page-btn:not([disabled]):hover md-icon {
  color: white !important;
}

.ald-page-btn[disabled] {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}

.ald-page-badge {
  background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
  color: var(--ald-primary);
  border: 1px solid #e8ecff;
  border-radius: 6px;
  padding: 0 16px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  min-width: 120px;
  justify-content: center;
  white-space: nowrap;
}

/* ─── Search ─────────────────────────────────────── */
.ald-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.ald-search-icon {
  position: absolute;
  left: 10px;
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  color: var(--ald-text-faint) !important;
  pointer-events: none;
}

.ald-search-input {
  width: 100%;
  height: 34px;
  padding: 0 32px 0 34px;
  font-size: 13px;
  color: var(--ald-text);
  background: #f5f6fa;
  border: 1px solid var(--ald-border);
  border-radius: 6px;
  outline: none;
  transition: var(--ald-ease);
}

.ald-search-input::placeholder {
  color: var(--ald-text-faint);
}

.ald-search-input:focus {
  background: white;
  border-color: var(--ald-primary);
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.12);
}

.ald-search-clear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: var(--ald-ease);
}

.ald-search-clear:hover {
  background: rgba(0, 0, 0, 0.08);
}

.ald-search-clear md-icon {
  font-size: 14px !important;
  width: 14px !important;
  height: 14px !important;
  color: var(--ald-text-faint) !important;
}

/* ─── Live tail switch ───────────────────────────── */
.ald-switch {
  margin: 0 !important;
}

.ald-switch.md-checked .md-thumb {
  background-color: var(--ald-primary) !important;
}

.ald-switch.md-checked .md-bar {
  background-color: rgba(102, 126, 234, 0.4) !important;
}

/* ─── Summary row ────────────────────────────────── */
.ald-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.ald-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}

.ald-chip md-icon {
  font-size: 14px !important;
  width: 14px !important;
  height: 14px !important;
  color: currentColor !important;
}

.ald-chip--blue {
  background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
  color: var(--ald-primary);
  border-color: #e8ecff;
}

.ald-chip--orange {
  background: linear-gradient(135deg, #fff8f0, #fff3e8);
  color: #f57c00;
  border-color: #ffe0b2;
}

.ald-chip--green {
  background: linear-gradient(135deg, #f0f9f4, #e8f5ed);
  color: #388e3c;
  border-color: #c8e6c9;
}

/* ─── Buttons ────────────────────────────────────── */
.ald-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px;
  padding: 0 18px !important;
  height: 34px !important;
  border-radius: var(--ald-r-btn) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  transition: var(--ald-ease) !important;
  margin: 0 !important;
  white-space: nowrap;
}

.ald-btn md-icon {
  font-size: 17px !important;
  width: 17px !important;
  height: 17px !important;
  margin: 0 !important;
  color: inherit !important;
}

.ald-btn--primary {
  background: var(--ald-gradient) !important;
  color: white !important;
  border: none !important;
  box-shadow: var(--ald-shadow-sm) !important;
}

.ald-btn--primary:hover:not([disabled]) {
  box-shadow: var(--ald-shadow-md) !important;
  transform: translateY(-1px) !important;
}

.ald-btn--ghost {
  background: white !important;
  color: var(--ald-text-muted) !important;
  border: 1px solid var(--ald-border) !important;
}

.ald-btn--ghost:hover:not([disabled]) {
  background: #f0f2f7 !important;
  border-color: #c5c9d6 !important;
}

.ald-btn[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* ─── Card ───────────────────────────────────────── */
.ald-card {
  background: var(--ald-bg-white);
  border-radius: var(--ald-r-card);
  border: 1px solid var(--ald-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

/* ─── Table wrapper ──────────────────────────────── */
.ald-table-wrap {
  flex: 1 1 0;
  min-height: 0;
  padding: 0 20px 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ald-table-wrap .ald-card {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.ald-table-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}

.ald-table-scroll::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.ald-table-scroll::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}

.ald-table-scroll::-webkit-scrollbar-thumb {
  background: #c5c9d6;
  border-radius: 4px;
}

.ald-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #a8adb8;
}

/* ─── Table ──────────────────────────────────────── */
.ald-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

.ald-th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #5a6080;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--ald-border);
  white-space: nowrap;
  background: var(--ald-bg-section);
  position: sticky;
  top: 0;
  z-index: 5;
}

.ald-th--ts {
  width: 190px;
}

.ald-th--sev {
  width: 100px;
}

.ald-th--inst {
  width: 150px;
}

.ald-th--mod {
  width: 220px;
}

.ald-th--thr {
  width: 130px;
}

.ald-th--msg {
  min-width: 380px;
}

.ald-td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f2f4f9;
  font-size: 13px;
  color: var(--ald-text);
}

.ald-td--ts {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--ald-text);
  white-space: nowrap;
}

.ald-td--inst {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--ald-text);
  white-space: nowrap;
}

.ald-td--mod {
  font-size: 12px;
  color: var(--ald-text-muted);
}

.ald-td--thr {
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--ald-text-faint);
  font-weight: 600;
}

.ald-td--msg {
  line-height: 1.5;
}

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

.ald-row:hover {
  background: #f5f4ff !important;
}

.ald-row:last-child .ald-td {
  border-bottom: none;
}

/* Row tinting by level */
.ald-row--fatal {
  background: #fff5f5;
}

.ald-row--error {
  background: #fff8f8;
}

.ald-row--warn {
  background: #fffbf5;
}

.ald-row--info {
  background: #f5f9ff;
}

.ald-row--debug {
  background: #faf5ff;
}

.ald-row--trace {
  background: var(--ald-bg-white);
}

/* ─── Severity badges ────────────────────────────── */
.ald-severity {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

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

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

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

.ald-severity--info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

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

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

/* ─── Empty state ────────────────────────────────── */
.ald-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
  flex: 1 1 auto;
}

.ald-empty-icon {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  animation: aldPulse 2.2s ease-in-out infinite;
}

.ald-empty-icon md-icon {
  font-size: 56px !important;
  width: 56px !important;
  height: 56px !important;
  color: var(--ald-primary) !important;
}

.ald-empty-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ald-text);
  margin: 0 0 12px;
}

.ald-empty-desc {
  font-size: 14px;
  color: var(--ald-text-muted);
  line-height: 1.6;
  max-width: 480px;
  margin: 0;
}

/* ─── Animations ─────────────────────────────────── */
@keyframes aldPulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.18);
  }
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 1024px) {
  .ald-ctrl-sep {
    display: none;
  }

  .ald-search-wrap {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .ald-dialog {
    width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }

  .ald-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .ald-search-wrap {
    max-width: 100%;
  }

  .ald-btn {
    width: 100%;
    justify-content: center;
  }
}