/* adlog - application styles */

:root {
  --bg: #ffffff;
  --bg-surface: #f6f8fa;
  --bg-card: #f0f2f5;
  --bg-input: #ffffff;
  --border: #d1d9e0;
  --border-light: #e8ecf0;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-subtle: #8b949e;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --green: #1a7f37;
  --red: #cf222e;
  --orange: #9a6700;
  --purple: #8250df;
  --pink: #bf3989;
  --cyan: #0e7490;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 8px;
  --radius-sm: 6px;
}

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

body {
  font-family: var(--font-sans);
  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; }

/* Layout */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* Header / Nav */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.site-header .logo:hover { color: var(--accent); text-decoration: none; }
.site-header nav { display: flex; gap: 1rem; align-items: center; }
.site-header nav a { color: var(--text-muted); font-size: 0.875rem; }
.site-header nav a:hover { color: var(--text); text-decoration: none; }

.main-content { padding: 2rem 0; }

/* Flash messages */
.flash { padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; font-size: 0.875rem; }
.flash-notice { background: #ddf4ff; border: 1px solid #a8d8f0; color: #0550ae; }
.flash-alert { background: #ffebe9; border: 1px solid #f5c6c6; color: #cf222e; }

/* Page titles */
h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
h2 { font-size: 1.15rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem; color: var(--text); }
h3 { font-size: 1rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--text-muted); }

/* Breadcrumbs / subtitle */
.subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }
.subtitle a { color: var(--text-muted); }
.subtitle a:hover { color: var(--accent); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tbody tr:hover { background: var(--bg-surface); }

/* Type badges */
.badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}
.badge-text { background: #eef1f5; color: var(--text-muted); }
.badge-gha { background: #dafbe1; color: var(--green); }
.badge-claude-code { background: #eddeff; color: var(--purple); }
.badge-slack { background: #fff3cd; color: var(--orange); }

/* Tags */
.tag {
  display: inline-block;
  padding: 0.1em 0.45em;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--bg-input);
  color: var(--text-muted);
  margin-right: 0.3em;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
input[type="text"], select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  width: 100%;
  max-width: 400px;
  font-family: var(--font-sans);
}
input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9,105,218,0.15);
}
select { appearance: auto; }

.btn, input[type="submit"] {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font-sans);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover, input[type="submit"]:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
  text-decoration: none;
}
.btn-primary, input[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover, input[type="submit"]:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-danger {
  color: var(--red);
  border-color: #f5c6c6;
}
.btn-danger:hover { background: #ffebe9; }

/* Search */
.search-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.search-box input[type="text"] { flex: 1; max-width: none; }

/* Search results */
.search-result {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.search-result:hover { border-color: var(--text-subtle); }
.search-result mark { background: #fff3b0; color: #1f2328; padding: 0.1em 0.2em; border-radius: 2px; }
.search-result .meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.search-result .snippet { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

/* Entry detail */
.entry-header { margin-bottom: 1.5rem; }
.entry-meta { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.3rem; }
.entry-meta a { color: var(--text-muted); }

/* Code / text view */
.code-view {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
}
.code-view pre {
  margin: 0;
  padding: 1rem;
  font-family: var(--font-mono);
}
.code-view .line-num {
  color: var(--text-subtle);
  text-decoration: none;
  user-select: none;
  display: inline-block;
  width: 3.5em;
  text-align: right;
  margin-right: 1em;
}
.code-view .line-num:hover { color: var(--accent); }

/* GHA log view (always dark, terminal-style) */
.gha-view {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}
.gha-view pre { margin: 0; padding: 1rem; font-family: var(--font-mono); color: #d4d4d4; }
.gha-view .line-num {
  color: #484f58;
  text-decoration: none;
  user-select: none;
  display: inline-block;
  width: 3.5em;
  text-align: right;
  margin-right: 1em;
}
.gha-view .line-num:hover { color: #58a6ff; }
.gha-view details { margin: 0.25em 0; }
.gha-view summary { cursor: pointer; color: #76e3ea; }

/* Claude Code view */
.cc-view { max-width: 800px; }
.cc-message {
  margin: 0.75rem 0;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.cc-message-user { background: #ddf4ff; border-color: #a8d8f0; }
.cc-message-assistant { background: #dafbe1; border-color: #a7ddb4; }
.cc-message-system { background: var(--bg-surface); font-size: 0.85em; color: var(--text-muted); }
.cc-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.cc-role-user { color: var(--accent); }
.cc-role-assistant { color: var(--green); }
.cc-role-system { color: var(--text-subtle); }
.cc-model {
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--text-subtle);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 0.5rem;
}
.cc-content { white-space: pre-wrap; word-break: break-word; line-height: 1.6; }

/* Tool calls */
.cc-tool-call, .cc-tool-result, .cc-thinking {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.cc-tool-call summary, .cc-tool-result summary, .cc-thinking summary {
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.cc-tool-call summary code { background: var(--bg-card); padding: 0.1em 0.4em; border-radius: 3px; }
.cc-tool-file {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin: 0.3rem 0;
}
.cc-tool-output {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 0.5em 0.75em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0.3rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.cc-thinking-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 0.5rem 0;
}

/* Legacy (unused, keep for compat) */
.cc-tool-calls {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.cc-tool-calls summary { cursor: pointer; color: var(--text-subtle); }
.cc-tool-calls pre {
  background: var(--bg-input);
  padding: 0.5em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-top: 0.3em;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* Slack view */
.slack-view { max-width: 700px; }
.slack-msg { padding: 0.3rem 0 0.3rem 0.75rem; }
.slack-msg-header { margin-top: 0.75rem; }
.slack-user { font-weight: 700; color: var(--text); }
.slack-ts { font-size: 0.75rem; color: var(--text-subtle); margin-left: 0.5rem; }
.slack-text { color: var(--text-muted); line-height: 1.5; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* Hero (home page) */
.hero {
  text-align: center;
  padding: 6rem 1rem 4rem;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}
.hero p { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 2rem; }
.hero .actions { display: flex; gap: 1rem; justify-content: center; }

/* Forms inline */
.form-row { display: flex; gap: 0.75rem; align-items: end; flex-wrap: wrap; }
.form-row .form-group { margin-bottom: 0; }

/* Responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .form-row { flex-direction: column; }
  input[type="text"], select { max-width: none; }
}
