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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
.entity-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #aaa;
}
.entity-filter select {
  background: #111827;
  color: #e5e7eb;
  border-radius: 4px;
  border: 1px solid #374151;
  padding: 4px 8px;
  font-size: 0.8rem;
}
  padding: 20px;
}

header {
  display: flex;
  cursor: pointer;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 8px;
  border-bottom: 1px solid #333;
}
.entity-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: #e5e7eb;
}
.item-count {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 999px;
  background: #111827;
  color: #9ca3af;
}

h1 {
  font-size: 1.5rem;
  font-weight: 500;
}

.controls {
  display: flex;
.log-body.collapsed {
  display: none;
}
  gap: 15px;
  align-items: center;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #888;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dc3545;
}

.status-dot.connected {
  background: #28a745;
}

.clear-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.clear-btn:hover {
  background: #c82333;
}

.clear-btn:disabled {
  background: #555;
}

.danger-btn {
  background: #dc3545;
  color: white;
  border: 2px solid #c82333;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.danger-btn:hover {
  background: #bd2130;
  border-color: #a71d2a;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

.danger-btn:active {
  transform: translateY(0);
}

.danger-btn:disabled {
  background: #555;
  border-color: #444;
  cursor: not-allowed;
  opacity: 0.6;
}

.count {
  font-size: 0.85rem;
  color: #888;
}

.view-toggle {
  display: flex;
  gap: 5px;
}

.view-btn {
  background: #333;
  color: #888;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.view-btn.active {
  background: #0f3460;
  color: #fff;
}

.view-btn:hover {
  background: #444;
}

.view-btn.active:hover {
  background: #0f3460;
}

/* Grouped view styles */
.groups-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 20px;
}

.entity-group {
  background: #16213e;
  border-radius: 8px;
  overflow: hidden;
}

.group-header {
  background: #0f3460;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.group-header:hover {
  background: #1a4a7a;
}

.group-title {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-icon {
  font-size: 1.1rem;
}

.group-badge {
  background: #e94560;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.group-new-badge {
  background: #28a745;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

.entity-group.has-new {
  box-shadow: 0 0 0 2px #28a745;
}

@keyframes borderPulse {
  0%, 100% { box-shadow: 0 0 0 2px #28a745; }
  50% { box-shadow: 0 0 8px 2px #28a745; }
}

.group-entries {
  max-height: 400px;
  overflow-y: auto;
}

.group-entries.collapsed {
  display: none;
}

.log-entry.new-entry {
  animation: highlightNew 3s ease-out;
}

@keyframes highlightNew {
  0% { background: #28a745; }
  100% { background: #16213e; }
}

.mark-seen-btn {
  background: transparent;
  border: 1px solid #28a745;
  color: #28a745;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 8px;
}

.mark-seen-btn:hover {
  background: #28a745;
  color: white;
}

/* Timeline view styles */
#timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-entry {
  background: #16213e;
  border-radius: 8px;
  padding: 15px;
  border-left: 4px solid #0f3460;
  animation: fadeIn 0.3s ease;
}

.group-entries .log-entry {
  border-radius: 0;
  border-left: none;
  border-bottom: 1px solid #0d1b2a;
  padding: 12px 15px;
  animation: none;
}

.group-entries .log-entry:last-child {
  border-bottom: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.log-meta {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dlq-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.method {
  background: #0f3460;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.method.POST { background: #28a745; }
.method.GET { background: #007bff; }
.method.DELETE { background: #dc3545; }
.method.PUT { background: #fd7e14; }

.country-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
  margin-left: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.path {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.9rem;
  color: #e94560;
}

.timestamp {
  font-size: 0.75rem;
  color: #666;
}

.status-code {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: #333;
}

.status-code.success { background: #28a745; }
.status-code.error { background: #dc3545; }
.status-code.partial { background: #fd7e14; }

.log-body {
  background: #0d1b2a;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

.log-body pre {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #a8d8ea;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state p {
  margin-top: 10px;
  font-size: 0.9rem;
}

/* Metrics View Styles */
.metrics-container {
  padding: 20px;
}

.metrics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.metrics-header h2 {
  font-size: 1.5rem;
  color: #e5e7eb;
}

.metrics-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.metrics-timestamp {
  font-size: 0.85rem;
  color: #888;
}

.metrics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.metric-card {
  background: #0f3460;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.metric-label {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: #28a745;
}

.metric-value.error {
  color: #dc3545;
}

.metric-value.warning {
  color: #ffc107;
}

.metrics-filter {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.metrics-filter input,
.metrics-filter select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #374151;
  background: #111827;
  color: #e5e7eb;
  font-size: 0.9rem;
}

.metrics-filter input {
  flex: 1;
}

.metrics-filter input::placeholder {
  color: #6b7280;
}

#metricsTableContainer {
  overflow-x: auto;
  background: #0f3460;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.metrics-table thead {
  background: #1a1a2e;
  position: sticky;
  top: 0;
  z-index: 10;
}

.metrics-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #e5e7eb;
  border-bottom: 2px solid #374151;
  cursor: pointer;
  user-select: none;
}

.metrics-table th:hover {
  background: #0f3460;
}

.metrics-table th .sort-icon {
  margin-left: 5px;
  opacity: 0.5;
}

.metrics-table tbody tr {
  border-bottom: 1px solid #374151;
  transition: background 0.2s;
}

.metrics-table tbody tr:hover {
  background: #16213e;
}

.metrics-table td {
  padding: 12px 15px;
  color: #d1d5db;
}

.metrics-table td.empty-state {
  text-align: center;
  padding: 40px;
  color: #6b7280;
}

.health-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.health-badge.healthy {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
  border: 1px solid #28a745;
}

.health-badge.unhealthy {
  background: rgba(220, 53, 69, 0.2);
  color: #dc3545;
  border: 1px solid #dc3545;
}

.metrics-table .number {
  font-family: 'Monaco', 'Menlo', monospace;
  text-align: right;
}

.metrics-table .error-count {
  color: #dc3545;
  font-weight: 600;
}
