
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800&family=Chelsea+Market&family=Outfit:wght@500;700;800&display=swap');

:root {
  /* Light Mode (Default) */
  --bg-color: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-glow: rgba(14, 165, 233, 0.1);
  --text-main: #020617;
  --text-muted: #475569;
  --accent: #10b981;
  --danger: #f43f5e;
  --radius: 20px;
  --nav-height: 80px;
  --star-gold: #fbbf24;
  --star-empty: rgba(15, 23, 42, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --primary: #38bdf8;
    --primary-hover: #7dd3fc;
    --primary-glow: rgba(56, 189, 248, 0.3);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --star-empty: rgba(255, 255, 255, 0.08);
  }
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Chelsea Market', cursive;
  line-height: 1.3;
  color: var(--text-main);
  padding-left: 12px;
  padding-right: 12px;
  margin-bottom: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

/* Navbar */
nav {
  background: var(--surface);
  height: var(--nav-height);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 40px;
}

.logo {
  font-family: 'Chelsea Market', cursive;
  font-size: 34px;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo img {
  height: 36px;
  width: auto;
  display: block;
  border-radius: 8px;
}

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

#auth-ui {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-hover);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Layout */
.container {
  max-width: 1200px;
  padding: 26px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  padding: 60px 0 80px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(to right, #fff, #a1a1aa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* Grid */
.hacks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 10px 30px -10px var(--primary-glow);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #d946ef);
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover::before {
  opacity: 1;
}

.card h3 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.card-desc {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 24px;
  flex-grow: 1;
}

.metrics {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
}

.metric-score {
  font-weight: 700;
  color: var(--accent);
}

.metric.score-low .metric-score { color: var(--danger); }
.metric.score-med .metric-score { color: #f59e0b; }

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.btn {
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
  display: inline-block;
}

.btn:hover {
  background: var(--primary-hover);
  color: #fff;
}

.btn-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-edit:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

/* Table */
.table-container {
  overflow-x: auto;
  margin-bottom: 60px;
}
.hacks-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  margin-bottom: 24px;
}
.hacks-table th, .hacks-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.hacks-table th {
  background: var(--surface-hover);
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.hacks-table th:hover {
  color: var(--primary);
}
.hacks-table tbody tr {
  cursor: pointer;
  transition: all 0.2s;
}
.hacks-table tbody tr:hover td, 
.hacks-table tbody tr:hover td a {
  color: var(--primary) !important;
}
.hacks-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}
@media (prefers-color-scheme: dark) {
  .hacks-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
  }
}
.fw-bold { font-weight: 700; }
.score-high { color: var(--accent); }
.score-med { color: #f59e0b; }
.score-low { color: var(--danger); }
.text-center { text-align: center !important; }

/* Article Page Layout */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
}

@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}

.article-header {
  margin-bottom: 40px;
}

.article-header h1 {
  font-size: 40px;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}

.article-content {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-main);
}

.article-content .discussable { transition: all 0.2s; cursor: pointer; position: relative; border: 2px solid transparent; border-radius: 12px; }
.article-content .discussable.text-module { padding: 12px; margin-bottom: 24px; }
.article-content .discussable.image-module { padding: 12px; margin-bottom: 32px; }
.article-content .discussable:hover { background: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.article-content .image-module:hover { background: rgba(0, 0, 0, 0.02); }
@media (prefers-color-scheme: dark) {
  .article-content .image-module:hover { background: rgba(255, 255, 255, 0.02); }
}
.article-content .discussable.active-module { border-color: var(--primary); background: var(--surface); box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1); }

.c-meta { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  font-size: 11px; 
  font-weight: 700; 
  color: var(--text-muted); 
  opacity: 0.5; 
  margin-top: 8px;
  justify-content: flex-end;
}
.article-content .discussable:hover .c-meta { opacity: 1; color: var(--primary); }

.article-content h2 {
  font-size: 28px;
  margin: 32px 0 16px;
  color: var(--text-main);
}

.article-content p {
  margin-bottom: 24px;
}

/* Sidebar */
.sidebar {
}

.sidebar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.sidebar-widget h3 {
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li {
  margin-bottom: 12px;
}

.sidebar-links a {
  color: var(--text-muted);
  display: block;
  transition: color 0.2s, transform 0.2s;
}

.sidebar-links a:hover {
  color: var(--primary-hover);
  transform: translateX(4px);
}

/* Rankings Header Widget */
.rankings-header {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  justify-content: center;
}

.rank-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.rank-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  width: auto;
}

.rank-badge:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.rank-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.stars {
  color: var(--star-gold);
  font-size: 20px;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

.rank-badge .desc {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

/* Color coding for the description text */
.rank-badge.high .desc { color: var(--accent); }
.rank-badge.med .desc { color: #f59e0b; }
.rank-badge.low .desc { color: var(--danger); }

@media (max-width: 768px) {
  .rankings-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .rank-item, .rank-badge {
    width: 100%;
    min-width: unset;
  }
}

/* The Separate Floating Drawer */
.discussion-drawer {
    position: fixed;
    right: -400px;
    top: 0;
    width: 360px;
    height: 100%;
    background: var(--surface);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 40px 24px;
    box-sizing: border-box;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    visibility: hidden;
}
.discussion-drawer.open { 
    right: 0; 
    visibility: visible;
}
.comment { font-size: 14px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.comment-meta { font-weight: 700; font-size: 12px; display: block; margin-bottom: 4px; color: var(--primary); }
.comment-text { color: var(--text-muted); line-height: 1.5; }
.drawer-context { font-size: 12px; color: var(--text-muted); background: var(--bg-color); padding: 12px; border-radius: 8px; margin-bottom: 24px; font-style: italic; border-left: 3px solid var(--primary); }
