/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* 导航栏 */
.navbar {
  background: #1a1a2e;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.navbar .logo::before {
  content: "⚙️";
  font-size: 24px;
}

.navbar .nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
  align-items: center;
}

.navbar .nav-links a {
  color: #ccc;
  text-decoration: none;
  font-size: 15px;
  transition: color 0.3s;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.navbar .nav-links a:hover,
.navbar .nav-links a.active {
  color: #4fc3f7;
  border-bottom-color: #4fc3f7;
}

/* 搜索框 */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 8px 16px 8px 36px;
  color: #fff;
  font-size: 14px;
  width: 200px;
  transition: all 0.3s;
  outline: none;
}

.nav-search input::placeholder {
  color: rgba(255,255,255,0.4);
}

.nav-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: #4fc3f7;
  width: 260px;
}

.nav-search::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  font-size: 14px;
  z-index: 1;
}

/* 汉堡菜单按钮 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* 主容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* 英雄区 */
.hero {
  text-align: center;
  padding: 50px 30px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  border-radius: 12px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(79, 195, 247, 0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.hero h1 {
  font-size: 32px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.hero p {
  font-size: 15px;
  color: #aaa;
  max-width: 600px;
  margin: 0 auto 24px;
  position: relative;
  z-index: 1;
}

/* 统计数字区 */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 30px;
  position: relative;
  z-index: 1;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: bold;
  color: #4fc3f7;
  display: block;
}

.stat-label {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* 板块标题（统一样式） */
.section-title {
  margin: 40px 0 20px;
  font-size: 22px;
  color: #1a1a2e;
  position: relative;
  padding-left: 16px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: #4fc3f7;
  border-radius: 2px;
}

.section-title small {
  font-size: 14px;
  color: #888;
  font-weight: normal;
  margin-left: 8px;
}

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid #eee;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #4fc3f7;
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.card::after {
  content: "→";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #ccc;
  font-size: 18px;
  transition: all 0.3s;
  opacity: 0;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: #4fc3f7;
}

.card:hover::before {
  transform: scaleY(1);
}

.card:hover::after {
  opacity: 1;
  right: 16px;
  color: #4fc3f7;
}

.card:active {
  transform: translateY(-2px) scale(0.98);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.card .icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #1a1a2e;
  padding-right: 30px;
}

.card p {
  color: #666;
  font-size: 14px;
  line-height: 1.7;
}

/* 子页面头部 */
.sub-header {
  background: #1a1a2e;
  color: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.sub-header::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(79, 195, 247, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.sub-header h1 {
  font-size: 26px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.sub-header p {
  color: #aaa;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

/* 工具列表 */
.tool-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.tool-list li {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.3s ease;
  border: 1px solid #eee;
  cursor: pointer;
}

.tool-list li:hover {
  transform: translateX(4px);
  border-color: #4fc3f7;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.15);
}

.tool-list .tool-icon {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tool-list .tool-info h4 {
  font-size: 16px;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.tool-list .tool-info p {
  font-size: 13px;
  color: #888;
  line-height: 1.5;
}

/* 返回按钮 */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: #4fc3f7;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s;
}

.back-link:hover {
  color: #1a1a2e;
  text-decoration: none;
}

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: #1a1a2e;
  color: #4fc3f7;
  border: 2px solid #4fc3f7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 99;
  text-decoration: none;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: #4fc3f7;
  color: #1a1a2e;
  transform: translateY(-2px);
}

/* 页脚 */
.footer {
  background: #1a1a2e;
  color: #aaa;
  padding: 40px 20px 30px;
  margin-top: 60px;
  border-radius: 12px 12px 0 0;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}

.footer-col h4 {
  color: #fff;
  font-size: 16px;
  margin-bottom: 16px;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul li a {
  color: #888;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s;
}

.footer-col ul li a:hover {
  color: #4fc3f7;
}

.footer-bottom {
  max-width: 1200px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 13px;
  color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .navbar {
    flex-direction: row;
    gap: 0;
    padding: 12px 20px;
  }

  .navbar .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a2e;
    padding: 16px 20px;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  .navbar .nav-links.open {
    display: flex;
  }

  .navbar .nav-links a {
    padding: 10px 0;
    border-bottom: none;
    font-size: 16px;
  }

  .navbar .nav-links a:hover,
  .navbar .nav-links a.active {
    border-bottom: none;
    background: rgba(79, 195, 247, 0.1);
    border-radius: 6px;
    padding-left: 12px;
  }

  .nav-search input {
    width: 100%;
  }

  .nav-search input:focus {
    width: 100%;
  }

  .hero h1 {
    font-size: 24px;
  }

  .stats-row {
    gap: 20px;
  }

  .stat-number {
    font-size: 22px;
  }

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

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

  .footer-content {
    grid-template-columns: 1fr;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

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

  .flow-steps {
    flex-direction: column;
    align-items: flex-start;
  }

  .flow-steps .flow-arrow {
    transform: rotate(90deg);
    margin: 8px 0;
  }

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

  .alarm-search-box {
    flex-direction: column;
  }

  .cutting-table-wrapper {
    overflow-x: auto;
  }
}

/* 快捷工具网格 */
.quick-tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.quick-tool-btn {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s;
  cursor: pointer;
}

.quick-tool-btn:hover {
  border-color: #4fc3f7;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.15);
  transform: translateY(-2px);
}

.quick-tool-btn .tool-emoji {
  font-size: 28px;
  display: block;
  margin-bottom: 8px;
}

.quick-tool-btn .tool-name {
  font-size: 14px;
  font-weight: bold;
  color: #1a1a2e;
}

/* 今日推荐 */
.daily-pick {
  background: linear-gradient(135deg, #1a1a2e 0%, #0d1b3e 100%);
  border-radius: 12px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.daily-pick::before {
  content: "";
  position: absolute;
  top: -30%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(79, 195, 247, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.daily-pick .pick-badge {
  background: #4fc3f7;
  color: #1a1a2e;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.daily-pick .pick-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.daily-pick .pick-content h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.daily-pick .pick-content p {
  font-size: 13px;
  color: #aaa;
}

.daily-pick .pick-arrow {
  font-size: 20px;
  color: #4fc3f7;
  position: relative;
  z-index: 1;
}

/* 设计流程图 */
.flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 20px;
  flex-wrap: wrap;
}

.flow-step {
  background: #fff;
  border: 2px solid #4fc3f7;
  border-radius: 10px;
  padding: 14px 20px;
  text-align: center;
  min-width: 120px;
  transition: all 0.3s;
  text-decoration: none;
  color: inherit;
}

.flow-step:hover {
  background: #4fc3f7;
  color: #fff;
  transform: scale(1.05);
}

.flow-step .step-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 6px;
}

.flow-step .step-name {
  font-size: 13px;
  font-weight: bold;
  color: #1a1a2e;
}

.flow-step:hover .step-name {
  color: #fff;
}

.flow-arrow {
  font-size: 20px;
  color: #4fc3f7;
  margin: 0 8px;
  flex-shrink: 0;
}

/* 公式速查卡片 */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.formula-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s;
}

.formula-card:hover {
  border-color: #4fc3f7;
  box-shadow: 0 4px 12px rgba(79, 195, 247, 0.1);
}

.formula-card h4 {
  font-size: 15px;
  color: #1a1a2e;
  margin-bottom: 10px;
}

.formula-card .formula {
  background: #f5f7fa;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  border-left: 3px solid #4fc3f7;
}

.formula-card .formula-desc {
  font-size: 12px;
  color: #888;
}

/* 报警代码查询 */
.alarm-search-box {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  align-items: center;
}

.alarm-search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #eee;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
}

.alarm-search-box input:focus {
  border-color: #4fc3f7;
}

.alarm-search-box button {
  background: #4fc3f7;
  color: #1a1a2e;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.alarm-search-box button:hover {
  background: #1a1a2e;
  color: #4fc3f7;
}

/* 切削参数速查表 */
.cutting-table-wrapper {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eee;
}

.cutting-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cutting-table thead {
  background: #1a1a2e;
  color: #fff;
}

.cutting-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: bold;
}

.cutting-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
}

.cutting-table tbody tr:hover {
  background: rgba(79, 195, 247, 0.05);
}

.cutting-table tbody tr:last-child td {
  border-bottom: none;
}

/* 收藏本站横幅 */
.bookmark-banner {
  background: linear-gradient(90deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  position: relative;
  z-index: 101;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.bookmark-banner .bookmark-text {
  color: #ccc;
}

.bookmark-banner .bookmark-text strong {
  color: #4fc3f7;
}

.bookmark-banner .bookmark-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.bookmark-banner .bookmark-close:hover {
  color: #fff;
}

.bookmark-banner.hidden {
  display: none;
}

/* 暗色模式切换按钮 */
.dark-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s;
  flex-shrink: 0;
}

.dark-toggle:hover {
  background: rgba(79, 195, 247, 0.2);
  border-color: #4fc3f7;
}

/* 暗色模式 */
body.dark-mode {
  background: #0d1117;
  color: #c9d1d9;
}

body.dark-mode .hero {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}

body.dark-mode .sub-header {
  background: #0d1117;
}

body.dark-mode .card,
body.dark-mode .formula-card,
body.dark-mode .quick-tool-btn,
body.dark-mode .flow-step {
  background: #161b22;
  border-color: #30363d;
}

body.dark-mode .card h3,
body.dark-mode .card .tool-name,
body.dark-mode .formula-card h4,
body.dark-mode .flow-step .step-name,
body.dark-mode .section-title {
  color: #e6edf3;
}

body.dark-mode .card p,
body.dark-mode .formula-card .formula-desc {
  color: #8b949e;
}

body.dark-mode .formula-card .formula {
  background: #0d1117;
  border-left-color: #4fc3f7;
  color: #c9d1d9;
}

body.dark-mode .cutting-table-wrapper {
  border-color: #30363d;
}

body.dark-mode .cutting-table td {
  border-bottom-color: #30363d;
}

body.dark-mode .cutting-table tbody tr:hover {
  background: rgba(79, 195, 247, 0.08);
}

body.dark-mode .alarm-search-box input {
  background: #161b22;
  border-color: #30363d;
  color: #c9d1d9;
}

body.dark-mode .navbar {
  background: #0d1117;
}

body.dark-mode .footer {
  background: #0d1117;
}

body.dark-mode .daily-pick {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
}

body.dark-mode .back-to-top {
  background: #0d1117;
}

body.dark-mode .bookmark-banner {
  background: linear-gradient(90deg, #0d1117 0%, #161b22 100%);
}

@media (max-width: 768px) {
  .quick-tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .flow-steps {
    flex-direction: column;
    align-items: flex-start;
  }

  .flow-steps .flow-arrow {
    transform: rotate(90deg);
    margin: 8px 0;
  }

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

  .alarm-search-box {
    flex-direction: column;
  }

  .cutting-table-wrapper {
    overflow-x: auto;
  }

  .daily-pick {
    flex-direction: column;
    text-align: center;
  }
}
