/* ========== 全局重置 & 变量 ========== */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #06b6d4;
  --accent: #8b5cf6;
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-light: #f8fafc;
  --text-light: #e2e8f0;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0,0,0,0.3);
  --transition: 0.25s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { color: var(--primary-light); }

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

/* ========== 导航栏 ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}

.navbar.scrolled {
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border-color);
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}
.logo-icon {
  color: var(--primary-light);
  font-size: 1.8rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}
.nav-links a:hover,
.nav-links a.active-link {
  color: white;
}
.nav-links a.active-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
  border-radius: 4px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
}

/* ========== Hero ========== */
.hero {
  padding: 140px 0 80px;
  background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 100%);
  text-align: center;
}
.hero-content h1 {
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a5b4fc, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}
.hero-content p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 60px;
  padding: 4px 4px 4px 24px;
  max-width: 520px;
  margin: 0 auto 28px;
  transition: border var(--transition), box-shadow var(--transition);
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.search-icon {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-right: 12px;
}
.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 0;
  color: white;
  font-size: 1rem;
  outline: none;
}
.search-box input::placeholder { color: var(--text-muted); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.hero-stats strong {
  color: white;
  font-weight: 700;
}

/* ========== 分类区 ========== */
.categories {
  padding: 40px 0 20px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.chip i {
  font-size: 0.8rem;
}
.chip:hover {
  border-color: var(--primary);
  color: white;
  background: rgba(99, 102, 241, 0.15);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 40px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: white;
  background: rgba(99,102,241,0.1);
}

/* ========== 工具网格 ========== */
.tools-section {
  padding: 20px 0 60px;
}
.tools-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.3s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.tool-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.tool-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.tool-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: white;
  flex-shrink: 0;
}
.tool-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
}
.tool-category {
  font-size: 0.75rem;
  background: rgba(6, 182, 212, 0.15);
  color: var(--secondary);
  padding: 2px 12px;
  border-radius: 30px;
  display: inline-block;
  margin-bottom: 8px;
  width: fit-content;
}
.tool-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 8px 0 16px;
  flex: 1;
}
.tool-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 40px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn i { font-size: 0.9rem; }
.btn:hover { background: var(--primary-dark); transform: scale(0.97); }
.btn-sm {
  padding: 6px 16px;
  font-size: 0.8rem;
}
.btn-danger {
  background: #ef4444;
}
.btn-danger:hover { background: #dc2626; }

.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; }
.empty-state.show { display: flex; }

/* ========== 后台管理 ========== */
.admin-section {
  padding: 60px 0;
  border-top: 1px solid var(--border-color);
}
.table-wrapper {
  overflow-x: auto;
  margin-top: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
.admin-table th {
  background: #1a2332;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #1e293b;
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .tool-icon-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.admin-actions {
  display: flex;
  gap: 8px;
}
.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { border-color: var(--primary); color: white; background: rgba(99,102,241,0.1); }
.btn-icon.danger:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.1); }

/* ========== 弹窗 ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 520px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 1.3rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: white; }
.modal-body { padding: 20px 24px 28px; }

.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  color: white;
  font-size: 0.95rem;
  transition: border var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; }
.form-group small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.8rem; }
.form-group small a { color: var(--secondary); }

.btn-block { width: 100%; justify-content: center; padding: 14px; font-size: 1rem; margin-top: 8px; }

/* ========== 页脚 ========== */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-inner p { margin: 0; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    position: absolute;
    top: 68px;
    left: 0;
    width: 100%;
    padding: 20px 24px;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
  }
  .nav-links.open { display: flex; }
  .hamburger { display: block; }

  .hero { padding: 120px 0 60px; }
  .hero-content h1 { font-size: 2.2rem; }
  .hero-content p { font-size: 1rem; }
  .search-box { max-width: 100%; }

  .tools-grid { grid-template-columns: 1fr; }
  .admin-table { font-size: 0.85rem; }
  .section-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero-content h1 { font-size: 1.8rem; }
  .chip { padding: 6px 14px; font-size: 0.8rem; }
  .tool-card { padding: 18px; }
}