/* ===== CSS Variables & Reset ===== */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --bg-card-hover: #22282f;
  --bg-nav: rgba(13, 17, 23, 0.85);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --border: #30363d;
  --border-hover: #484f58;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --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 30px rgba(0,0,0,0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg-primary: #f6f8fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f4f6;
  --bg-nav: rgba(246, 248, 250, 0.85);
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #939a9e;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-glow: rgba(9, 105, 218, 0.1);
  --border: #d0d7de;
  --border-hover: #afb8c1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
ul { list-style: none; }

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

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.logo-icon { font-size: 1.4rem; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--accent-glow);
}

.nav-link.active { color: var(--accent); }

.nav-admin {
  color: var(--accent) !important;
  border: 1px solid var(--accent);
  margin-left: 8px;
}

.nav-admin:hover {
  background: var(--accent) !important;
  color: #fff !important;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(20deg);
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  flex-direction: column;
  gap: 4px;
  z-index: 999;
}

.mobile-menu.open { display: flex; }

.mobile-link {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.mobile-link:hover { background: var(--accent-glow); color: var(--text-primary); }
.mobile-admin { color: var(--accent) !important; }

/* ===== Hero ===== */
.hero {
  padding: 140px 24px 80px;
  text-align: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 60%);
  animation: heroGlow 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes heroGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(5%, 3%); }
}

.hero-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.search-box {
  position: relative;
  max-width: 520px;
  margin: 0 auto 24px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.5;
}

.search-input {
  width: 100%;
  padding: 14px 44px 14px 48px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition);
  outline: none;
}

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

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

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.search-clear:hover { background: var(--border); color: var(--text-primary); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.stat-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

/* ===== Category Tabs ===== */
.category-tabs-section {
  position: sticky;
  top: 60px;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.category-tabs {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.cat-tab:hover { color: var(--text-primary); background: var(--bg-card); }

.cat-tab.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ===== Tools Section ===== */
.tools-section {
  padding: 48px 0 80px;
  min-height: 60vh;
}

.category-header {
  text-align: center;
  margin-bottom: 40px;
}

.category-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.category-desc { color: var(--text-secondary); }

.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);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.tool-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  transition: all var(--transition);
  align-self: flex-start;
  margin-top: auto;
}

.tool-link:hover {
  background: var(--accent);
  color: #fff;
}

.no-results {
  text-align: center;
  padding: 80px 24px;
}

.no-results-icon { font-size: 3rem; margin-bottom: 16px; }
.no-results h3 { font-size: 1.3rem; margin-bottom: 8px; }
.no-results p { color: var(--text-secondary); }

/* ===== About Section ===== */
.about-section {
  padding: 80px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.section-desc {
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.8;
}

.about-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.about-feature {
  text-align: center;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.about-feature:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.feature-icon { font-size: 2rem; margin-bottom: 12px; }
.about-feature h3 { font-size: 1.1rem; margin-bottom: 8px; }
.about-feature p { font-size: 0.85rem; color: var(--text-secondary); }

/* ===== Footer ===== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.footer-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
}

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

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 99;
}

.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }

  .hero { padding: 120px 24px 60px; }
  .hero-title { font-size: 1.8rem; }
  .hero-subtitle { font-size: 0.95rem; }

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

  .category-tabs-section { top: 60px; }
  .category-tabs { padding: 8px 0; }

  .back-to-top { bottom: 20px; right: 20px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
