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

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666;
  --border: #e5e5e5;
  --shadow: rgba(0, 0, 0, 0.06);
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --code-bg: #f4f4f5;
  --get: #22c55e;
  --post: #3b82f6;
  --put: #f59e0b;
  --patch: #eab308;
  --delete: #ef4444;
  --head: #8b5cf6;
  --options: #64748b;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-card: #171717;
  --text: #ededed;
  --text-secondary: #a1a1a1;
  --border: #2e2e2e;
  --shadow: rgba(0, 0, 0, 0.3);
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --code-bg: #1e1e1e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --bg-card: #171717;
    --text: #ededed;
    --text-secondary: #a1a1a1;
    --border: #2e2e2e;
    --shadow: rgba(0, 0, 0, 0.3);
    --accent: #818cf8;
    --accent-hover: #6366f1;
    --code-bg: #1e1e1e;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Theme toggle button */
.btn-theme {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 100;
  box-shadow: 0 1px 3px var(--shadow);
}

.btn-theme:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Landing */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.landing h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.landing h1 span {
  color: var(--accent);
}

.landing p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 480px;
  margin-bottom: 2rem;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Inspector */
.inspector {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.inspector-header {
  margin-bottom: 1.5rem;
}

.inspector-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.webhook-url-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.webhook-url {
  flex: 1;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.9rem;
  color: var(--accent);
  word-break: break-all;
  user-select: all;
}

.btn-copy {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-copy:hover {
  background: var(--accent-hover);
}

.status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-dot.disconnected {
  background: #ef4444;
  animation: none;
}

/* Request list */
.request-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-state p:first-child {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.curl-command {
  position: relative;
  display: inline-block;
  margin-top: 0.5rem;
}

.empty-state code {
  display: inline-block;
  background: var(--code-bg);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.btn-copy-curl {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-copy-curl:hover {
  color: var(--accent-hover);
}

.btn-copy-curl.copied {
  color: #22c55e;
}

/* Request card */
.request-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px var(--shadow);
  animation: slideIn 0.25s ease-out;
}

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

.request-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
}

.request-card-header:hover {
  background: var(--code-bg);
}

.method-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  font-family: "SF Mono", "Fira Code", monospace;
  min-width: 70px;
  text-align: center;
}

.method-GET { background: var(--get); }
.method-POST { background: var(--post); }
.method-PUT { background: var(--put); }
.method-PATCH { background: var(--patch); color: #1a1a1a; }
.method-DELETE { background: var(--delete); }
.method-HEAD { background: var(--head); }
.method-OPTIONS { background: var(--options); }

.request-meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.request-time {
  white-space: nowrap;
}

.request-size {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.75rem;
}

.expand-icon {
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: transform 0.2s;
}

.request-card.expanded .expand-icon {
  transform: rotate(90deg);
}

.request-card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 1rem;
}

.request-card.expanded .request-card-body {
  display: block;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  margin-top: 1rem;
}

.section-title:first-child {
  margin-top: 0;
}

.code-block {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.75rem;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.header-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: "SF Mono", "Fira Code", monospace;
}

.header-table td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.header-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
  color: var(--accent);
}

.header-table td:last-child {
  word-break: break-all;
}

.query-params {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.query-param {
  display: inline-flex;
  background: var(--code-bg);
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  overflow: hidden;
}

.query-param-key {
  padding: 0.2rem 0.4rem;
  font-weight: 600;
  color: var(--accent);
}

.query-param-value {
  padding: 0.2rem 0.4rem;
  border-left: 1px solid var(--border);
}

/* Back link */
.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* Info section */
.info-section {
  max-width: 900px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.info-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.info-card strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.info-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-brand {
  font-weight: 600;
  color: var(--text);
}

.footer-sep {
  margin: 0 0.5rem;
  opacity: 0.4;
}
