/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: #e94560;
  letter-spacing: 0.5px;
}

#create-btn {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

#create-btn:hover { background: #d63050; }

/* Layout */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 250px;
  min-width: 250px;
  background: #16213e;
  border-right: 1px solid #0f3460;
  overflow-y: auto;
}

#endpoint-list {
  display: flex;
  flex-direction: column;
}

.endpoint-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(15, 52, 96, 0.5);
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13px;
}

.endpoint-item:hover { background: rgba(233, 69, 96, 0.08); }
.endpoint-item.active { background: rgba(233, 69, 96, 0.15); border-left: 3px solid #e94560; }

.endpoint-item .name { font-weight: 500; color: #f0f0f0; }
.endpoint-item .id {
  font-size: 11px;
  color: #666;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  margin-top: 3px;
}

/* Main */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#no-selection {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #555;
  font-size: 14px;
}

.hidden { display: none !important; }

/* Endpoint Header */
.endpoint-header { margin-bottom: 20px; }

.endpoint-title {
  font-size: 18px;
  font-weight: 600;
  color: #f0f0f0;
}

.endpoint-id-badge {
  font-size: 11px;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  color: #888;
  margin-left: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 3px;
}

.endpoint-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.endpoint-url-row code {
  flex: 1;
  background: #0d1b2a;
  border: 1px solid #0f3460;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: #7ec8e3;
  overflow-x: auto;
  white-space: nowrap;
}

#copy-url-btn {
  background: #0f3460;
  color: #ccc;
  border: 1px solid #1a4a7a;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

#copy-url-btn:hover { background: #1a4a7a; color: #fff; }

.danger-btn {
  margin-top: 10px;
  background: transparent;
  color: #e94560;
  border: 1px solid #e94560;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.danger-btn:hover { background: #e94560; color: #fff; }

/* Event List */
#event-list { display: flex; flex-direction: column; gap: 6px; }

.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  font-size: 13px;
}

.event-row:hover {
  border-color: #1a4a7a;
  background: #1a2744;
}

/* Method Badges */
.method-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  min-width: 56px;
  text-align: center;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
}

.method-GET    { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.method-POST   { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.method-PUT    { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.method-DELETE  { background: rgba(233, 69, 96, 0.15);  color: #e94560; }
.method-PATCH  { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.method-HEAD   { background: rgba(149, 165, 166, 0.15); color: #95a5a6; }

.event-path {
  flex: 1;
  color: #bbb;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-time {
  color: #555;
  font-size: 11px;
  white-space: nowrap;
}

/* Event Detail Overlay */
#event-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

#event-detail {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

#event-detail h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #f0f0f0;
}

#close-detail {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

#close-detail:hover { color: #fff; }

#detail-content {
  font-size: 13px;
  line-height: 1.6;
}

#detail-content pre {
  background: #0d1b2a;
  border: 1px solid #0f3460;
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: #ccc;
  margin: 8px 0;
}

#detail-content .detail-section {
  margin-bottom: 16px;
}

#detail-content .detail-label {
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* JSON Syntax Highlighting */
.json-key { color: #e94560; }
.json-string { color: #2ecc71; }
.json-number { color: #f39c12; }
.json-boolean { color: #3498db; }
.json-null { color: #95a5a6; }

/* Key-Value Tables */
.kv-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.kv-table td { padding: 4px 10px; border-bottom: 1px solid rgba(15, 52, 96, 0.5); font-size: 12px; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace; }
.kv-table td:first-child { color: #e94560; white-space: nowrap; width: 1%; }

/* Empty State */
.empty-state { color: #555; font-size: 13px; padding: 12px 0; }

/* Event row details */
.event-ip { color: #666; font-size: 11px; white-space: nowrap; }
.event-body-preview { color: #888; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #0f3460; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #1a4a7a; }

/* Responsive */
@media (max-width: 700px) {
  .layout { flex-direction: column; }
  #sidebar { width: 100%; min-width: 100%; max-height: 150px; border-right: none; border-bottom: 1px solid #0f3460; }
  #event-detail { width: 95%; padding: 16px; }
}
