/* === Shared styles for Reverser === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0c0c1d;
  color: #c8c8d8;
  min-height: 100vh;
}

/* === Nav bar === */
nav.main-nav {
  display: flex;
  align-items: center;
  padding: 0 2rem;
  height: 48px;
  background: #111128;
  border-bottom: 1px solid #1e1e3a;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-brand span { color: #e94560; }

.nav-links {
  display: flex;
  align-items: center;
  margin-left: 2.5rem;
  gap: 0.25rem;
}
.nav-links a {
  color: #666;
  text-decoration: none;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-links a:hover { color: #c8c8d8; background: #1a1a3a; }
.nav-links a.active { color: #fff; background: #1e1e3e; }

.nav-spacer { flex: 1; }

.nav-action {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-action:hover { background: #d63550; transform: translateY(-1px); }

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* === Info pills === */
.info-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.pill {
  background: #1a1a3a;
  border: 1px solid #252550;
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
}
.pill .pill-label { color: #666; }
.pill .pill-value { color: #fff; font-weight: 600; margin-left: 0.35rem; }

/* === Results highlight === */
.results-highlight {
  background: linear-gradient(135deg, #0f1a2e, #0d1f2d);
  border: 1px solid #1a3a4a;
  border-left: 3px solid #4ecca3;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.results-highlight h3 {
  color: #4ecca3;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}
.results-highlight pre {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #d0e8e0;
  white-space: pre-wrap;
  word-break: break-word;
}
.results-highlight .no-results {
  color: #556;
  font-style: italic;
}
.results-highlight.status-report {
  border-left-color: #e94560;
  background: linear-gradient(135deg, #1a0f1e, #1a1228);
}
.results-highlight.status-report h3 {
  color: #e94560;
}

/* === Terminal === */
.terminal {
  background: #0a0a14;
  border: 1px solid #1e1e3a;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.terminal-bar {
  background: #16162e;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #1e1e3a;
}
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.red { background: #e94560; }
.terminal-dot.yellow { background: #e9a545; }
.terminal-dot.green { background: #4ecca3; }
.terminal-title {
  color: #555;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  font-family: "SF Mono", "Fira Code", monospace;
}

.terminal-body {
  padding: 1rem 1.25rem;
  max-height: 65vh;
  overflow-y: auto;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.8rem;
  line-height: 1.65;
}

.terminal-body::-webkit-scrollbar { width: 6px; }
.terminal-body::-webkit-scrollbar-track { background: transparent; }
.terminal-body::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Terminal line types */
.t-line { padding: 2px 0; }

.t-prompt { color: #4ecca3; }
.t-prompt::before { content: "$ "; color: #e94560; }

.t-thinking {
  color: #666;
  font-style: italic;
  padding-left: 1rem;
  border-left: 2px solid #252550;
}

.t-text { color: #c8d8e8; padding: 0.15rem 0; }

.t-tool { color: #c77dff; }
.t-tool .tool-name { color: #e9a545; font-weight: 600; }
.t-tool .tool-args { color: #888; font-size: 0.75rem; }

.t-result {
  color: #8a9a8a;
  padding-left: 1rem;
  border-left: 2px solid #1a3a2a;
  margin: 0.15rem 0;
  max-height: 8rem;
  overflow: hidden;
  transition: max-height 0.3s;
  cursor: pointer;
  position: relative;
}
.t-result.expanded { max-height: none; }
.t-result.truncated::after {
  content: "click to expand";
  position: absolute;
  bottom: 0; left: 1rem; right: 0;
  padding: 0.5rem 0 0.2rem;
  background: linear-gradient(transparent, #0a0a14 60%);
  color: #e94560;
  font-size: 0.7rem;
  font-style: italic;
}
.t-result.expanded::after { display: none; }

.t-error {
  color: #ff6b6b;
  padding-left: 1rem;
  border-left: 2px solid #4a1a1a;
}

.t-turn-marker { color: #333; font-size: 0.7rem; padding: 0.3rem 0 0.1rem; }
.t-separator { border: none; border-top: 1px solid #1a1a2e; margin: 0.5rem 0; }

/* === File chips === */
.files-section h3 {
  color: #888;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.file-chip {
  background: #141432;
  border: 1px solid #252550;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.78rem;
  color: #4ecca3;
  cursor: pointer;
  transition: all 0.15s;
}
.file-chip:hover { border-color: #4ecca3; background: #1a2a3a; }
.file-chip.active { border-color: #e94560; color: #fff; }
.file-chip .chip-size { color: #555; font-size: 0.7rem; margin-left: 0.35rem; }

.file-terminal { display: none; }
.file-terminal.visible { display: block; }

/* === Runs grid === */
.runs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.run-card {
  background: linear-gradient(135deg, #141432, #1a1a3a);
  border: 1px solid #252550;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}
.run-card:hover {
  border-color: #e94560;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.15);
}
.run-card .run-name {
  font-family: "SF Mono", "Fira Code", monospace;
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}
.run-card .run-meta { font-size: 0.78rem; color: #666; }

/* === Upload modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 15, 0.85);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.visible { display: flex; }

.modal {
  background: #111128;
  border: 1px solid #252550;
  border-radius: 14px;
  width: 480px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #1e1e3a;
}
.modal-header h3 { color: #fff; font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  color: #666;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}
.modal-close:hover { color: #e94560; }

.modal-body { padding: 1.5rem; }

#drop-zone {
  width: 100%;
  height: 200px;
  border: 2px dashed #333;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #0c0c1d;
}
#drop-zone.dragover { border-color: #e94560; background: #12122a; }

#drop-zone .dz-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}
#drop-zone p { color: #666; font-size: 0.9rem; }
#drop-zone .dz-hint { font-size: 0.78rem; color: #444; margin-top: 0.5rem; }

#file-input { display: none; }

#upload-progress {
  margin-top: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.upload-item {
  background: #0c0c1d;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-item .name {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.upload-item .status { font-size: 0.82rem; font-weight: 600; }
.status-uploading { color: #e94560; }
.status-done { color: #4ecca3; }
.status-error { color: #ff6b6b; }

.progress-bar {
  width: 100%;
  height: 3px;
  background: #222;
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: #e94560;
  border-radius: 2px;
  transition: width 0.3s;
}

/* === Rendered markdown === */
.md-content {
  font-size: 0.88rem;
  line-height: 1.7;
  color: #d0dce8;
}
.md-content h1, .md-content h2, .md-content h3,
.md-content h4, .md-content h5, .md-content h6 {
  color: #fff;
  margin: 1rem 0 0.5rem;
  font-weight: 700;
}
.md-content h1 { font-size: 1.3rem; border-bottom: 1px solid #252550; padding-bottom: 0.4rem; }
.md-content h2 { font-size: 1.1rem; border-bottom: 1px solid #1e1e3a; padding-bottom: 0.3rem; }
.md-content h3 { font-size: 0.95rem; color: #e94560; }
.md-content p { margin: 0.5rem 0; }
.md-content ul, .md-content ol { margin: 0.5rem 0 0.5rem 1.5rem; }
.md-content li { margin: 0.2rem 0; }
.md-content a { color: #4ecca3; text-decoration: none; }
.md-content a:hover { text-decoration: underline; }
.md-content code {
  font-family: "SF Mono", "Fira Code", monospace;
  background: #141432;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #e9a545;
}
.md-content pre {
  background: #0a0a14;
  border: 1px solid #1e1e3a;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}
.md-content pre code {
  background: none;
  padding: 0;
  color: #c8d8e8;
  font-size: 0.8rem;
}
.md-content blockquote {
  border-left: 3px solid #e94560;
  padding-left: 1rem;
  color: #888;
  margin: 0.5rem 0;
}
.md-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
  font-size: 0.82rem;
}
.md-content th, .md-content td {
  border: 1px solid #252550;
  padding: 0.4rem 0.75rem;
  text-align: left;
}
.md-content th { background: #141432; color: #fff; font-weight: 600; }
.md-content hr { border: none; border-top: 1px solid #252550; margin: 1rem 0; }
.md-content strong { color: #fff; }
.md-content em { color: #aab; }

/* Terminal text with markdown */
.t-text .md-content { font-size: 0.82rem; line-height: 1.6; }
.t-text .md-content p { margin: 0.2rem 0; }
.t-text .md-content h1, .t-text .md-content h2, .t-text .md-content h3 {
  margin: 0.4rem 0 0.2rem;
  font-size: 0.88rem;
}

/* === Utility === */
.empty-state { text-align: center; padding: 4rem 2rem; color: #555; }
.loading { text-align: center; padding: 3rem; color: #555; }

.back-link {
  display: inline-block;
  color: #888;
  text-decoration: none;
  font-size: 0.82rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: color 0.15s;
}
.back-link:hover { color: #e94560; }

/* === Hero (index page) === */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}
.hero h2 {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.hero p {
  color: #666;
  font-size: 0.9rem;
  max-width: 500px;
  margin: 0 auto;
}
.hero .binary-label {
  display: inline-block;
  margin-top: 1rem;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  color: #e94560;
  background: #1a1a3a;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  border: 1px solid #252550;
}
