:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --success-color: #166534;
  --success-bg: #dcfce7;
  --info-color: #1e40af;
  --info-bg: #dbeafe;
  --warning-color: #d97706;
  --warning-bg: #fef3c7;
  --error-color: #dc2626;
  --error-bg: #fef2f2;
  --border-color: #e5e7eb;
  --bg-hover: #f1f5f9;
  --bg-card: #ffffff;
  --text-primary: #374151;
  --text-secondary: #4b5563;
  --accent-color: #3b82f6;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s ease;
}

body {
  max-width: min(1200px, 95%);
  margin: 0 auto;
  padding: 20px;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: #f8fafc;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 0;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: var(--radius-lg);
  color: white;
  box-shadow: var(--shadow-lg);
}

.header h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
}

.header p {
  margin: 0.5rem 0 0 0;
  opacity: 0.9;
  font-size: 1.1rem;
}

.logo-container {
  margin-bottom: 1rem;
}

.logo {
  width: 80px;
  height: 80px;
  filter: brightness(0) invert(1);
}

/* 选项卡样式 */
.tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 0.75rem 1rem;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  font-weight: 500;
  white-space: nowrap;
  min-width: 100px;
}

.tab:hover {
  background-color: var(--bg-hover);
}

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

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* 控制面板 */
.control-panel {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.control-panel label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.control-panel input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--primary-color);
}

/* 状态文本 */
.status-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  background: var(--info-bg);
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
}

.status-text.updating {
  color: var(--warning-color);
  background: var(--warning-bg);
  border-color: #fbbf24;
}

.status-text.success {
  color: var(--success-color);
  background: var(--success-bg);
  border-color: #34d399;
}

.status-text.error {
  color: var(--error-color);
  background: var(--error-bg);
  border-color: #f87171;
}

.status-text.valid {
  color: var(--success-color);
  background: var(--success-bg);
  border-color: #34d399;
}

.status-text.expired {
  color: var(--warning-color);
  background: var(--warning-bg);
  border-color: #fbbf24;
}

.status-text.refreshed {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  font-weight: 600;
}

/* 缓存状态文本 */
.cache-status-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.cache-status-text.cached {
  color: #6b7280;
  background: rgba(107, 114, 128, 0.1);
  border-color: #9ca3af;
}

.cache-status-text.fresh {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
}

/* 按钮样式 */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

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

.btn-secondary {
  background-color: #6b7280;
  color: white;
}

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

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Hosts 容器 */
.hosts-container {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 2rem;
}

.hosts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: #f9fafb;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.copy-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  transition: var(--transition);
}

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

#hosts {
  margin: 0;
  padding: 1.5rem;
  background: #1f2937;
  color: #f9fafb;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

/* 方法卡片 */
.method-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.method-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.method-card h4 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.125rem;
}

.method-card p {
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

.method-card ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.method-card pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.875rem;
  margin: 1rem 0;
}

/* 自定义域名表单 */
.custom-domain-form {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.custom-domain-form h3 {
  margin-top: 0;
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 1rem;
}

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

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: var(--transition);
  box-sizing: border-box;
}

.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: var(--transition);
  box-sizing: border-box;
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 自定义域名列表 */
.custom-domains-list {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.custom-domains-list h3 {
  margin-top: 0;
  color: var(--primary-color);
}

.domain-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  background: #f9fafb;
}

.domain-info h4 {
  margin: 0 0 0.25rem 0;
  color: var(--text-primary);
}

.domain-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.domain-actions {
  display: flex;
  gap: 0.5rem;
}

/* API 表格 */
.api-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.api-table th {
  background-color: #f9fafb;
  padding: 1rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  font-weight: 600;
}

.api-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  vertical-align: top;
}

.api-table tr:last-child td {
  border-bottom: none;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 60px;
}

.method.get {
  background-color: var(--info-bg);
  color: var(--info-color);
}

.method.post {
  background-color: var(--success-bg);
  color: var(--success-color);
}

.method.delete {
  background-color: var(--error-bg);
  color: var(--error-color);
}

/* API 部分 */
.api-section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.api-section h3 {
  margin-top: 0;
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

/* 加载状态 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

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

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

  .header h1 {
    font-size: 2rem;
  }

  .tabs {
    flex-direction: column;
  }

  .tab {
    flex: none;
  }

  .control-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .method-cards {
    grid-template-columns: 1fr;
  }

  .domain-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .api-table {
    font-size: 0.75rem;
  }

  .api-table th,
  .api-table td {
    padding: 0.75rem 1rem;
  }
}

/* 工具提示 */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 1000;
}

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

/* 消息提示 */
.message {
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border-left: 4px solid;
}

.message.success {
  background-color: var(--success-bg);
  border-color: var(--success-color);
  color: var(--success-color);
}

.message.error {
  background-color: var(--error-bg);
  border-color: var(--error-color);
  color: var(--error-color);
}

.message.warning {
  background-color: var(--warning-bg);
  border-color: var(--warning-color);
  color: var(--warning-color);
}

.message.info {
  background-color: var(--info-bg);
  border-color: var(--info-color);
  color: var(--info-color);
}

/* 帮助文本样式 */
.help-text {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.4;
}

.help-text a {
  color: var(--accent-color);
  text-decoration: none;
}

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

/* API Key 标签样式 */
label a {
  color: var(--accent-color);
  text-decoration: none;
  margin-left: 0.5rem;
  font-size: 1.2em;
}

label a:hover {
  opacity: 0.8;
}


