/* 引入现代字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* 基础样式重置与变量定义 */
:root {
  --primary: #3498db;
  --primary-dark: #2980b9;
  --secondary: #e74c3c;
  --accent: #f39c12;
  --text-dark: #2c3e50;
  --text-light: #7f8c8d;
  --bg-light: #f9f9f9;
  --bg-dark: #ecf0f1;
  --white: #ffffff;
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--bg-light);
  background-image: radial-gradient(var(--bg-dark) 1px, transparent 1px);
  background-size: 20px 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 头部样式 */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  text-align: center;
  padding: 1.5rem 0;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-container header {
  width: 100%;
}

.logo-container {
  text-align: left;
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

header p {
  font-size: 1rem;
  opacity: 0.9;
  max-width: 500px;
  position: relative;
  z-index: 1;
}

/* 汉堡菜单样式 */
.menu-toggle {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
  z-index: 100;
}

/* 移动端菜单样式 */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background-color: var(--white);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  z-index: 99;
  overflow-y: auto;
}

.mobile-menu.active {
  right: 0;
}

.menu-items {
  list-style: none;
  padding: 2rem 1rem;
}

.menu-items li {
  margin-bottom: 1rem;
}

.menu-items a {
  display: flex;
  align-items: center;
  color: var(--text-dark);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.menu-items a:hover {
  background-color: var(--bg-light);
  color: var(--primary);
}

.menu-items i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
}

/* 遮罩层 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 98;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 主内容区样式 - 保持不变 */
main {
  padding-bottom: 3rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 0 1rem;
}

.tool-card {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  border-top: 4px solid var(--primary);
}

.tool-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.tool-card:nth-child(4n + 1) {
  border-top-color: var(--primary);
}

.tool-card:nth-child(4n + 2) {
  border-top-color: var(--secondary);
}

.tool-card:nth-child(4n + 3) {
  border-top-color: var(--accent);
}

.tool-card:nth-child(4n + 4) {
  border-top-color: #2ecc71;
}

.tool-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.tool-card:nth-child(4n + 1) .tool-icon {
  color: var(--primary);
}

.tool-card:nth-child(4n + 2) .tool-icon {
  color: var(--secondary);
}

.tool-card:nth-child(4n + 3) .tool-icon {
  color: var(--accent);
}

.tool-card:nth-child(4n + 4) .tool-icon {
  color: #2ecc71;
}

.tool-card h3 {
  color: var(--text-dark);
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.tool-card p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.btn {
  display: inline-block;
  background-color: var(--primary);
  color: var(--white);
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  transition: var(--transition);
  font-weight: 500;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 4px 6px rgba(52, 152, 219, 0.15);
}

.btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(52, 152, 219, 0.25);
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.btn:focus::after {
  animation: ripple 1.5s ease-out;
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%);
    width: 5px;
    height: 5px;
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* 工具页面样式 */
.tool-container {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.tool-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bg-dark);
}

.tool-header h2 {
  font-size: 1.6rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.tool-header p {
  color: var(--text-light);
}

/* 输入区域样式 */
.input-container {
  margin-bottom: 2rem;
}

.input-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
  color: var(--text-dark);
}

.text-input {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--bg-dark);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  resize: vertical;
  min-height: 150px;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 选项区域样式 */
.options-container {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: var(--bg-light);
  border-radius: var(--radius);
}

.option-group {
  margin-bottom: 1rem;
}

.option-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.radio-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding-left: 2rem;
  user-select: none;
}

.radio-item input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

/* 自定义 radio 按钮 */
.radio-item .checkmark {
  position: absolute;
  left: 0;
  height: 1.25rem;
  width: 1.25rem;
  background-color: var(--bg-light);
  border: 2px solid var(--text-light);
  border-radius: 50%;
  transition: var(--transition);
}

/* 悬停状态 */
.radio-item:hover input ~ .checkmark {
  background-color: var(--bg-dark);
  border-color: var(--primary);
}

/* 选中状态 */
.radio-item input:checked ~ .checkmark {
  background-color: var(--white);
  border-color: var(--primary);
}

/* 选中时的内部圆点 */
.radio-item input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  display: block;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--primary);
}

/* 优化 select 元素样式 */
.select-option {
  width: 100%;
  padding: 0.8rem 3rem 0.8rem 1rem;
  border: 1px solid var(--bg-dark);
  border-radius: var(--radius);
  background-color: var(--white);
  font-size: 1rem;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  transition: var(--transition);
  cursor: pointer;
}

.select-option:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.select-option:hover {
  border-color: var(--primary);
}

/* 适配现有 checkbox 样式 */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding-left: 2rem;
  user-select: none;
}

.checkbox-item input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

/* 自定义 checkbox */
.checkbox-item .checkmark {
  position: absolute;
  left: 0;
  height: 1.25rem;
  width: 1.25rem;
  background-color: var(--bg-light);
  border: 2px solid var(--text-light);
  border-radius: 4px;
  transition: var(--transition);
}

/* 悬停状态 */
.checkbox-item:hover input ~ .checkmark {
  background-color: var(--bg-dark);
  border-color: var(--primary);
}

/* 选中状态 */
.checkbox-item input:checked ~ .checkmark {
  background-color: var(--white);
  border-color: var(--primary);
}

/* 选中时的对勾 */
.checkbox-item input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  display: block;
  left: 0.30rem;
  top: -0.03rem;
  width: 0.4rem;
  height: 0.7rem;
  border: solid var(--primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.output-container {
  margin-top: 2rem;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.output-header h3 {
  font-size: 1.25rem;
  color: var(--text-dark);
}

/* 页脚样式 */
footer {
  background-color: var(--text-dark);
  color: var(--white);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
  border-radius: var(--radius) var(--radius) 0 0;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-links a {
  color: var(--white);
  text-decoration: none;
  margin: 0 0.75rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-copyright {
  margin-top: 1rem;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }

  .tool-card {
    padding: 1.5rem;
  }

  .tool-container {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 1rem 0;
  }

  header h1 {
    font-size: 1.3rem;
  }

  header p {
    font-size: 0.9rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
}

.logo-container h1 a {
  color: inherit; /* 继承h1标签的颜色 */
  text-decoration: none; /* 移除下划线 */
  display: inline-block; /* 确保点击区域正确 */
  transition: transform 0.2s ease; /* 添加轻微的悬停效果 */
}

.logo-container h1 a:hover {
  transform: scale(1.02); /* 悬停时轻微放大 */
}

/* 优化分割数量输入框样式 */
#split-count {
  width: 100px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--bg-dark);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

#split-count:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 优化分割结果内容区域样式 */
.split-part-content {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--bg-dark);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  background-color: var(--white);
  transition: var(--transition);
}

.split-part-content:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* 优化单个部分复制按钮样式 */
.copy-part-btn {
  background-color: var(--bg-light);
  color: var(--text-dark);
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.copy-part-btn:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
}

.copy-part-btn i {
  font-size: 0.75rem;
}

/* 优化分割部分容器样式 */
.split-part {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background-color: var(--bg-light);
  border-radius: var(--radius);
}

.split-part-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.split-part-header span {
  font-weight: 600;
  color: var(--text-dark);
}

/* 优化自定义分隔符输入框样式 */
#custom-delimiter {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--bg-dark);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

#custom-delimiter:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}
