/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0b0e;
  --bg-card: #131418;
  --bg-nav: rgba(10,11,14,0.85);
  --border: #1e1f28;
  --border-hover: #2e2f3a;
  --text: #e8e9ed;
  --text-muted: #7a7b85;
  --text-dim: #4a4b55;
  --primary: #6c5ce7;
  --primary-glow: rgba(108,92,231,0.15);
  --accent-green: #00cec9;
  --accent-orange: #fdcb6e;
  --accent-blue: #74b9ff;
  --accent-pink: #fd79a8;
  --accent-red: #e17055;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.4);

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Navbar ===== */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}

.logo {
  font-size: 1.25rem; font-weight: 700; color: var(--text);
  text-decoration: none; letter-spacing: -0.01em;
}

.nav-links { display: flex; gap: 24px; }

.nav-link {
  color: var(--text-muted); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 80px 0 48px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--accent-blue), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

.search-container {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ===== Sections ===== */
.section {
  padding: 40px 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

/* ===== Category Chips ===== */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--bg-card);
}

.chip-active {
  border-color: var(--primary);
  color: var(--text);
  background: var(--primary-glow);
}

/* ===== Active Filters ===== */
.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-glow);
  border: 1px solid var(--primary);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
}

.filter-tag button {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  line-height: 1;
  display: flex;
}

.clear-btn {
  background: none; border: none;
  color: var(--accent-red);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Tools Header ===== */
.tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.tools-header .section-title {
  margin-bottom: 0;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-controls label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

#sort-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

#sort-select:focus {
  border-color: var(--primary);
}

/* ===== Tools Grid ===== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  cursor: default;
}

.tool-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.tool-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.tool-name {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tool-emoji {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.tool-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.cat-llm { background: rgba(108,92,231,0.15); color: #a29bfe; }
.cat-image { background: rgba(253,203,110,0.15); color: #fdcb6e; }
.cat-coding { background: rgba(0,206,201,0.15); color: #00cec9; }
.cat-video { background: rgba(255,107,129,0.15); color: #ff6b81; }
.cat-audio { background: rgba(116,185,255,0.15); color: #74b9ff; }
.cat-productivity { background: rgba(253,121,168,0.15); color: #fd79a8; }

.tool-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.tool-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.tool-detail-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.detail-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  font-size: 0.8125rem;
  font-weight: 500;
}

.detail-value.free { color: var(--accent-green); }
.detail-value.freemium { color: var(--accent-orange); }
.detail-value.paid { color: var(--accent-red); }

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tool-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--text-dim);
}

/* ===== No Results ===== */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.link-btn {
  background: none; border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Stats ===== */
.stats-section { border-top: 1px solid var(--border); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  text-align: center;
}

.stat-card {
  padding: 24px;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

.footer-inner p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-small {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tool-card {
  animation: fadeInUp 0.3s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero { padding: 48px 0 32px; }
  .tools-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; gap: 0; }
  .tool-details { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}