/* ============================================
   Penguin Deal Radar — Dashboard Styles
   Dark command-center aesthetic
   ============================================ */

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

:root {
  --bg-base: #06090f;
  --bg-surface: #0c1220;
  --bg-card: #111a2e;
  --bg-card-hover: #162038;
  --bg-input: #0a1020;
  --border: #1a2d4d;
  --border-hover: #2a4a70;
  --text: #dce4f0;
  --text-secondary: #7d91ae;
  --text-dim: #4a5d78;
  --accent: #00d4aa;
  --accent-dim: #009e80;
  --hot: #ff4d5e;
  --hot-bg: rgba(255, 77, 94, 0.1);
  --hot-border: rgba(255, 77, 94, 0.25);
  --warm: #ffb020;
  --warm-bg: rgba(255, 176, 32, 0.1);
  --warm-border: rgba(255, 176, 32, 0.25);
  --monitor: #4a90e2;
  --monitor-bg: rgba(74, 144, 226, 0.1);
  --monitor-border: rgba(74, 144, 226, 0.25);
  --low: #5a6577;
  --low-bg: rgba(90, 101, 119, 0.08);
  --low-border: rgba(90, 101, 119, 0.2);
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --font-mono: 'Consolas', 'SF Mono', 'Monaco', monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius: 6px;
  --radius-lg: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-dim); }

/* ---- Layout ---- */
.page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ---- Top Nav ---- */
.top-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-right: 32px;
  white-space: nowrap;
}
.nav-brand span { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 2px;
}
.nav-links a {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.nav-links a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--accent);
  background: rgba(0, 212, 170, 0.08);
}
.nav-stats {
  margin-left: auto;
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}
.nav-stat { color: var(--text-dim); }
.nav-stat .n { font-weight: 700; }
.nav-stat .n.hot { color: var(--hot); }
.nav-stat .n.warm { color: var(--warm); }
.nav-stat .n.monitor { color: var(--monitor); }

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 28px 0 20px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.last-updated {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ---- Score Badges ---- */
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  min-width: 54px;
  white-space: nowrap;
}
.score-hot { background: var(--hot-bg); color: var(--hot); border: 1px solid var(--hot-border); }
.score-warm { background: var(--warm-bg); color: var(--warm); border: 1px solid var(--warm-border); }
.score-monitor { background: var(--monitor-bg); color: var(--monitor); border: 1px solid var(--monitor-border); }
.score-low { background: var(--low-bg); color: var(--low); border: 1px solid var(--low-border); }
.score-none { background: var(--low-bg); color: var(--text-dim); border: 1px solid var(--low-border); }

/* ---- Type Badges ---- */
.type-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(26, 45, 77, 0.6);
  color: var(--text-secondary);
  white-space: nowrap;
  text-transform: lowercase;
}

/* ---- Cards (Hot Board) ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.opp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
}
.opp-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.opp-card.urgent { border-left: 3px solid var(--hot); }
.card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.card-top .score { flex-shrink: 0; }
.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.card-meta .org { font-weight: 500; }
.card-meta .value { color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.card-meta .deadline { font-family: var(--font-mono); }
.card-meta .deadline.soon { color: var(--hot); font-weight: 600; }
.card-summary {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-expanded .card-summary {
  -webkit-line-clamp: unset;
}
.card-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.card-expanded .card-detail { display: block; }
.card-detail .full-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}
.card-detail .source-link {
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  gap: 10px;
  padding: 14px 0 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  white-space: nowrap;
}
select, input[type="text"], input[type="number"], input[type="date"] {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s;
}
select:focus, input:focus {
  border-color: var(--accent);
}
input[type="range"] {
  accent-color: var(--accent);
  width: 120px;
}
.filter-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}
.btn-reset {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-ui);
  transition: all 0.15s;
}
.btn-reset:hover { border-color: var(--border-hover); color: var(--text); }

.search-box {
  width: 220px;
}

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: var(--bg-surface);
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 2;
  transition: color 0.15s;
}
thead th:hover { color: var(--accent); }
thead th .arrow { font-size: 10px; margin-left: 3px; opacity: 0.6; }
thead th.sorted .arrow { opacity: 1; color: var(--accent); }
tbody tr {
  border-bottom: 1px solid rgba(26, 45, 77, 0.4);
  transition: background 0.1s;
}
tbody tr:hover { background: var(--bg-card-hover); }
tbody td {
  padding: 10px 14px;
  vertical-align: middle;
}
td.col-title {
  max-width: 380px;
  font-size: 13px;
}
td.col-title a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
td.col-org {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
}
td.col-deadline {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
td.col-deadline.soon { color: var(--hot); font-weight: 600; }
td.col-value {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  text-align: right;
}
td.col-state {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Signal Groups ---- */
.signal-group {
  margin-bottom: 20px;
}
.signal-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s;
}
.signal-group-header:hover { border-color: var(--border-hover); }
.signal-group-header .toggle {
  font-size: 12px;
  color: var(--text-dim);
  transition: transform 0.2s;
  width: 16px;
  text-align: center;
}
.signal-group-header .toggle.open { transform: rotate(90deg); }
.signal-group-header .group-name {
  font-size: 14px;
  font-weight: 600;
}
.signal-group-header .group-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-left: auto;
}
.signal-group-body {
  display: none;
  padding: 8px 0 0;
}
.signal-group.open .signal-group-body { display: block; }
.signal-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(26, 45, 77, 0.3);
  transition: background 0.1s;
}
.signal-item:hover { background: rgba(255,255,255,0.015); }
.signal-item:last-child { border-bottom: none; }
.signal-item .score { flex-shrink: 0; font-size: 12px; min-width: 48px; }
.signal-item .sig-content { flex: 1; min-width: 0; }
.signal-item .sig-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signal-item .sig-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---- Conference Timeline ---- */
.timeline { padding: 20px 0; }
.timeline-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.timeline-empty .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.timeline-empty .empty-text { font-size: 16px; margin-bottom: 8px; }
.timeline-empty .empty-sub { font-size: 13px; color: var(--text-dim); }

/* ---- Source Health ---- */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin: 16px 0 24px;
}
.source-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.source-dot.warn { background: var(--yellow); box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.source-dot.err { background: var(--red); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.source-name {
  font-family: var(--font-mono);
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---- Stats Row ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  text-align: center;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
}
.stat-value.hot { color: var(--hot); }
.stat-value.warm { color: var(--warm); }
.stat-value.monitor { color: var(--monitor); }
.stat-value.accent { color: var(--accent); }

/* ---- Loading / Error ---- */
.loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ---- Show More ---- */
.show-more {
  text-align: center;
  padding: 16px;
}
.show-more button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 28px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: all 0.15s;
}
.show-more button:hover { border-color: var(--accent); background: var(--bg-card-hover); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .top-nav { flex-wrap: wrap; padding: 12px 16px; }
  .nav-brand { margin-right: 16px; font-size: 15px; }
  .nav-links a { padding: 6px 10px; font-size: 12px; }
  .nav-stats { display: none; }
  .page-wrap { padding: 0 16px 32px; }
  .card-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 22px; }
  .filter-bar { gap: 8px; }
  .search-box { width: 100%; }
  td.col-title a { max-width: 180px; }
  .source-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .nav-links { flex-wrap: wrap; }
  .nav-brand { width: 100%; margin-bottom: 8px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
