body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 16px;
  width: auto;
  min-width: 300px;
  background-color: #f8f9fa;
  color: #212529;
  height: 100vh;
  overflow-y: auto;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

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

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

h1 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #1a73e8;
  text-align: center;
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  color: #5f6368;
  font-size: 14px;
}

input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 100%;
}

input[type="text"]:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

button {
  margin-top: 20px;
  padding: 10px 16px;
  width: 100%;
  background-color: #1a73e8;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
  max-width: 100%;
}

button:hover {
  background-color: #1557b0;
}

#result {
  margin-top: 20px;
  padding: 12px;
  border-radius: 6px;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 14px;
}

.button-group {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.button-group button {
  margin-top: 0;
  flex: 1;
}

#clearButton {
  background-color: #dc3545;
}

#clearButton:hover {
  background-color: #bb2d3b;
}

select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 14px;
  background-color: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 100%;
}

select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

#apiKeyForm {
  max-width: 100%;
  padding-bottom: 20px;
}

#autoFillButton {
  background-color: #28a745;
}

#autoFillButton:hover {
  background-color: #218838;
}

.button-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.key-selection {
  max-height: 100px;
  overflow-y: auto;
  background: white;
}

.key-selection div:hover {
  background: #e3f2fd !important;
}

/* 添加区域划分样式 */
.section {
  background: white;
  padding: 8px;
  margin: 4px 0;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: none;
}

.section.active {
  display: block;
}

.section-title {
  font-size: 16px;
  font-weight: 500;
  color: #1a73e8;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid #e8f0fe;
}

/* 调整表单布局 */
#apiKeyForm {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 添加版权信息样式 */
.copyright {
  margin-top: 20px;
  padding: 12px;
  border-top: 1px solid #e8f0fe;
  font-size: 12px;
  color: #666;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-info .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.author-info .text-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.author-info a {
  color: #1a73e8;
  text-decoration: none;
}

.author-info a:hover {
  text-decoration: underline;
}

/* 导航菜单样式 */
.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-menu a {
  padding: 6px 12px;
  border-radius: 4px;
  color: #1a73e8;
  text-decoration: none;
  font-size: 13px;
  transition: background-color 0.2s;
  position: relative;
  background-color: transparent;
}

.nav-menu a:hover {
  background-color: #e8f0fe;
}

.nav-menu a.active {
  background-color: #e8f0fe;
  font-weight: 500;
}

/* 添加平滑滚动效果 */
html {
  scroll-behavior: smooth;
}

/* 调整锚点定位，防止被导航栏遮挡 */
.section {
  scroll-margin-top: 20px;
}

/* 滚动按钮样式 */
.scroll-buttons {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  opacity: 1;
  pointer-events: auto;
}

.scroll-buttons button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background-color: #1a73e8;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.scroll-buttons button:hover {
  background-color: #1557b0;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 在小屏幕上调整按钮位置 */
@media (max-width: 768px) {
  .scroll-buttons {
    right: 10px;
    bottom: 10px;
  }

  .scroll-buttons button {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* 修改历史记录容器样式 */
.history-container {
  margin-top: 20px;
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
  position: relative;
}

.history-container h3 {
  margin: 0 0 16px 0;
  color: #1a73e8;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(80px, auto) minmax(120px, 1fr) minmax(
      120px,
      auto
    ) minmax(160px, auto);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
  min-width: 600px;
}

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

.history-platform {
  font-weight: 500;
  color: #1a73e8;
}

.history-key {
  font-family: monospace;
  color: #666;
}

.history-time {
  color: #888;
  font-size: 12px;
}

.use-key-btn {
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  height: auto;
  width: auto;
}

#historyButton {
  background-color: #4caf50;
}

#historyButton:hover {
  background-color: #45a049;
}

/* 修改历史记录容器样式 */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-header h3 {
  margin: 0;
}

#clearHistoryBtn {
  background-color: #dc3545;
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  height: auto;
  width: auto;
}

#clearHistoryBtn:hover {
  background-color: #bb2d3b;
}

.history-item {
  display: grid;
  grid-template-columns: 100px 1fr 150px auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eee;
}

.history-actions {
  display: flex;
  gap: 4px;
}

.delete-key-btn {
  background-color: #dc3545;
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  height: auto;
  width: auto;
}

.delete-key-btn:hover {
  background-color: #bb2d3b;
}

/* 修改按钮组样式 */
.action-buttons {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.action-buttons button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  transition: all 0.2s;
}

.action-buttons button:hover {
  transform: translateY(-2px);
}

/* 为每个按钮设置不同的颜色 */
#checkButton {
  background-color: rgba(26, 115, 232, 0.6);
}

#clearButton {
  background-color: rgba(220, 53, 69, 0.6);
}

#autoFillButton {
  background-color: rgba(40, 167, 69, 0.6);
}

#historyButton {
  background-color: rgba(108, 117, 125, 0.6);
}

/* 添加按钮提示文字 */
.action-buttons button::before {
  content: attr(title);
  position: absolute;
  right: 50px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.action-buttons button:hover::before {
  opacity: 1;
}

/* 在小屏幕上调整位置 */
@media (max-width: 768px) {
  .action-buttons {
    right: 10px;
  }
}

.history-header-buttons {
  display: flex;
  gap: 8px;
}

.copy-key-btn {
  background-color: #4caf50;
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  height: auto;
  width: auto;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.copy-key-btn:hover {
  background-color: #45a049;
}

#copyAllKeysBtn {
  background-color: #4caf50;
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  height: auto;
  width: auto;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#copyAllKeysBtn:hover {
  background-color: #45a049;
}

/* 确保历史记录操作按钮对齐 */
.history-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* 调整历史记录头部按钮样式 */
.history-header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 修改分页容器样式 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
  min-width: 600px;
  overflow-x: visible;
  position: sticky;
  left: 0;
}

/* 修改分页按钮样式 */
.pagination button {
  margin: 0;
  padding: 4px 12px;
  font-size: 12px;
  height: auto;
  width: auto;
  background-color: #f0f0f0;
  color: #333;
  white-space: nowrap;
  flex-shrink: 0;
}

.pagination button.active {
  background-color: #1a73e8;
  color: white;
}

.pagination button:disabled {
  background-color: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

/* 添加模型复选框区域样式 */
.model-checkboxes {
  max-height: 200px;
  overflow-y: auto;
  margin: 10px 0;
  padding: 8px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  background: #fff;
}

.model-checkbox-item {
  display: flex;
  align-items: center;
  padding: 4px 0;
}

.model-checkbox-item input[type="checkbox"] {
  margin-right: 8px;
  width: auto;
}

.model-checkbox-item label {
  margin: 0;
  font-size: 13px;
  cursor: pointer;
}

.copy-models-btn {
  background-color: #4caf50;
  margin-top: 10px;
}

.copy-models-btn:hover {
  background-color: #45a049;
}

/* 美化复选框样式 */
.model-checkbox-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #1a73e8;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.model-checkbox-item input[type="checkbox"]:checked {
  background-color: #1a73e8;
}

.model-checkbox-item input[type="checkbox"]:checked::after {
  content: "✓";
  color: white;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
}

/* 添加全选/取消全选按钮样式 */
.model-select-all {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.model-select-all button {
  margin: 0;
  padding: 4px 8px;
  font-size: 12px;
  height: auto;
  width: auto;
  background-color: #f0f0f0;
  color: #333;
}

.model-select-all button:hover {
  background-color: #e0e0e0;
}

.pagination span {
  padding: 0 8px;
  color: #666;
  user-select: none;
}

/* 添加加载动画样式 */
.loading-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 12px;
}

.loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #1a73e8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: #666;
  font-size: 14px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.history-filters {
  margin: 10px 0;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  display: flex;
  gap: 15px;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.filter-group select {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  flex: 1;
  min-width: 120px;
  height: 32px;
  font-size: 14px;
}

.filter-group label {
  font-size: 14px;
  color: #333;
  white-space: nowrap;
  min-width: 70px;
}

/* 添加测试按钮样式 */
#testModelsBtn {
  background-color: #1a73e8;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
  width: 100%;
}

#testModelsBtn:hover {
  background-color: #1557b0;
}

/* 表格样式优化 */
#result table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
  min-width: 800px; /* 确保表格有最小宽度 */
}

#result th,
#result td {
  padding: 8px 12px;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: middle;
}

#result th {
  background-color: #f5f5f5;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#result tr:nth-child(even) {
  background-color: #f9f9f9;
}

#result tr:hover {
  background-color: #f5f5f5;
}

#result td {
  word-break: break-word;
  max-width: 300px; /* 限制单元格最大宽度 */
}

/* 添加表格容器的水平滚动 */
#result > div {
  overflow-x: auto;
  margin: 0 -16px; /* 抵消父容器的padding */
  padding: 0 16px;
}

/* 确保错误信息列可以自动换行 */
#result td:last-child {
  white-space: normal;
  min-width: 200px;
}

/* 模型操作按钮组样式 */
.model-action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.model-action-buttons button {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: white;
  transition: background-color 0.2s;
}

#testModelsBtn {
  background-color: #1a73e8;
}

#testModelsBtn:hover {
  background-color: #1557b0;
}

#copyModelsBtn {
  background-color: #4caf50;
}

#copyModelsBtn:hover {
  background-color: #45a049;
}

/* 添加按钮容器样式 */
.model-action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* 修改复制和测试按钮样式 */
.copy-models-btn,
.test-models-btn {
  flex: 1;
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 14px;
  height: auto;
  border-radius: 4px;
  transition: all 0.2s;
}

.copy-models-btn {
  background-color: #4caf50;
}

.copy-models-btn:hover {
  background-color: #45a049;
}

.test-models-btn {
  background-color: #1a73e8;
}

.test-models-btn:hover {
  background-color: #1557b0;
}

/* 添加模型测试结果容器样式 */
.model-test-results {
  margin-top: 20px;
}

.model-copy-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.copy-result-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #1a73e8;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 0;
  flex: 1;
  max-width: 200px;
}

.copy-result-btn:hover {
  background-color: #1557b0;
}

.copy-result-btn span {
  font-size: 14px;
  margin-bottom: 2px;
}

.copy-result-btn small {
  font-size: 12px;
  opacity: 0.8;
}

/* 确保表格在按钮下方正确显示 */
.model-test-results > div:last-child {
  margin-top: 10px;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
}

.test-results-title {
  font-size: 16px;
  font-weight: 500;
  color: #1a73e8;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8f0fe;
}

/* 添加余额查询按钮样式 */
.check-balance-btn {
  background-color: #ffc107;
}

.check-balance-btn:hover {
  background-color: #e0a800;
}

/* 修改固定按钮组样式 */
.action-buttons button#checkBalanceBtn {
  background-color: rgba(255, 193, 7, 0.6); /* 使用半透明的黄色，与其他按钮风格一致 */
}

.action-buttons button#checkBalanceBtn:hover {
  background-color: rgba(224, 168, 0, 0.6);
}
