/* ========== CSS Variables & Reset ========== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f0f2f5;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-white: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --header-h: 60px;
  --sidebar-w: 220px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ========== Header ========== */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.88);
  display: flex; align-items: center;
  padding: 0 24px;
}
.header-inner {
  max-width: 1440px; width: 100%; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 700; color: var(--text-primary);
  flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 800;
}
.nav-menu {
  display: flex; align-items: center; gap: 4px;
}
.nav-menu > li { position: relative; }
.nav-menu > li > a {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  transition: all var(--transition);
}
.nav-menu > li > a:hover,
.nav-menu > li > a.active {
  color: var(--primary); background: rgba(37,99,235,0.06);
}
.nav-menu > li > a svg { width: 16px; height: 16px; }
/* Dropdown */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 220px; padding: 8px;
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all var(--transition);
  z-index: 100;
}
.nav-menu > li:hover .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px;
}
.dropdown-menu a:hover { background: var(--bg); color: var(--primary); }
.dropdown-menu .dm-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
/* Search */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid transparent;
  border-radius: 10px; padding: 0 14px; height: 40px;
  transition: all var(--transition); flex-shrink: 0;
}
.search-box:focus-within {
  border-color: var(--primary); background: var(--bg-white);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.search-box svg { width: 18px; height: 18px; color: var(--text-light); flex-shrink: 0; }
.search-box input {
  border: none; background: none; outline: none;
  font-size: 14px; color: var(--text-primary); width: 200px;
}
.search-box input::placeholder { color: var(--text-light); }
/* Header actions */
.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.btn-submit {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: 14px; font-weight: 500;
  transition: all var(--transition);
}
.btn-submit:hover {
  transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}
/* Mobile toggle */
.mobile-toggle { display: none; padding: 8px; color: var(--text-secondary); }
.mobile-toggle svg { width: 24px; height: 24px; }

/* ========== Layout ========== */
.layout {
  display: flex; margin-top: var(--header-h); min-height: calc(100dvh - var(--header-h));
}

/* ========== Sidebar ========== */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-white); border-right: 1px solid var(--border);
  position: sticky; top: var(--header-h);
  height: calc(100dvh - var(--header-h));
  overflow-y: auto; padding: 16px 0;
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar-section { padding: 0 12px; margin-bottom: 20px; }
.sidebar-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--text-light); letter-spacing: 0.5px;
  padding: 0 12px; margin-bottom: 8px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: all var(--transition);
}
.sidebar-link:hover { background: var(--bg); color: var(--text-primary); }
.sidebar-link.active {
  background: rgba(37,99,235,0.08); color: var(--primary); font-weight: 600;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link .count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--bg); color: var(--text-light);
  padding: 2px 7px; border-radius: 10px;
}
.sidebar-link.active .count { background: rgba(37,99,235,0.12); color: var(--primary); }

/* ========== Main Content ========== */
.main { flex: 1; min-width: 0; padding: 24px; }
.main-inner { max-width: 1200px; margin: 0 auto; }

/* Banner */
.banner {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #06b6d4 100%);
  border-radius: var(--radius-lg); padding: 36px 40px;
  color: #fff; margin-bottom: 28px; position: relative; overflow: hidden;
}
.banner::after {
  content: ''; position: absolute; top: -40%; right: -10%; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}
.banner h1 { font-size: 28px; font-weight: 700; margin-bottom: 10px; position: relative; }
.banner p { font-size: 15px; opacity: 0.85; max-width: 600px; position: relative; }
.banner-stats {
  display: flex; gap: 32px; margin-top: 20px; position: relative;
}
.banner-stat { text-align: center; }
.banner-stat .num { font-size: 26px; font-weight: 700; }
.banner-stat .label { font-size: 12px; opacity: 0.7; margin-top: 2px; }

/* Section */
.section { margin-bottom: 36px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.section-title .icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.section-more {
  font-size: 13px; color: var(--text-light);
  display: flex; align-items: center; gap: 4px;
}
.section-more:hover { color: var(--primary); }
.section-tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: var(--bg); border-radius: var(--radius-sm); padding: 3px;
}
.section-tab {
  padding: 6px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition);
}
.section-tab:hover { color: var(--text-primary); }
.section-tab.active {
  background: var(--bg-white); color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ========== Tool Cards Grid ========== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.tool-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 18px;
  transition: all var(--transition); cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(37,99,235,0.1);
  transform: translateY(-2px);
}
.tool-card-top { display: flex; align-items: center; gap: 12px; }
.tool-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  color: #fff; font-weight: 700;
}
.tool-info { flex: 1; min-width: 0; }
.tool-name {
  font-size: 15px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-source { font-size: 12px; color: var(--text-light); }
.tool-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tool-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-tag {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: var(--bg); color: var(--text-secondary); font-weight: 500;
}
.tool-tag.hot { background: rgba(239,68,68,0.08); color: var(--danger); }
.tool-tag.new { background: rgba(37,99,235,0.08); color: var(--primary); }
.tool-tag.free { background: rgba(16,185,129,0.08); color: var(--success); }

/* Hot strip */
.hot-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.hot-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); overflow: hidden;
  transition: all var(--transition); cursor: pointer;
  display: flex;
}
.hot-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.hot-card-img {
  width: 120px; flex-shrink: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
}
.hot-card-body { padding: 14px; flex: 1; }
.hot-card-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.hot-card-body p { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

/* ========== Right Aside ========== */
.aside { width: 300px; flex-shrink: 0; padding: 24px 0 24px 0; }
.aside-inner { position: sticky; top: calc(var(--header-h) + 24px); display: flex; flex-direction: column; gap: 20px; }
.aside-card {
  background: var(--bg-white); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 18px;
}
.aside-card h3 {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.aside-card h3 svg { width: 18px; height: 18px; color: var(--primary); }
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-item { display: flex; gap: 10px; }
.news-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 6px;
}
.news-item p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.news-item .time { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  font-size: 12px; padding: 5px 12px; border-radius: 20px;
  background: var(--bg); color: var(--text-secondary);
  transition: all var(--transition);
}
.tag-cloud a:hover { background: var(--primary); color: #fff; }

/* ========== Footer ========== */
.footer {
  background: var(--bg-white); border-top: 1px solid var(--border);
  padding: 32px 24px; margin-top: 40px;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
}
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 13px; color: var(--text-light); }
.footer-links a:hover { color: var(--primary); }
.footer-copy { font-size: 12px; color: var(--text-light); }

/* ========== Responsive ========== */
@media (max-width: 1100px) {
  .aside { display: none; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .nav-menu { display: none; }
  .mobile-toggle { display: block; }
  .main { padding: 16px; }
  .banner { padding: 24px; }
  .banner h1 { font-size: 22px; }
  .banner-stats { gap: 20px; }
  .banner-stat .num { font-size: 20px; }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .hot-strip { grid-template-columns: 1fr; }
  .search-box input { width: 140px; }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .header-actions .btn-submit span { display: none; }
  .banner-stats { flex-wrap: wrap; }
}

/* ========== Mobile Nav Overlay ========== */
.mobile-nav {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden;
  transition: all var(--transition);
}
.mobile-nav.open { opacity: 1; visibility: visible; }
.mobile-nav-panel {
  position: absolute; top: 0; right: 0; width: 300px; height: 100%;
  background: var(--bg-white);
  padding: 20px;
  transform: translateX(100%);
  transition: transform var(--transition);
  overflow-y: auto;
}
.mobile-nav.open .mobile-nav-panel { transform: translateX(0); }
.mobile-nav-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.mobile-nav-close { color: var(--text-secondary); padding: 4px; }
.mobile-nav-close svg { width: 24px; height: 24px; }
.mobile-nav-links a {
  display: block; padding: 12px 0; font-size: 15px; font-weight: 500;
  color: var(--text-primary); border-bottom: 1px solid var(--border-light);
}
.mobile-nav-links a:hover { color: var(--primary); }

/* ========== Scroll to top ========== */
.scroll-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 900;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all var(--transition);
}
.scroll-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { background: var(--primary-dark); transform: translateY(-2px); }
.scroll-top svg { width: 20px; height: 20px; }

/* ========== Animations ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.tool-card { animation: fadeInUp 0.4s ease both; }
.tool-card:nth-child(2) { animation-delay: 0.05s; }
.tool-card:nth-child(3) { animation-delay: 0.1s; }
.tool-card:nth-child(4) { animation-delay: 0.15s; }
.tool-card:nth-child(5) { animation-delay: 0.2s; }
.tool-card:nth-child(6) { animation-delay: 0.25s; }

@media (prefers-reduced-motion: reduce) {
  .tool-card { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border-light) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
