:root {
  --primary: #4361ee;
  --primary-light: #4895ef;
  --secondary: #3a0ca3;
  --accent: #f72585;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --light-gray: #e9ecef;
  --border-radius: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}

/* 深色模式变量 */
[data-theme="dark"] {
  --light: #1a1d23;
  --dark: #e9ecef;
  --gray: #adb5bd;
  --light-gray: #2d3239;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--dark);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

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

/* 顶部导航栏 */
header {
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: var(--transition);
}

[data-theme="dark"] header {
  background: #2d3239;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  width: 180px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
}

.weather {
  padding: 8px 12px;
  background: var(--light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.weather i {
  color: var(--primary);
  font-size: 20px;
}

.weather-info {
  display: flex;
  flex-direction: column;
}

.weather-temp {
  font-weight: bold;
  font-size: 16px;
}

.weather-desc {
  font-size: 12px;
  color: var(--gray);
}

.ad-section {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50px;
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
  border-radius: 6px;
  color: white;
  font-weight: bold;
  font-size: 16px;
  margin: 0 20px;
}

[data-theme="dark"] .ad-section {
  background: linear-gradient(135deg, #4a5568 0%, #718096 100%);
}

/* 导航栏单独一行 - 靠左对齐 */
.nav-bar {
  background: white;
  border-top: 1px solid var(--light-gray);
  padding: 10px 0;
  transition: var(--transition);
}

[data-theme="dark"] .nav-bar {
  background: #2d3239;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 25px;
  justify-content: flex-start;
}

nav a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 500;
  transition: var(--transition);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
}

nav a:hover {
  background: var(--light);
  color: var(--primary);
}

/* 主内容区域 */
.main-container {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin: 15px auto;
  min-height: 550px;
  transition: var(--transition);
}

[data-theme="dark"] .main-container {
  background: #2d3239;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 0;
  min-height: 550px;
}

.controls-panel {
  background: var(--light);
  padding: 15px;
  border-right: 1px solid var(--light-gray);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.control-group {
  background: white;
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

[data-theme="dark"] .control-group {
  background: #1a1d23;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.control-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--dark);
  font-size: 13px;
  min-width: 90px;
  flex-shrink: 0;
}

.control-label i {
  color: var(--primary);
  font-size: 0.8rem;
}

input[type="number"],
select,
input[type="text"] {
  padding: 6px 8px;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  background: white;
  font-size: 12px;
  transition: var(--transition);
  color: var(--dark);
}

[data-theme="dark"] input[type="number"],
[data-theme="dark"] select,
[data-theme="dark"] input[type="text"] {
  background: #2d3239;
  border-color: #3d4249;
}

input[type="number"]:focus,
select:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

input[type="number"] {
  width: 70px;
}

select {
  width: 80px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: white;
  border-radius: 4px;
  border: 1px solid var(--light-gray);
  transition: var(--transition);
}

[data-theme="dark"] .checkbox-group {
  background: #1a1d23;
  border-color: #3d4249;
}

.checkbox-group:hover {
  border-color: var(--primary);
}

.checkbox-group input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.checkbox-group label {
  font-weight: 500;
  cursor: pointer;
  font-size: 13px;
  color: var(--dark);
}

.action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(67, 97, 238, 0.2);
}

.btn-secondary {
  background: var(--light-gray);
  color: var(--dark);
}

.btn-secondary:hover {
  background: #d1d5db;
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: #e11574;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(247, 37, 133, 0.2);
}

.text-area-container {
  padding: 15px;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.text-area-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.text-area-actions {
  display: flex;
  gap: 6px;
}

.text-area-actions .btn {
  flex: none;
  padding: 6px 10px;
  font-size: 12px;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 250px;
  padding: 12px;
  border: 1px solid var(--light-gray);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  transition: var(--transition);
  background: var(--light);
  color: var(--dark);
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.find-replace-section {
  margin-top: auto;
  padding: 12px;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--light-gray);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

[data-theme="dark"] .find-replace-section {
  background: #1a1d23;
}

.find-replace-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.find-replace-row input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  background: white;
  font-size: 12px;
  transition: var(--transition);
  color: var(--dark);
}

[data-theme="dark"] .find-replace-row input {
  background: #2d3239;
  border-color: #3d4249;
}

.find-replace-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.stats {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--light-gray);
  font-size: 12px;
  color: var(--gray);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 160px;
  background-color: var(--dark);
  color: white;
  text-align: center;
  border-radius: 4px;
  padding: 6px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -80px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 11px;
  white-space: normal;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

/* 简繁转换部分 - 修复布局 */
.radio-group {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 0;
  width: 100%;
  justify-content: space-between;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  flex: 1;
  justify-content: center;
  padding: 4px 6px;
  border-radius: 4px;
  transition: var(--transition);
  white-space: nowrap;
}

.radio-option:hover {
  background: var(--light);
}

.radio-option input[type="radio"] {
  accent-color: var(--primary);
  margin: 0;
}

/* 提示框样式 - 修改为居中 */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
}

/* 加载动画 */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 6px;
}

[data-theme="dark"] .loading-overlay {
  background: rgba(45, 50, 57, 0.9);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--light-gray);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 8px;
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
}

/* 底部区域 - 直接显示所有信息 */
footer {
  background: var(--dark);
  color: white;
  padding: 20px 0 10px;
  margin-top: 15px;
  transition: var(--transition);
}

[data-theme="dark"] footer {
  background: #1a1d23;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 15px;
}

.footer-logo {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
  color: white;
}

.footer-desc {
  color: #aaa;
  margin-bottom: 10px;
  line-height: 1.4;
  font-size: 13px;
}

.friend-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.friend-links a {
  color: #aaa;
  text-decoration: none;
  transition: var(--transition);
}

.friend-links a:hover {
  color: white;
}

.footer-column h3 {
  margin-bottom: 10px;
  font-size: 14px;
  position: relative;
  padding-bottom: 6px;
}

.footer-column h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 25px;
  height: 2px;
  background: var(--primary);
}

.footer-links {
  list-style: none;
}

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

.footer-links a {
  color: #aaa;
  text-decoration: none;
  transition: var(--transition);
  font-size: 12px;
}

.footer-links a:hover {
  color: white;
  padding-left: 3px;
}

.contact-info {
  display: block;
  margin-top: 8px;
  color: #aaa;
  line-height: 1.4;
  font-size: 12px;
}

.copyright {
  text-align: center;
  padding-top: 12px;
  border-top: 1px solid #444;
  color: #aaa;
  font-size: 12px;
}

.copyright a {
  color: #aaa;
  text-decoration: none;
  transition: var(--transition);
}

.copyright a:hover {
  color: white;
}

/* 主题切换按钮 */
.theme-switcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: var(--transition);
}

.theme-btn:hover {
  transform: scale(1.1);
}

.theme-menu {
  position: absolute;
  bottom: 60px;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
  transition: var(--transition);
}

[data-theme="dark"] .theme-menu {
  background: #2d3239;
}

.theme-menu.show {
  display: flex;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--dark);
}

.theme-option:hover {
  background: var(--light);
}

.theme-option.active {
  background: var(--primary);
  color: white;
}

.theme-option i {
  font-size: 16px;
}

@media (max-width: 992px) {
  .main-content {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  
  .controls-panel {
    border-right: none;
    border-bottom: 1px solid var(--light-gray);
    max-height: none;
    gap: 10px;
  }
  
  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
  
  .top-bar {
    flex-direction: column;
    gap: 10px;
  }
  
  .logo-section {
    width: 100%;
    justify-content: center;
  }
  
  .ad-section {
    width: 100%;
    margin: 0;
  }
  
  .find-replace-row {
    flex-direction: column;
  }
  
  .find-replace-section {
    margin-top: 10px;
  }
}

@media (max-width: 768px) {
  .controls-panel, .text-area-container {
    padding: 12px;
  }
  
  .control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 8px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .stats {
    flex-direction: column;
    gap: 6px;
  }
  
  .compact-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
  }
  
  nav ul {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }
  
  input[type="number"],
  select {
    width: 100%;
  }
  
  /* 在移动设备上，简繁转换选项恢复垂直布局 */
  .radio-group {
    flex-direction: column;
    gap: 6px;
  }

  .theme-switcher {
    bottom: 10px;
    right: 10px;
  }
  
  .theme-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}