/* 基础变量 */
:root {
  --primary: #e83e8c;
  --primary-light: rgba(232, 62, 140, 0.15);
  --primary-dark: #d91a72;
  --primary-gradient: linear-gradient(135deg, #e83e8c 0%, #d91a72 100%);
  --success: #28a745;
  --success-light: rgba(40, 167, 69, 0.1);
  --info: #17a2b8;
  --warning: #fd7e14;
  --danger: #dc3545;
  --light: #f8f9fa;
  --dark: #343a40;
  --border: #dee2e6;
  --text: #212529;
  --text-light: #6c757d;
  --card-bg: white;
  --bg: #f8f9fa;
  --shadow: rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
}

/* 夜晚模式 - 修复背景色问题 */
html {
  background: var(--bg);
  transition: background-color 0.3s;
}

html.dark-mode {
  background: #121212;
}

.dark-mode {
  --primary: #e83e8c;
  --primary-light: rgba(232, 62, 140, 0.2);
  --primary-gradient: linear-gradient(135deg, #e83e8c 0%, #d91a72 100%);
  --success-light: rgba(40, 167, 69, 0.15);
  --light: #2d2d2d;
  --dark: #f8f9fa;
  --border: #404040;
  --text: #e0e0e0;
  --text-light: #adb5bd;
  --card-bg: #1e1e1e;
  --bg: #121212;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.3);
}

/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 20px;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* 主卡片 */
.main-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 25px 30px 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 15px;
}

.main-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

/* 头部区域 - 居中 */
.header-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 25px;
  position: relative;
}

.header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.subtitle {
  color: var(--text-light);
  font-size: 1rem;
  max-width: 500px;
}

/* 主题按钮 */
.theme-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, background 0.3s;
  flex-shrink: 0;
}

.theme-btn:hover {
  transform: scale(1.05);
  background: var(--primary-dark);
}

/* 搜索区域 */
.search-box {
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
}

.input-group input {
  flex: 1;
  height: 52px;
  padding: 0 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
  transition: all 0.3s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-search {
  height: 52px;
  padding: 0 32px;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-search:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 62, 140, 0.25);
}

.btn-search:active:not(:disabled) {
  transform: translateY(0);
}

.btn-search:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.error-message {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--danger);
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

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

/* 进度容器 */
.progress-container {
  background: var(--light);
  padding: 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  display: none;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-text {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.progress-percent {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

/* 进度条 */
.progress-bar-area {
  margin-bottom: 12px;
}

.progress {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, 
    var(--primary) 0%, 
    #ff4081 25%, 
    #e83e8c 50%, 
    #ff4081 75%, 
    var(--primary) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  transition: width 0.5s ease;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* 进度统计 */
.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat-row {
  background: var(--card-bg);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-row i {
  color: var(--primary);
  font-size: 0.9rem;
}

.dns-info {
  background: rgba(23, 162, 184, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--info);
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 筛选工具栏 */
.filter-bar {
  background: var(--light);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  border: 1px solid var(--border);
  display: none;
  flex-direction: column;
  gap: 12px;
}

.filter-section, .sort-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label, .sort-label {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  font-size: 0.95rem;
}

.filter-buttons, .sort-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 5px 14px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 20px;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.sort-btn {
  padding: 5px 12px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s;
}

.sort-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.sort-btn.active {
  background: var(--text-light);
  border-color: var(--text-light);
  color: white;
}

/* 查询无果域名区域 */
.unregistered-section {
  background: var(--light);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  display: none;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-header h5 {
  color: var(--text);
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
}

.section-description {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 4px;
}

.btn-copy {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.3s;
}

.btn-copy:hover {
  background: var(--primary-dark);
}

.unregistered-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.unregistered-item {
  padding: 8px 10px;
  background: var(--success-light);
  border: 1px solid rgba(40, 167, 69, 0.3);
  border-radius: 6px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85rem;
  color: var(--success);
  word-break: break-all;
  transition: all 0.2s;
  cursor: pointer;
  text-align: center;
}

.unregistered-item:hover {
  background: rgba(40, 167, 69, 0.2);
  transform: translateY(-1px);
}

/* 表格化结果区域 */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
  display: none;
}

.results-table.show {
  display: table;
}

.results-table thead {
  background: var(--light);
  border-bottom: 2px solid var(--border);
}

.results-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 2px solid var(--border);
}

.results-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.results-table tbody tr:hover {
  background: var(--light);
}

.results-table td {
  padding: 10px 14px;
  vertical-align: top;
}

.domain-cell {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-weight: 500;
  font-size: 0.9rem;
}

.domain-cell a {
  color: var(--primary);
  text-decoration: none;
}

.domain-cell a:hover {
  text-decoration: underline;
}

.type-cell {
  font-size: 0.85rem;
}

.type-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

.type-character { background: var(--info); }
.type-swap { background: #6f42c1; }
.type-hyphen { background: #17a2b8; }
.type-number { background: #e83e8c; }
.type-tld { background: #20c997; }
.type-duplicate { background: #ffc107; }
.type-deletion { background: #dc3545; }
.type-subdomain { background: #6610f2; }

.status-cell {
  font-size: 0.85rem;
  font-weight: 500;
}

.status-registered {
  color: var(--success);
}

.status-unregistered {
  color: var(--text-light);
}

.records-cell {
  font-size: 0.85rem;
  color: var(--text-light);
}

.records-cell span {
  display: block;
  margin-bottom: 2px;
}

.records-cell i {
  margin-right: 5px;
  width: 16px;
}

/* 详情展开行 */
.detail-row {
  background: var(--light);
}

.detail-content {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.detail-section {
  margin-bottom: 10px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.detail-value {
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--text-light);
  font-size: 0.8rem;
  word-break: break-all;
}

/* 结果区域 */
.results-container {
  margin-bottom: 25px;
  min-height: 150px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--border);
  opacity: 0.7;
}

.empty-state h4 {
  color: var(--text);
  margin-bottom: 8px;
  font-size: 1.1rem;
}

/* 完成消息 */
.alert-box {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 15px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
}

.alert-box.show {
  display: flex;
}

.success {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success);
  border-left: 4px solid var(--success);
}

/* 页脚 */
.footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  margin-top: 15px;
}

.client-info {
  background: var(--light);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-note {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

.beian {
  color: var(--text-light);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.beian a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.3s;
}

.beian a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

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

/* 移动端结果卡片 */
.mobile-results {
  display: none;
  margin-bottom: 15px;
}

.mobile-result-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

.mobile-result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.mobile-domain {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95rem;
  word-break: break-all;
}

.mobile-result-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-size: 0.8rem;
}

.mobile-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-detail-label {
  color: var(--text-light);
  font-size: 0.75rem;
}

.mobile-detail-expanded {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

/* ================= 响应式设计 - 移动端优化 ================= */

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .container {
    max-width: 100% !important;
    width: 100%;
  }
  
  .main-card {
    padding: 18px 12px 15px;
    width: 100%;
    margin-bottom: 10px;
  }
  
  .header-area {
    margin-bottom: 20px;
  }
  
  .header h1 {
    font-size: 1.5rem;
    flex-direction: column;
    gap: 5px;
  }
  
  .theme-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  /* 修复输入框布局 - 关键修改 */
  .input-group {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  
  .input-group input {
    width: 100% !important;
    height: 48px;
    padding: 0 14px;
    font-size: 16px; /* 防止iOS自动缩放 */
    min-height: 44px; /* iOS建议的最小触摸目标尺寸 */
  }
  
  .btn-search {
    width: 100%;
    height: 48px;
    padding: 0 20px;
    min-height: 44px; /* iOS建议的最小触摸目标尺寸 */
    justify-content: center;
  }
  
  .progress-container {
    padding: 15px;
  }
  
  .progress-stats {
    grid-template-columns: 1fr;
  }
  
  .filter-section, .sort-section {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .filter-buttons, .sort-buttons {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
  }
  
  .filter-buttons::-webkit-scrollbar,
  .sort-buttons::-webkit-scrollbar {
    height: 4px;
  }
  
  .filter-buttons::-webkit-scrollbar-thumb,
  .sort-buttons::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
  }
  
  .unregistered-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .unregistered-item {
    font-size: 0.8rem;
    padding: 6px 8px;
  }
  
  /* 表格在移动端隐藏，显示卡片 */
  .results-table {
    display: none !important;
  }
  
  .mobile-results {
    display: block;
  }
  
  .mobile-result-details {
    grid-template-columns: 1fr;
  }
  
  .empty-state {
    padding: 30px 15px;
  }
  
  .empty-state i {
    font-size: 2rem;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .btn-copy {
    width: 100%;
    justify-content: center;
    align-self: stretch;
  }
  
  .footer {
    padding-top: 15px;
  }
}

/* 小屏幕手机优化 */
@media (max-width: 576px) {
  body {
    padding: 8px;
  }
  
  .main-card {
    padding: 15px 10px 12px;
    border-radius: 8px;
  }
  
  .header h1 {
    font-size: 1.3rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
  
  .theme-btn {
    top: -5px;
    right: -5px;
  }
  
  /* 进一步优化输入框 */
  .input-group input {
    height: 46px;
    padding: 0 12px;
    font-size: 16px;
  }
  
  .btn-search {
    height: 46px;
    padding: 0 16px;
  }
  
  .progress-container {
    padding: 12px;
  }
  
  .filter-bar {
    padding: 12px;
  }
  
  .unregistered-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .footer {
    margin-top: 10px;
  }
  
  .footer-note {
    font-size: 0.8rem;
  }
}

/* 超小屏幕优化 (iPhone SE等) */
@media (max-width: 375px) {
  .header h1 {
    font-size: 1.2rem;
  }
  
  .subtitle {
    font-size: 0.85rem;
  }
  
  .input-group input,
  .btn-search {
    font-size: 15px;
  }
  
  .unregistered-grid {
    grid-template-columns: 1fr;
  }
}