/* ===== CSS Variables & Theme ===== */
:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f4ff;
  --bg-input: #f0f2f5;
  --bg-header: rgba(255, 255, 255, 0.85);
  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8e8ea0;
  --border-color: #e4e6eb;
  --accent: #4f6ef7;
  --accent-light: #eef1ff;
  --accent-dark: #3b54c4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-sidebar: #16162a;
  --bg-card: #1e1e36;
  --bg-card-hover: #2a2a4a;
  --bg-input: #252542;
  --bg-header: rgba(15, 15, 26, 0.9);
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6e6e88;
  --border-color: #2e2e4a;
  --accent: #6c85f7;
  --accent-light: #1e2248;
  --accent-dark: #8da0ff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ===== Header ===== */

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.85);
}




.header-search {
  flex: 1;
  max-width: 480px;
  margin-left: 32px;
  margin-right: auto;
  position: relative;
}

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition);
}

.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}






.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-input);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}






.recommend-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.4;
}

/* ===== Layout ===== */
.layout {
  display: flex;
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  padding-top: 64px;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 220px;
  height: calc(100vh - 64px);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 20px 12px;
  overflow-y: auto;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  z-index: 90;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-nav li a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-nav li a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-nav li a .nav-icon {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.sidebar-nav li a .nav-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}

.category-section {
  margin-bottom: 40px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.category-header .cat-icon {
  font-size: 1.5rem;
}

.category-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.category-header .cat-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-left: 4px;
}

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

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  opacity: 0;
  transition: opacity var(--transition);
}

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

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

.tool-card .tool-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.tool-card .tool-info {
  flex: 1;
  min-width: 0;
}

.tool-card .tool-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-card .tool-name .arrow {
  opacity: 0;
  transform: translateX(-4px);
  transition: all var(--transition);
  color: var(--accent);
  font-size: 0.85rem;
}

.tool-card:hover .tool-name .arrow {
  opacity: 1;
  transform: translateX(0);
}

.tool-card .tool-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 1rem;
}

/* ===== Footer ===== */
.footer {
  margin-left: 220px;
  text-align: center;
  padding: 24px 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  transition: border-color var(--transition);
}

/* ===== Sidebar Overlay (Mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 85;
}

.sidebar-overlay.active {
  display: block;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {




  .header-search {
    margin-left: 12px;
    margin-right: auto;
  }

  .mobile-menu-btn {
    display: none;
  }

  .header-actions .theme-toggle {
    display: flex;
  }

  .mobile-menu-btn {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .footer {
    margin-left: 0;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {

}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

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

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

.category-section:nth-child(2) .tool-card { animation-delay: 0.05s; }
.category-section:nth-child(3) .tool-card { animation-delay: 0.1s; }
.category-section:nth-child(4) .tool-card { animation-delay: 0.15s; }
.category-section:nth-child(5) .tool-card { animation-delay: 0.2s; }
.category-section:nth-child(6) .tool-card { animation-delay: 0.25s; }

