* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1e40af;
  --success-color: #10b981;
  --success-light: #d1fae5;
  --success-dark: #059669;
  --warning-color: #f59e0b;
  --warning-light: #fef3c7;
  --warning-dark: #d97706;
  --error-color: #ef4444;
  --error-light: #fee2e2;
  --error-dark: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --border-color: #e5e7eb;
  --background: #f9fafb;
  --card-background: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --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);
  --rounded: 0.375rem;
  --rounded-lg: 0.5rem;
  --rounded-xl: 0.75rem;
  --rounded-full: 9999px;
}

body {
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--background);
  color: var(--gray-700);
  min-height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background-color: var(--card-background);
  border-radius: var(--rounded-xl);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.025em;
}

/* Content Layout */
.content-area {
  display: flex;
  gap: 24px;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--card-background);
  border-radius: var(--rounded-xl);
  box-shadow: var(--shadow);
  padding: 8px;
  height: fit-content;
  position: sticky;
  top: 24px;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 4px 0;
  border-radius: var(--rounded-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--gray-600);
  font-weight: 500;
  gap: 12px;
}

.menu-item:hover {
  background-color: var(--gray-50);
  color: var(--gray-900);
}

.menu-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
}

.menu-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Main Content */
.main-content {
  flex: 1;
  background: var(--card-background);
  border-radius: var(--rounded-xl);
  box-shadow: var(--shadow);
  padding: 32px;
  min-height: 600px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 32px;
  letter-spacing: -0.025em;
}

/* Alert/Notice Box */
.notice-box {
  border-left-width: 4px;
  padding: 12px 16px;
  margin-bottom: 24px;
  border-radius: 0 var(--rounded-lg) var(--rounded-lg) 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.notice-box.warning {
  background-color: var(--warning-light);
  border-left-color: var(--warning-color);
  color: var(--warning-dark);
}

.notice-box.info {
  background-color: var(--primary-light);
  border-left-color: var(--primary-color);
  color: var(--primary-dark);
}

.notice-box.success {
  background-color: var(--success-light);
  border-left-color: var(--success-color);
  color: var(--success-dark);
}

.notice-box.error {
  background-color: var(--error-light);
  border-left-color: var(--error-color);
  color: var(--error-dark);
}

.notice-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Groups */
.group-list {
  margin-bottom: 24px;
}

.group-item {
  border: 1px solid var(--border-color);
  border-radius: var(--rounded-lg);
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--card-background);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.group-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background-color: var(--gray-50);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.group-header:hover {
  background-color: var(--gray-100);
}

.group-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 16px;
}

.group-content {
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

/* Status Tags */
.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--rounded-full);
  margin-left: 12px;
}

.status-tag-success {
  color: var(--success-color);
  background: var(--success-light);
}

.status-tag-default {
  color: var(--gray-600);
  background: var(--gray-100);
}

/* Host Items */
.host-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: var(--rounded-lg);
  background-color: var(--gray-50);
  transition: all 0.2s ease;
  gap: 12px;
}

.host-item:hover {
  background-color: var(--gray-100);
}

.host-enabled {
  accent-color: var(--primary-color);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.host-ip {
  width: 140px;
  font-family: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", monospace;
  font-size: 13px;
  color: var(--gray-800);
  font-weight: 500;
}

.host-domain {
  flex: 1;
  font-family: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", monospace;
  font-size: 13px;
  color: var(--gray-700);
}

/* Forms */
.section-title {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--gray-900);
  font-weight: 600;
}

.instruction {
  font-size: 14px;
  color: var(--gray-600);
  margin: 8px 0 16px;
  line-height: 1.5;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
}

/* Input Styles */
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--rounded-lg);
  font-size: 14px;
  transition: all 0.2s ease;
  background-color: white;
  color: var(--gray-900);
}

input[type="text"]:hover,
input[type="number"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover {
  border-color: var(--gray-400);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input:disabled {
  color: rgba(0, 0, 0, 0.25);
  background-color: rgba(0, 0, 0, 0.04);
  border-color: #d9d9d9;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

/* Select Dropdown */
select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--rounded-lg);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  min-height: 40px;
  transition: all 0.2s ease;
  background-color: white;
  color: var(--gray-900);
  cursor: pointer;

  /* 自定义下拉箭头 */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 20px;
}

/* Select hover状态 */
select:hover {
  border-color: var(--gray-400);
  background-color: var(--gray-50);
}

/* Select focus状态 */
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%233b82f6' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-color: white;
}

/* Select disabled状态 */
select:disabled {
  background-color: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Option样式 - 注意：部分样式在某些浏览器中可能不生效 */
select option {
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 14px;
  color: var(--gray-900);
  background-color: white;
}

select option:hover {
  background-color: var(--gray-50);
}

select option:checked {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

/* 多选select样式 */
select[multiple] {
  padding: 8px 12px;
  background-image: none;
}

select[multiple] option {
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: var(--rounded);
}

select[multiple] option:checked {
  background-color: var(--primary-color);
  color: white;
}

/* 特定的select样式调整 */
#import-group-select select {
  display: block;
  width: 100%;
  margin-bottom: 0;
  line-height: 20px; /* 调整为与其他元素一致 */
  padding: 10px 36px 10px 12px;
}

/* 表单中的select样式保持一致 */
.form-group select {
  height: 40px;
  display: flex;
  align-items: center;
}

/* 针对Firefox的特殊处理 */
@-moz-document url-prefix() {
  select {
    padding-top: 9px;
    padding-bottom: 9px;
  }
}

/* Textarea */
textarea {
  resize: vertical;
  min-height: 120px;
  font-family: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", monospace;
  line-height: 1.5;
}

.batch-textarea {
  min-height: 240px;
  font-size: 13px;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--rounded-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 8px;
  min-width: 80px;
}

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

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

.button-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.button-default {
  background-color: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.button-default:hover:not(:disabled) {
  background-color: var(--gray-50);
  border-color: var(--gray-400);
}

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

.button-danger:hover:not(:disabled) {
  background-color: var(--error-dark);
  border-color: var(--error-dark);
}

.button-small {
  padding: 4px 12px;
  font-size: 13px;
  min-width: 60px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: all 0.2s ease;
  border-radius: var(--rounded-full);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: all 0.2s ease;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: white;
  border-radius: var(--rounded-xl);
  box-shadow: var(--shadow-lg);
  min-width: 400px;
  max-width: 90%;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--gray-400);
}

.empty-state p {
  font-size: 16px;
  color: var(--gray-600);
  margin-bottom: 24px;
}

/* Add Group Button */
.add-group-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--rounded-lg);
  color: var(--gray-600);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 8px;
  background-color: var(--gray-50);
}

.add-group-button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: var(--primary-light);
}

.add-group-button-icon {
  font-size: 18px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: var(--rounded);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--rounded);
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* Batch Import Section */
.batch-import-section {
  background-color: var(--gray-50);
  border: 1px solid var(--border-color);
  border-radius: var(--rounded-lg);
  padding: 24px;
  margin-top: 24px;
}

.batch-format-hint {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--rounded);
  padding: 16px;
  margin-top: 8px;
  font-family: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", monospace;
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.6;
  overflow-x: auto;
}

.batch-format-hint code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.8;
}

/* 消息容器 */
.ant-message {
  position: fixed;
  top: 8px;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 1010;
}

/* 消息通知 */
.ant-message-notice {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  margin-bottom: 8px;
  padding: 0;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.78, 0.14, 0.15, 0.86);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-width: 80%;
}

/* 消息通知进入 */
.ant-message-notice.ant-message-notice-enter {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* 消息通知离开 */
.ant-message-notice.ant-message-notice-leave {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -100%);
}

/* 消息内容容器 */
.ant-message-notice-content {
  display: inline-block;
  padding: 10px 16px;
  background: #fff;
  border-radius: var(--rounded-lg);
  box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  pointer-events: auto;
}

/* 消息自定义内容 */
.ant-message-custom-content {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* 消息图标 */
.ant-message-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* 消息文本 */
.ant-message-text {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  white-space: nowrap;
}

/* 预格式化文本（用于对象和数组） */
.ant-message-text.pre-formatted {
  white-space: pre-wrap;
  font-family: "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", monospace;
  font-size: 13px;
  text-overflow: clip;
  overflow: visible;
}

/* 信息类型消息 */
.ant-message-info .ant-message-icon {
  color: var(--primary-color);
}

/* 成功类型消息 */
.ant-message-success .ant-message-icon {
  color: var(--success-color);
}

/* 警告类型消息 */
.ant-message-warning .ant-message-icon {
  color: var(--warning-color);
}

/* 错误类型消息 */
.ant-message-error .ant-message-icon {
  color: var(--error-color);
}

/* Host Edit Form */
.host-edit-form {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background-color: white;
  border-radius: var(--rounded-lg);
  border: 1px solid var(--primary-color);
  margin-bottom: 8px;
  align-items: center;
}

.host-edit-form input {
  height: 36px;
}

.tab-content {
  display: none;
}

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

.rule-input-box {
  display: flex;
  align-items: center;
}

.rule-input-box button {
  margin-left: 16px;
}

#import-group-select {
  margin-bottom: 12px;
}

#import-group-select select {
  display: block;
  line-height: 36px;
}

/* 搜索栏相关样式 */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 300px;
  height: 40px;
  border-radius: var(--rounded-lg);
  background-color: white;
  border: 1px solid var(--gray-300);
  padding: 0 12px;
  transition: all 0.2s ease;
}

.search-container:hover {
  border-color: var(--gray-400);
}

.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--gray-500);
  margin-right: 12px;
}

.action-bar .search-input {
  flex: 1;
  border: none;
  background: transparent;
  height: 100%;
  font-size: 14px;
  color: var(--gray-900);
  outline: none;
  padding: 0;
}

.action-bar input[type="text"]:focus,
.action-bar input[type="number"]:focus {
  outline: none;
  box-shadow: inherit;
}

.clear-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s ease;
  margin-left: 12px;
}

.clear-button:hover {
  color: var(--gray-700);
}

/* 搜索结果相关样式 */
.search-results {
  margin-top: 16px;
  margin-bottom: 20px;
  animation: fadeIn 0.2s ease;
}

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

.search-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
}

.search-result-group-header {
  padding: 16px 20px;
  background-color: var(--gray-50);
  border-radius: var(--rounded-lg) var(--rounded-lg) 0 0;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.search-result-group-header:hover {
  background-color: var(--gray-100);
  border-color: var(--gray-300);
}

.search-result-group-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 16px;
}

.search-result-hosts {
  margin-bottom: 24px;
  padding: 12px;
  padding-bottom: 0;
  border: 1px solid var(--border-color);
  border-top: 0;
  border-radius: 0 0 var(--rounded-lg) var(--rounded-lg);
}

.search-result-hosts .host-item {
  margin-bottom: 12px;
}

/* 高亮样式 */
.search-results .highlight {
  background-color: var(--warning-light);
  font-weight: 600;
  color: var(--warning-dark);
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .add-group-button {
    margin-bottom: 0;
  }

  .search-container {
    width: 100%;
  }
}
