/* 优化全局样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #2c3e50;
  line-height: 1.6;
  padding: 16px;
  min-height: 100vh;
  margin: 0;
}

/* 主容器样式优化 */
.container {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 20px rgba(0, 0, 0, 0.1);
  padding: 40px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 头部样式 */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  font-size: 72px;
  margin-bottom: 20px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.15));
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #2c3e50, #3498db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  font-weight: 700;
}

.subtitle {
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 500;
}

/* 输入区域样式 */
.input-section {
  margin-bottom: 28px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.input-section:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: #374151;
  font-size: 1rem;
}

textarea, input, select {
  width: 100%;
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

textarea:focus, input:focus, select:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
  outline: none;
  transform: translateY(-1px);
}

textarea {
  height: 180px;
  resize: vertical;
  font-family: monospace;
  line-height: 1.5;
}

/* 控制面板样式 */
.control-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* 按钮样式优化 */
.button {
  width: 100%;
  height: 56px;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  color: white;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.button:hover::before {
  left: 100%;
}

.primary-button {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.primary-button:hover {
  background: linear-gradient(135deg, #5a6fd8, #6a4190);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.copy-button {
  background: linear-gradient(135deg, #56ab2f, #a8e6cf);
}

.copy-button:hover {
  background: linear-gradient(135deg, #4e9a2a, #95d3b8);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(86, 171, 47, 0.4);
}

/* 复选框容器样式 */
.checkbox-container {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  padding: 0;
}

.checkbox-container input[type="checkbox"] {
  margin-right: 6px;
}

/* 结果区域样式优化 */
.results-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #e2e8f0;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f2f5;
  flex-wrap: wrap;
}

.results-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.counter {
  background: #f0f2f5;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  color: #666;
}

.results-content {
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* 复制选项样式 */
.copy-options {
  background: #f0f4f8;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  border: 1px solid #e2e8f0;
}

.copy-options .checkbox-container {
  margin: 0;
  font-size: 0.9rem;
  color: #4a5568;
  background: white;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.copy-options .checkbox-container:hover {
  background: #f7fafc;
  border-color: #3498db;
}

.copy-options .checkbox-container input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

/* 卡片内操作区域样式 */
.card-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 40px; /* 确保最小高度一致 */
}

.copy-options-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center; /* 确保内部元素垂直居中 */
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  height: 32px; /* 固定高度确保对齐 */
  box-sizing: border-box;
}

.checkbox-inline::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s;
}

.checkbox-inline:hover {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-color: #667eea;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.checkbox-inline:hover::before {
  left: 100%;
}

.checkbox-inline input[type="checkbox"] {
  display: none;
}

.checkbox-inline .checkbox-custom {
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  position: relative;
  transition: all 0.3s ease;
  background: white;
}

.checkbox-inline .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  color: white;
  font-size: 10px;
  font-weight: bold;
  transition: transform 0.2s ease;
}

.checkbox-inline input[type="checkbox"]:checked + .checkbox-custom {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: #667eea;
}

.checkbox-inline input[type="checkbox"]:checked + .checkbox-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.checkbox-inline span {
  font-weight: 600;
  transition: color 0.3s ease;
}

.checkbox-inline input[type="checkbox"]:checked ~ span {
  color: #667eea;
}

/* 卡片内复制按钮 */
.copy-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
  height: 32px; /* 与复选框相同高度 */
  box-sizing: border-box;
  white-space: nowrap; /* 防止文字换行 */
}

.copy-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.copy-btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
  height: 32px; /* 确保警告按钮也有相同高度 */
}

.copy-btn-warning:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

/* Radio 按钮样式 */
.provider-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 140px;
}

.radio-option:hover {
  border-color: #667eea;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
}

.radio-custom::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #667eea;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.2s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
  border-color: #667eea;
  background: #f0f4ff;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.radio-option input[type="radio"]:checked ~ .radio-label {
  color: #667eea;
  font-weight: 600;
}

.radio-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #374151;
  transition: all 0.3s ease;
}

/* 配置行样式 */
.config-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.config-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-item label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0;
}

.config-item input {
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

/* 输入头部样式 */
.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.import-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.import-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

/* 自定义弹窗样式 */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.custom-modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.custom-modal.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.modal-icon.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.modal-icon.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.modal-icon.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.modal-icon.info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.modal-message {
  color: #6b7280;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.modal-btn.primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.modal-btn.primary:hover {
  background: linear-gradient(135deg, #5a6fd8, #6a4190);
  transform: translateY(-1px);
}

.modal-btn.secondary {
  background: #f3f4f6;
  color: #374151;
}

.modal-btn.secondary:hover {
  background: #e5e7eb;
}

/* 加载动画优化 */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* 底部样式 */
.footer {
  text-align: center;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  color: #666;
  font-size: 0.9rem;
}

.footer a {
  color: #3498db;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* 按钮区域样式优化 */
.actions-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}

/* 响应式设计优化 */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .container {
    padding: 24px;
    border-radius: 16px;
    margin: 0;
  }

  .control-panel {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .logo {
    font-size: 56px;
  }

  .input-section {
    padding: 20px;
  }

  textarea, input, select {
    padding: 14px;
    font-size: 16px; /* 防止iOS缩放 */
  }

  .button {
    height: 52px;
    font-size: 1rem;
  }

  .copy-options {
    flex-direction: column;
    gap: 12px;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
  }

  .copy-options-inline {
    flex: 1;
    align-items: center;
  }

  .provider-options {
    flex-direction: column;
    gap: 12px;
  }

  .radio-option {
    min-width: auto;
  }

  .config-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 20px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .logo {
    font-size: 48px;
  }

  .subtitle {
    font-size: 1rem;
  }

  .input-section {
    padding: 16px;
  }

  .button {
    height: 48px;
    padding: 12px 20px;
  }
}
