/* ========================================
   国土空间规划工具包 - 全局样式
   ======================================== */

:root {
  --color-bg: #0f1419;
  --color-bg-secondary: #1a2332;
  --color-bg-card: #1e2a3a;
  --color-bg-card-hover: #243447;
  --color-border: #2d3f56;
  --color-text: #e8edf4;
  --color-text-secondary: #8b9cb3;
  --color-text-muted: #5c6f88;
  --color-primary: #3b9eff;
  --color-primary-hover: #5cb0ff;
  --color-accent: #00d4aa;
  --color-accent-dim: rgba(0, 212, 170, 0.15);
  --color-warning: #ffb020;
  --color-tag-bg: rgba(59, 158, 255, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Cascadia Code', 'Consolas', monospace;
  --header-height: 64px;
  --container-width: 1200px;
  --transition: 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-hover);
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Header ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.125rem;
}

.logo:hover {
  color: var(--color-text);
}

.logo-icon {
  font-size: 1.5rem;
}

.main-nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
  background: var(--color-bg-secondary);
}

/* ========== Hero ========== */
.hero {
  padding: 64px 0 48px;
  text-align: center;
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg) 100%);
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  background: var(--color-accent-dim);
  color: var(--color-accent);
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  max-width: 640px;
  margin: 0 auto;
}

/* ========== Search & Filter ========== */
.tools-section {
  padding: 32px 0 64px;
}

.search-bar {
  position: relative;
  max-width: 480px;
  margin: 0 auto 32px;
}

.search-bar input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
}

.search-bar input:focus {
  border-color: var(--color-primary);
}

.search-bar input::placeholder {
  color: var(--color-text-muted);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.tools-count {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tools-static-fallback {
  margin-bottom: 16px;
}

.tools-static-fallback ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tools-static-fallback a {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.tools-static-fallback[hidden] {
  display: none;
}

.tools-noscript-hint {
  margin-top: 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* ========== Tool Grid ========== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.tool-card {
  display: block;
  padding: 24px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  transition: all var(--transition);
  cursor: pointer;
}

.tool-card:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  color: var(--color-text);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tool-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
}

.tool-card p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.tools-more-hint {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  padding: 20px 24px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.tools-more-hint-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.tools-more-hint p {
  margin: 0;
}

.tool-tag {
  flex-shrink: 0;
  padding: 3px 10px;
  background: var(--color-tag-bg);
  color: var(--color-primary);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tool-status {
  display: inline-block;
  margin-top: 12px;
  padding: 2px 8px;
  background: rgba(255, 176, 32, 0.12);
  color: var(--color-warning);
  border-radius: 4px;
  font-size: 0.75rem;
}

.no-results {
  text-align: center;
  padding: 64px 24px;
  color: var(--color-text-muted);
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* ========== About Section ========== */
.about-section {
  padding: 64px 0;
  border-top: 1px solid var(--color-border);
}

.about-section h2 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 40px;
}

/* ========== Footer ========== */
.site-footer {
  margin-top: auto;
  padding: 32px 0 24px;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
}

.footer-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.feature-card {
  text-align: center;
  padding: 24px;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.125rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.footer-bottom {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}

.footer-copyright {
  margin-bottom: 16px;
}

.footer-disclaimer {
  max-width: 880px;
  margin: 0 auto;
}

.footer-disclaimer p {
  font-size: 0.75rem;
  line-height: 1.75;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.footer-disclaimer p:last-child {
  margin-bottom: 0;
}

/* ========== Tool Page ========== */
.tool-page {
  background: var(--color-bg);
}

.tool-page-header {
  padding: 32px 0;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}

.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--color-text-secondary);
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb .sep {
  margin: 0 8px;
}

.tool-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-desc {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 720px;
}

.tool-main {
  flex: 1;
  padding: 32px 0 64px;
}

.tool-workspace {
  min-height: 400px;
}

.tool-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 64px 24px;
  background: var(--color-bg-card);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.tool-placeholder h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.tool-placeholder p {
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    gap: 4px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 0.8125rem;
  }

  .category-filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
}
