/* Page-specific styles for tools4.html. */
:root {
  /* 更清新现代的配色方案 */
  --primary: #3498db; /* 蓝色主色调，更专业 */
  --primary-light: #46b8da; /* 亮蓝色 */
  --primary-gradient: linear-gradient(135deg, #3498db 0%, #46b8da 100%);
  --secondary: #2ecc71; /* 绿色作为辅助色 */

  /* 背景色系 - 更柔和 */
  --background: #f8f9fa; /* 浅灰背景 */
  --card-bg: #ffffff; /* 纯白卡片 */
  --input-bg: #f8f9fa; /* 输入框浅灰背景 */
  --input-focus-bg: #e3f2fd; /* 聚焦时的蓝色背景 */

  /* 边框与分割线 */
  --border: #e9ecef; /* 更浅的边框 */
  --divider: #dee2e6; /* 标准分割线 */

  /* 文字颜色 */
  --text-primary: #212529; /* 深灰文字 */
  --text-secondary: #495057; /* 次要文字 */
  --text-light: #6c757d; /* 轻量文字 */
  --text-muted: #adb5bd; /* 更淡的文字 */

  /* 阴影效果 - 更自然 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);

  /* 间距系统 */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* 圆角 */
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;

  /* 动画 */
  --transition-fast: all 0.2s ease-in-out;
  --transition-normal: all 0.3s ease-in-out;
}

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

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding: var(--spacing-md);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* 顶部标题区域 */
.header-section {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md) 0;
}

.app-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--spacing-sm);
  position: relative;
  display: inline-block;
}

.app-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.header-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
}

/* 主卡片容器 */
.main-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: var(--spacing-lg);
}

.card-header {
  background: var(--primary-gradient);
  padding: var(--spacing-md) var(--spacing-lg);
  color: white;
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 两栏布局 - 左侧输入，右侧结果 */
.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

@media (min-width: 992px) {
  .main-content {
    grid-template-columns: 1fr 1fr;
  }
}

/* 输入区域 */
.input-section {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-group {
  margin-bottom: var(--spacing-md);
}

label {
  display: block;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-container {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

input,
select {
  width: 100%;
  padding: 12px 15px 12px 40px;
  border: 2px solid var(--border);
  border-radius: var(--border-radius-md);
  font-size: 1rem;
  background: var(--input-bg);
  transition: var(--transition-fast);
  color: var(--text-primary);
  font-family: inherit;
}

input:focus,
select:focus {
  background: var(--input-focus-bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  outline: none;
}

.input-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: var(--spacing-xs);
  padding-left: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.example-inputs {
  margin-top: var(--spacing-xs);
  font-size: 0.9rem;
  color: var(--text-light);
}

.example-inputs a {
  color: var(--primary);
  text-decoration: none;
  margin: 0 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.example-inputs a:hover {
  text-decoration: underline;
  color: var(--primary-light);
}

/* 按钮样式 */
.action-button {
  width: 100%;
  padding: 14px 20px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  margin: var(--spacing-md) 0;
  transition: var(--transition-normal);
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(52, 152, 219, 0.25);
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(52, 152, 219, 0.3);
}

.action-button:active {
  transform: translateY(0);
}

.secondary-button {
  background: linear-gradient(135deg, #6c757d 0%, #868e96 100%);
}

.secondary-button:hover {
  box-shadow: 0 5px 10px rgba(108, 117, 125, 0.3);
}

/* 结果区域 */
.results-section {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
}

.result-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(5px);
}

.result-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--divider);
}

.result-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px dashed var(--divider);
}

.result-item:last-child {
  border-bottom: none;
}

.result-icon {
  background: var(--primary-light);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.result-content {
  flex: 1;
}

.result-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.result-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

/* 优化方案区域 */
.optimization-section {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  border: 1px solid #90caf9;
  display: none;
}

.optimization-section.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* 历史记录区域 */
.history-section {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: var(--spacing-md);
}

.history-item {
  padding: 12px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item:hover {
  background: #e3f2fd;
}

.history-item:last-child {
  border-bottom: none;
}

.history-dimensions {
  font-weight: 500;
  color: var(--primary);
}

.history-timestamp {
  font-size: 0.85rem;
  color: var(--text-light);
  white-space: nowrap;
}

/* 高级选项 */
.advanced-section {
  background: #f8f9fa;
  border-radius: var(--border-radius-md);
  padding: var(--spacing-md);
  margin-top: var(--spacing-md);
  border: 1px solid var(--divider);
}

.switch-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--spacing-sm) 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(30px);
}

/* 错误提示 */
.error-box {
  background: linear-gradient(to right, #ffedee, #ffebee);
  color: #e53935;
  padding: var(--spacing-md);
  border-left: 4px solid #e53935;
  border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
  margin: var(--spacing-md) 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.error-icon {
  background: #e53935;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

/* 底部信息 */
.footer-info {
  text-align: center;
  margin-top: var(--spacing-lg);
  color: var(--text-light);
  font-size: 0.9rem;
  padding: var(--spacing-md);
}

.info-badge {
  display: inline-block;
  background: #e9ecef;
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  margin: 0 8px;
  transition: var(--transition-fast);
}

.info-badge:hover {
  background: var(--primary);
  color: white;
}

.clear-history {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.clear-history:hover {
  background: #e9ecef;
  color: #e53935;
}

/* 响应式调整 */
@media (max-width: 768px) {
  body {
    padding: var(--spacing-sm);
  }

  .header-section {
    margin-bottom: var(--spacing-md);
  }

  .app-title {
    font-size: 1.8rem;
  }

  .main-content {
    grid-template-columns: 1fr;
    padding: var(--spacing-md);
  }

  .input-section,
  .results-section {
    padding: var(--spacing-md);
  }

  input,
  select {
    font-size: 0.95rem;
    padding: 10px 15px 10px 40px;
  }

  .action-button {
    font-size: 1rem;
    padding: 12px;
  }

  .history-list {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .app-title {
    font-size: 1.6rem;
  }

  .header-description {
    font-size: 0.95rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .example-inputs {
    font-size: 0.85rem;
  }

  .result-value {
    font-size: 1.1rem;
  }
}
