/* ===== CSS Variables ===== */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --border-color: #2a2a3a;
  --border-hover: #3a3a4a;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --accent-cyan: #00d4ff;
  --accent-purple: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #8b5cf6 100%);
  --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);
  --font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  --max-width: 1200px;
  --header-height: 72px;
}

/* ===== Light Theme (Day Mode) ===== */
body.light-theme {
  --bg-primary: #f5f6f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;
  --border-hover: #d0d0d8;
  --text-primary: #111827;
  --text-secondary: #6b7280;
}

body.light-theme .grid-bg {
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.05) 1px, transparent 1px);
}

body.light-theme .header.scrolled {
  background-color: rgba(245, 246, 248, 0.9);
}

body.light-theme .footer {
  background-color: #ffffff;
  border-top-color: #e5e7eb;
}

body.light-theme .tool-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .tool-card:hover {
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.15);
}

body.light-theme .hero-title .gradient {
  background: linear-gradient(135deg, #00a8cc 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 扩展白天模式覆盖 */
body.light-theme .section {
  background-color: var(--bg-primary);
}

body.light-theme .section-header {
  background-color: var(--bg-primary);
}

body.light-theme .section-title {
  color: var(--text-primary);
}

body.light-theme .section-subtitle {
  color: var(--text-secondary);
}

body.light-theme .about-content {
  background-color: var(--bg-primary);
}

body.light-theme .about-section h2 {
  color: #0891b2;
}

body.light-theme .about-section p {
  color: var(--text-secondary);
  background-color: var(--bg-primary);
}

body.light-theme .value-card {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .value-card h3 {
  color: var(--text-primary);
}

body.light-theme .privacy-content {
  background-color: var(--bg-primary);
}

body.light-theme .privacy-section h2 {
  color: #0891b2;
}

body.light-theme .privacy-section p,
body.light-theme .privacy-section li {
  color: var(--text-secondary);
}

body.light-theme .form-input,
body.light-theme textarea {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.light-theme .form-input:focus,
body.light-theme textarea:focus {
  border-color: var(--accent-cyan);
}

body.light-theme .mobile-nav {
  background-color: var(--bg-secondary);
}

body.light-theme .btn-primary {
  color: #ffffff;
}

body.light-theme .hero-section {
  background-color: var(--bg-primary);
}

body.light-theme .category-nav {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

body.light-theme .category-btn {
  color: var(--text-secondary);
}

body.light-theme .category-btn.active {
  color: var(--accent-cyan);
}

body.light-theme .submit-success {
  background-color: var(--bg-card);
}

body.light-theme .submit-success h2 {
  color: var(--text-primary);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== Grid Background ===== */
.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: -1;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}

.header.scrolled {
  background-color: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 10px 20px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

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

.nav-link.active {
  color: var(--accent-cyan);
  background-color: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
}

.nav-link.nav-submit {
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 600;
  border: none;
}

.nav-link.nav-submit:hover {
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.1);
}

.header-search-input {
  width: 160px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.header-search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.header-search-btn {
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.header-search-btn:hover {
  color: var(--accent-cyan);
}

/* Hide search box on mobile */
@media (max-width: 768px) {
  .search-box {
    display: none;
  }
}

/* Language Switch Button */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.lang-switch {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--accent-cyan);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-switch:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent-cyan);
}

/* Mobile Menu Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  cursor: pointer;
  background: none;
  border: none;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: all 0.3s ease;
}

/* ===== Hero Section ===== */
.hero {
  min-height: auto;
  display: flex;
  align-items: center;
  text-align: center;
  padding: 120px 24px 48px;
  position: relative;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.hero-title {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.hero-title .gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(14px, 2vw, 18px);
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.8;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  background: var(--accent-gradient);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.hero-cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.hero-cta:hover::before {
  left: 100%;
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-cyan);
}

/* ===== Section Styles ===== */
.section {
  padding: 96px 24px;
}

.section-header {
  text-align: center;
  margin-bottom: 64px;
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ===== Tool Grid ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.tool-card {
  background-color: var(--bg-card);
  border: none;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s ease forwards;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  background-color: var(--bg-secondary);
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; }
.tool-card:nth-child(7) { animation-delay: 0.7s; }
.tool-card:nth-child(8) { animation-delay: 0.8s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-icon svg {
  width: 22px;
  height: 22px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

/* 工具卡片顶部：图标+信息左右结构 */
.tool-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

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

.tool-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
}

.tool-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tool-tag {
  padding: 2px 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 10px;
  color: var(--text-secondary);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background-color: transparent;
  border: 1px solid var(--accent-cyan);
  border-radius: 8px;
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background-color: var(--accent-cyan);
  color: var(--bg-primary);
}

.tool-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.tool-actions {
  display: flex;
  gap: 8px;
}

.tool-btn-detail {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

/* 小尺寸按钮 */
.tool-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.tool-btn-detail:hover {
  background-color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--bg-primary);
}

/* ===== Category Filter Buttons ===== */
.category-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.category-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.category-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.15);
}

.category-btn.active {
  color: var(--text-primary);
  border-color: transparent;
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
              var(--accent-gradient) border-box;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.category-btn.active:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-cyan);
}

.category-btn .category-count {
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(139, 92, 246, 0.15));
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  transition: all 0.25s ease;
}

.category-btn.active .category-count {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
}

/* ===== Category Cards (Homepage) ===== */
.category-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: var(--glow-cyan);
}

.category-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.category-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.category-count {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Footer ===== */
.footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 48px 24px;
  text-align: center;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-link {
  color: var(--text-secondary);
  font-size: 14px;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--accent-cyan);
}

.footer-copy {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== About Page ===== */
.about-content {
  max-width: 800px;
  margin: 0 auto;
}

.about-section {
  margin-bottom: 64px;
}

.about-section h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--accent-cyan);
}

.about-section p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.value-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.value-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.value-icon svg {
  width: 24px;
  height: 24px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

.value-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.value-card p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== Privacy Page ===== */
.privacy-content {
  max-width: 800px;
  margin: 0 auto;
}

.privacy-section {
  margin-bottom: 48px;
}

.privacy-section h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--accent-cyan);
}

.privacy-section p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
}

.privacy-section ul {
  padding-left: 24px;
  margin-top: 12px;
}

.privacy-section li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 8px;
  list-style: disc;
}

/* ===== Mobile Menu ===== */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
  z-index: 999;
}

.mobile-nav.active {
  display: block;
}

.mobile-nav .nav-link {
  display: block;
  padding: 14px 20px;
  margin-bottom: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .values-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .header-right .lang-switch {
    display: none;
  }

  .mobile-lang {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--accent-cyan);
    border-radius: 8px;
    color: var(--accent-cyan);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
  }

  .menu-toggle {
    display: flex;
  }

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

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

  .section {
    padding: 64px 16px;
  }

  .hero {
    padding: 100px 16px 60px;
  }

  .footer-links {
    flex-direction: column;
    gap: 16px;
  }
}

/* ===== Utilities ===== */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Page transition */
.page {
  animation: pageIn 0.4s ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
