/* ============================================
   YC Explorer — Design System
   Matching claude-code-setup aesthetic:
   Professional, minimal, blue accent, system fonts
   ============================================ */

:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --border: #d8dce6;
  --border-light: #e8ecf2;
  --text: #1e2a3a;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --code-bg: #f4f6fa;
  --accent: #4a6fa5;
  --accent-light: #e8edf5;
  --accent-hover: #3d5d8a;
  --green: #38a169;
  --green-light: #e6f4ed;
  --red: #e53e3e;
  --red-light: #fde8e8;
  --orange: #dd6b20;
  --orange-light: #fef3e2;
  --blue-light: #ebf4ff;
  --purple: #805ad5;
  --purple-light: #f0e6ff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, 'Segoe UI', 'Inter', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}
.container.normal-view {
  max-width: 1100px;
}

/* ============ TOP NAV BAR ============ */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
}
.topnav-brand {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.topnav-center {
  display: flex;
  gap: 2px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.nav-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-source:hover { color: var(--text); background: var(--surface); }
.nav-source.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.nav-logo {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  object-fit: contain;
}
.topnav-right {
  display: flex;
  gap: 2px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
  flex-shrink: 0;
}
.view-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.view-btn:hover { color: var(--text); }
.view-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

/* ============ HERO ============ */
.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 32px 0 28px;
  text-align: center;
}
.hero-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}
.hero-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 6px;
}
.hero-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  white-space: nowrap;
  margin: 0 auto 24px;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============ CARDS ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============ FILTER BAR ============ */
.filter-bar {
  margin: 24px 0 16px;
  padding: 16px 20px;
}
.filter-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}
.filter-dropdowns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  background: var(--code-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,111,165,0.12);
}
.search-wrap input::placeholder { color: var(--text-muted); }

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-width: 140px;
}
.filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-group select {
  width: 100%;
  padding: 8px 28px 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text);
  background: var(--code-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23718096' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-group select:focus {
  border-color: var(--accent);
}

.filter-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.separator { opacity: 0.4; }
.btn-clear {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-clear:hover { background: var(--code-bg); }

/* ============ TABLE ============ */
.table-wrap {
  margin-bottom: 24px;
  overflow: hidden;
}
.table-scroll {
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  z-index: 10;
}
thead th {
  background: var(--code-bg);
  border-bottom: 2px solid var(--border);
  padding: 7px 6px;
  text-align: left;
  font-weight: 600;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
  user-select: none;
  overflow: hidden;
}
thead th:first-child { padding-left: 12px; }
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--accent); }
thead th.sort-asc .sort-arrow::after { content: ' ▲'; }
thead th.sort-desc .sort-arrow::after { content: ' ▼'; }

/* Column widths — fixed layout, percentages */
.col-name { width: 12%; }
.col-oneliner { width: 24%; }
.col-batch { width: 11%; }
.col-industry { width: 6%; }
.col-stage { width: 4.5%; }
.col-tags { width: 12%; }
.col-team { width: 3%; text-align: center; }
.col-status { width: 7%; white-space: nowrap; }
.col-location { width: 9.5%; }
.col-founders { width: 10%; }

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
tbody tr:hover { background: var(--accent-light); }

tbody td {
  padding: 6px 6px;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}
tbody td:first-child { padding-left: 12px; }
.col-team { text-align: center; }

/* Cell-specific styles */
.company-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.company-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
  background: var(--code-bg);
  flex-shrink: 0;
}
.company-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.company-name a { color: var(--text); }
.company-name a:hover { color: var(--accent); text-decoration: none; }

.company-links {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}
.company-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.15s;
}
.company-links a:hover {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}
.company-links svg { width: 13px; height: 13px; }

.cell-oneliner {
  color: var(--text-secondary);
  line-height: 1.4;
  font-size: 0.72rem;
  white-space: normal !important;
  word-break: break-word;
}

.tags-cell {
  white-space: normal !important;
  line-height: 1.6;
}
.tag {
  display: inline-block;
  background: var(--code-bg);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.63rem;
  margin: 1px 1px;
  white-space: nowrap;
  color: var(--text-secondary);
}
.tag-ai {
  background: var(--purple-light);
  border-color: transparent;
  color: var(--purple);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-active { background: var(--green-light); color: var(--green); }
.badge-acquired { background: var(--blue-light); color: var(--accent); }
.badge-inactive { background: var(--red-light); color: var(--red); }
.badge-public { background: var(--orange-light); color: var(--orange); }

.batch-label {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 500;
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.3;
}
.industry-cell {
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.3;
  font-size: 0.72rem;
}

.founder-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent);
  font-size: 0.72rem;
  white-space: nowrap;
  line-height: 1.6;
}
.founder-link svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}


.location-cell {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.3;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 0.825rem;
}
.pagination button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
}
.pagination button:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface);
}
#pageInfo {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 100px;
  text-align: center;
}

/* ============ STATS PANEL ============ */
.stats-panel {
  padding: 20px 24px;
  margin-bottom: 24px;
}
.stats-panel h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.batch-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.mini-stat {
  padding: 10px 14px;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.mini-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mini-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mini-stat-bar {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.mini-stat-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ============ LOADING ============ */
.loading-row td {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Stage badges */
.badge-stage {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-early { background: #f0fdf4; color: #16a34a; }
.badge-seed { background: #ecfdf5; color: #059669; }
.badge-a { background: #eff6ff; color: #2563eb; }
.badge-b { background: #eef2ff; color: #4f46e5; }
.badge-c { background: #faf5ff; color: #7c3aed; }
.badge-growth { background: #fdf4ff; color: #a855f7; }
.badge-ipo { background: #fef3c7; color: #d97706; }

/* ============ FOOTER ============ */
footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  background: var(--surface);
}
.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 36px 24px 24px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.footer-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 4px;
}
.footer-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 360px;
}
.footer-badge-wrap { margin-top: 8px; }
.footer-badge { margin: 0; }
.footer-col a {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  font-size: 0.72rem;
  color: var(--text-muted);
}


/* ============ RESPONSIVE ============ */
@media (max-width: 860px) {
  .topnav-inner { height: auto; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .topnav-brand { display: none; }
  .hero { padding: 20px 0 16px; }
  .hero h1 { font-size: 1.3rem; }
  .stats-row { gap: 20px; }
  .stat-num { font-size: 1.2rem; }
  .filter-dropdowns { grid-template-columns: 1fr 1fr; }
  .filter-group { min-width: 0; }
  .container { padding: 0 12px; }
  .col-tags, .col-location, .col-founders, .col-stage { display: none; }
  .col-tags + td, td:nth-child(7), td:nth-child(10), td:nth-child(11) { display: none; }
}

/* ============ SCROLLBAR ============ */
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: var(--code-bg); }
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
