/* 通用样式变量 */
:root {
  --primary-color: #4a90d9;
  --primary-hover: #357abd;
  --success-color: #52c41a;
  --error-color: #ff4d4f;
  --warning-color: #faad14;
  --text-color: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --border-color: #e8e8e8;
  --bg-color: #f5f7fa;
  --card-bg: #ffffff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.3s ease;
}

/* 重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px;
  margin-bottom: 20px;
}

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

.header h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 表单元素 */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: var(--transition);
  font-family: inherit;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

textarea::placeholder {
  color: var(--text-muted);
}

/* 选择框 */
select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--card-bg);
  cursor: pointer;
  transition: var(--transition);
}

select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 输入框 */
input[type="number"] {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e8e8e8;
}

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

.btn-success:hover {
  background: #45a818;
}

.btn-block {
  width: 100%;
}

/* 结果区域 */
.result {
  display: none;
  margin-top: 20px;
  padding: 20px;
  background: #f0f9ff;
  border-radius: var(--radius);
  border: 1px solid #b3d8ff;
}

.result.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.result-title {
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.result-link {
  display: flex;
  gap: 10px;
  align-items: center;
}

.result-link input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  background: white;
}

.result-info {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 文本展示区域 */
.text-content {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.8;
  max-height: 500px;
  overflow-y: auto;
}

/* 元信息 */
.meta-info {
  display: flex;
  gap: 20px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* 错误页面 */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.error-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.error-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-color);
}

.error-desc {
  color: var(--text-secondary);
  margin-bottom: 30px;
}

/* 提示消息 */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: var(--success-color);
  color: white;
}

.toast.error {
  background: var(--error-color);
  color: white;
}

/* 加载状态 */
.loading {
  display: none;
  text-align: center;
  padding: 40px;
}

.loading.show {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 15px;
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 自定义天数输入框 */
.custom-days {
  display: none;
  margin-top: 10px;
}

.custom-days.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* 页脚 */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .card {
    padding: 20px;
  }

  .header h1 {
    font-size: 22px;
  }

  textarea {
    min-height: 150px;
  }

  .result-link {
    flex-direction: column;
  }

  .result-link .btn {
    width: 100%;
  }

  .meta-info {
    flex-direction: column;
    gap: 10px;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
