/* Modern Webhook Dashboard & Log Viewer CSS Design System */
:root {
  --bg-dark: #080c14;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --bg-panel: #0d1322;
  --bg-input: #172033;
  --border-color: #1e293d;
  --border-highlight: #334155;
  
  --accent-cyan: #00f2fe;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  
  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.15);
  --status-error: #ef4444;
  --status-error-bg: rgba(239, 68, 68, 0.15);
  --status-warn: #f59e0b;
  --status-warn-bg: rgba(245, 158, 11, 0.15);
  --status-info: #0ea5e9;
  --status-info-bg: rgba(14, 165, 233, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body.dark-theme {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* App Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* App Header */
.app-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  z-index: 10;
}

.header-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #080c14;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.branding-text h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.2;
}

.branding-text h1 .highlight {
  color: var(--accent-cyan);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-warn);
  transition: background-color 0.3s;
}

.status-indicator.connected .status-dot {
  background-color: var(--status-success);
  box-shadow: 0 0 10px var(--status-success);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Webhook URL Container */
.webhook-url-container {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 4px 6px 4px 14px;
  flex: 1;
  max-width: 580px;
  gap: 10px;
}

.url-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.url-input-group {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 6px;
}

.url-input-group input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 100%;
  outline: none;
}

.btn-icon-text {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-text:hover {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #080c14;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-highlight);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-dim);
}

.btn-danger-outline {
  background: transparent;
  color: var(--status-error);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger-outline:hover {
  background: var(--status-error-bg);
  border-color: var(--status-error);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.72rem;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.btn-xs:hover {
  color: #fff;
  border-color: var(--text-muted);
}

.btn-icon-only {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-icon-only:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.btn-icon-only.text-danger:hover {
  color: var(--status-error);
  background: var(--status-error-bg);
}

/* Metrics Bar */
.metrics-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon.total { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.metric-icon.success { background: var(--status-success-bg); color: var(--status-success); }
.metric-icon.error { background: var(--status-error-bg); color: var(--status-error); }
.metric-icon.rate { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); }

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Dashboard Main Split Container */
.dashboard-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar - Real-time Logs List */
.logs-sidebar {
  width: 380px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.live-pulse {
  background: var(--status-success-bg);
  color: var(--status-success);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  letter-spacing: 0.05em;
}

/* Filter Controls */
.filter-controls {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-dark);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 34px;
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--accent-cyan);
}

.filter-dropdowns {
  display: flex;
  gap: 8px;
}

.filter-dropdowns select {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
}

/* Log List Container */
.log-list-container {
  flex: 1;
  overflow-y: auto;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.78rem;
  line-height: 1.4;
}

/* Log Stream Entry Item */
.log-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.log-item:hover {
  background: var(--bg-card-hover);
}

.log-item.active {
  background: rgba(0, 242, 254, 0.06);
  border-left: 3px solid var(--accent-cyan);
}

.log-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.method-POST { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.method-GET { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.method-PUT { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.method-DELETE { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.method-PATCH { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.status-badge {
  font-size: 0.7rem;
}

.status-badge.s-2xx { background: var(--status-success-bg); color: var(--status-success); }
.status-badge.s-4xx, .status-badge.s-5xx { background: var(--status-error-bg); color: var(--status-error); }

.log-item-path {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Right Inspector Panel */
.inspector-panel {
  flex: 1;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.no-selection-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-dim);
  text-align: center;
}

.placeholder-content {
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.placeholder-content svg {
  color: var(--text-dim);
}

.placeholder-content h3 {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.placeholder-content p {
  font-size: 0.82rem;
  line-height: 1.5;
}

.log-detail-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.detail-header {
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-path {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metadata-row {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  gap: 24px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.meta-val {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.meta-val.code-font {
  font-family: var(--font-mono);
}

/* Tabs */
.inspector-tabs {
  display: flex;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* Tab Content */
.tab-content-wrapper {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
}

.tab-pane {
  display: none;
  height: 100%;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.code-format-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.code-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e2e8f0;
  overflow: auto;
  line-height: 1.5;
  flex: 1;
}

/* Syntax Highlighting */
.json-key { color: #38bdf8; }
.json-string { color: #4ade80; }
.json-number { color: #facc15; }
.json-boolean { color: #f472b6; }
.json-null { color: #94a3b8; }

/* Key Value Tables */
.table-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: left;
}

.kv-table th {
  background: var(--bg-panel);
  padding: 10px 16px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.kv-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
}

.kv-table td:first-child {
  color: var(--accent-cyan);
  width: 35%;
}

.kv-table td:last-child {
  color: var(--text-main);
  word-break: break-all;
}

/* Response Tab Summary */
.response-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.res-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.res-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.2s;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1rem;
  color: var(--text-main);
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-footer {
  padding: 14px 20px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-cyan);
}

.form-control.code-font {
  font-family: var(--font-mono);
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Test Option Cards */
.test-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.test-option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.test-option-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.test-option-card input {
  margin-top: 4px;
}

.option-content h4 {
  font-size: 0.85rem;
  color: var(--text-main);
  font-family: var(--font-mono);
  margin-bottom: 2px;
}

.option-content p {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.provider-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.provider-badge.stripe { background: #635bff; color: #fff; }
.provider-badge.github { background: #2da44e; color: #fff; }
.provider-badge.shop { background: #008060; color: #fff; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-left: 4px solid var(--accent-cyan);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  font-size: 0.82rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Utilities */
.hidden { display: none !important; }
.margin-top { margin-top: 12px; }
