/**
 * Spaceship DNS Web 全局样式
 * 作者: VT SEO团队
 * 日期: 2025-12-02
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* ========== 通用容器 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

/* 登录页 Logo */
.login-logo {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 20px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 10px;
  color: #333;
  font-size: 24px;
}

.login-box .subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 14px;
}

.role-selector {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.role-selector label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 10px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s;
}

.role-selector label:hover {
  border-color: #667eea;
}

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

.role-selector input[type="radio"]:checked + span {
  color: #667eea;
  font-weight: 600;
}

.role-selector label:has(input:checked) {
  border-color: #667eea;
  background: #f0f3ff;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #444;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
  font-family: monospace;
}

.form-group .hint {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

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

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* ========== 错误提示 ========== */
.error-message {
  background: #fee;
  color: #c0392b;
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  display: none;
}

.error-message.show {
  display: block;
}

/* ========== 头部导航 ========== */
.header {
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: auto;
}

.header h1 {
  font-size: 20px;
  color: #333;
}

.header .user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header .user-role {
  font-size: 14px;
  color: #666;
  background: #f0f0f0;
  padding: 4px 12px;
  border-radius: 20px;
}

/* ========== 标签页导航 ========== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
}

.tab {
  padding: 12px 24px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab:hover {
  color: #667eea;
}

.tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  font-weight: 500;
}

.tab-content {
  display: none;
}

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

/* ========== 卡片 ========== */
.card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

/* ========== 表格 ========== */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 13px;
  color: #666;
}

td {
  font-size: 14px;
}

tr:hover {
  background: #f8f9fa;
}

.actions {
  display: flex;
  gap: 8px;
}

/* ========== 主机记录复选框 ========== */
.host-records-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

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

.host-record-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.host-record-item label {
  font-size: 14px;
  cursor: pointer;
}

.custom-record-input {
  width: 200px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

/* ========== 进度条 ========== */
.progress-container {
  margin: 20px 0;
}

.progress-bar {
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 500;
}

.progress-text {
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
  color: #666;
}

/* ========== 结果列表 ========== */
.result-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-top: 15px;
}

.result-item {
  padding: 10px 15px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  font-family: monospace;
}

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

.result-item.success {
  background: #f0fff4;
  color: #22543d;
}

.result-item.error {
  background: #fff5f5;
  color: #c53030;
}

.result-item .domain {
  font-weight: 600;
}

/* ========== 统计摘要 ========== */
.summary {
  display: flex;
  gap: 30px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-top: 15px;
}

.summary-item {
  text-align: center;
}

.summary-item .value {
  font-size: 24px;
  font-weight: 600;
}

.summary-item .label {
  font-size: 12px;
  color: #666;
}

.summary-item.success .value {
  color: #22543d;
}

.summary-item.failed .value {
  color: #c53030;
}

/* ========== 模态框 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

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

.modal {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  border-radius: 4px;
}

.pagination button:hover {
  background: #f0f0f0;
}

.pagination button.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 加载状态 ========== */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f0f0f0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== 子标签页 ========== */
.sub-tabs {
  display: flex;
  gap: 0;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}

.sub-tab {
  padding: 8px 16px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 13px;
  color: #666;
  border-radius: 6px;
  transition: all 0.2s;
}

.sub-tab:hover {
  color: #667eea;
}

.sub-tab.active {
  background: white;
  color: #667eea;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sub-tab-content {
  display: none;
}

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

/* ========== 域名工具输入输出区 ========== */
.tool-input-section {
  margin-bottom: 20px;
}

.tool-output-section {
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.dual-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dual-input-row .form-group {
  margin-bottom: 0;
}

.dual-output-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ========== 工具结果区域 ========== */
.tool-result {
  margin-top: 15px;
}

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

.tool-result-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.tool-result-actions {
  display: flex;
  gap: 8px;
}

.tool-result-content {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
}

.tool-result-content.readonly-textarea {
  width: 100%;
  resize: vertical;
}

/* ========== 分类结果分组 ========== */
.classify-groups {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.classify-group {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.classify-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.classify-group-title {
  font-weight: 600;
  font-size: 14px;
}

.classify-group-title .suffix {
  color: #667eea;
}

.classify-group-title .count {
  color: #888;
  font-weight: 400;
  margin-left: 8px;
}

.classify-group-actions {
  display: flex;
  gap: 8px;
}

.classify-group-content {
  padding: 12px 15px;
  font-family: monospace;
  font-size: 13px;
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.8;
}

/* ========== 前缀选项 ========== */
.prefix-options {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.prefix-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prefix-option input[type="radio"] {
  width: 16px;
  height: 16px;
}

.prefix-option label {
  font-size: 14px;
  cursor: pointer;
}

.prefix-extra-options {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 15px;
  display: none;
}

.prefix-extra-options.show {
  display: block;
}

.prefix-extra-options .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
}

.prefix-extra-options .form-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prefix-extra-options .form-item label {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}

.prefix-extra-options .form-item input,
.prefix-extra-options .form-item select {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
}

/* ========== 格式选项 ========== */
.format-options {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.format-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.format-option input[type="radio"] {
  width: 16px;
  height: 16px;
}

.format-option label {
  font-size: 14px;
  cursor: pointer;
}

/* ========== 工具按钮组 ========== */
.tool-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

/* ========== 统计信息 ========== */
.tool-stats {
  font-size: 14px;
  color: #667eea;
  margin-bottom: 10px;
}

/* ========== 复制成功提示 ========== */
.copy-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
}

.copy-toast.show {
  opacity: 1;
}

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

  .login-box {
    padding: 30px 20px;
    margin: 20px;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    padding: 10px 16px;
    white-space: nowrap;
  }

  .summary {
    flex-wrap: wrap;
    gap: 15px;
  }

  .summary-item {
    flex: 1 1 calc(50% - 15px);
  }

  table {
    font-size: 13px;
  }

  th, td {
    padding: 8px;
  }

  .dual-input-row,
  .dual-output-row {
    grid-template-columns: 1fr;
  }

  .sub-tabs {
    flex-wrap: wrap;
  }

  .sub-tab {
    flex: 1 1 auto;
    text-align: center;
    font-size: 12px;
    padding: 8px 10px;
  }
}
