/* 基础样式 */
body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
}

/* 侧边栏样式 */
.sidebar {
  width: 250px;
  background-color: #ffffff;
  color: #2c3e50;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 24px;
  color: #1a1a1a;
}

.sidebar ul {
  list-style-type: none;
  padding: 0;
}

.sidebar ul li {
  margin: 10px 0;
}

.sidebar ul li a {
  color: #2c3e50;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 12px 15px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.sidebar ul li a:hover {
  background-color: #1a1a1a;
  color: #ffffff;
  transform: translateX(5px);
}

.sidebar ul li a.active {
  background-color: #1a1a1a;
  color: #ffffff;
  font-weight: bold;
}

.sidebar ul li a i {
  margin-right: 10px;
  font-size: 18px;
}

/* 内容区域样式 */
.content {
  flex-grow: 1;
  padding: 30px;
}

.content h1 {
  color: #2c3e50;
  margin-bottom: 20px;
}

.content p {
  color: #7f8c8d;
  line-height: 1.6;
}

/* 内容区域隐藏/显示 */
.content-section {
  display: none;
  animation: fadeIn 0.5s ease;
}

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

/* 仪表盘统计卡片样式 */
.dashboard-cards {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.dashboard-card {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex: 1;
  text-align: center;
}

.dashboard-card h3 {
  margin: 0;
  font-size: 18px;
  color: #2c3e50;
}

.dashboard-card p {
  margin: 10px 0 0;
  font-size: 24px;
  color: #1a1a1a;
  font-weight: bold;
}

/* 上传区域样式 */
.upload-section {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.upload-section .upload-box {
  border: 2px dashed #1a1a1a;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.upload-section .upload-box.dragover {
  background-color: #f0f8ff;
  border-color: #2980b9;
}

.upload-section .upload-box i {
  font-size: 24px;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.upload-section .upload-box p {
  margin: 0;
  color: #7f8c8d;
}

.upload-section .upload-box .file-info {
  margin-top: 10px;
  font-size: 14px;
  color: #1a1a1a;
}

.upload-section .upload-box input[type="file"] {
  display: none;
}

.upload-section .delimiter-input {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-section .delimiter-input input[type="text"] {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 10px;
  width: 200px;
}

.upload-section .delimiter-input input[type="password"] {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 10px;
  width: 200px;
}

.upload-section .delimiter-input button {
  padding: 8px 16px;
  background-color: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.upload-section .delimiter-input button:hover {
  background-color: #333333;
}

/* 表格样式 */
.table-card {
  width: 100%;
  margin-top: 18px;
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #eef0f3;
  border-radius: 16px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.07);
}

.email-table,
.mail-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0;
  background-color: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: none;
}

.email-table th,
.email-table td,
.mail-table th,
.mail-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #333;
  vertical-align: middle;
}

.email-table th,
.mail-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.email-table tr:hover,
.mail-table tr:hover {
  background-color: #fbfdff;
}

.email-table td,
.mail-table td {
  word-wrap: break-word;
}

.email-table .refresh-token {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-column {
  width: 44px;
}

.email-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.email-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #111827, #475569);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}

.email-address {
  color: #111827;
  font-weight: 600;
}

.id-pill,
.expiry-pill,
.token-preview {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background-color: #f8fafc;
  border: 1px solid #e5e7eb;
  color: #475569;
  padding: 0 10px;
}

.id-pill {
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  font-family: monospace;
  font-size: 12px;
  scrollbar-width: thin;
}

.token-cell {
  min-width: 190px;
  white-space: nowrap;
}

.token-preview {
  min-width: 118px;
  font-family: monospace;
  font-size: 12px;
  background-color: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}

.expiry-pill {
  width: 96px;
  box-sizing: border-box;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.expiry-pill.not-refreshed,
.expiry-pill.unknown {
  color: #475569;
  background-color: #f8fafc;
  border-color: #e2e8f0;
}

.expiry-pill.healthy {
  color: #047857;
  background-color: #ecfdf5;
  border-color: #a7f3d0;
}

.expiry-pill.warning {
  color: #b45309;
  background-color: #fffbeb;
  border-color: #fde68a;
}

.expiry-pill.expired {
  color: #b91c1c;
  background-color: #fef2f2;
  border-color: #fecaca;
}

.copy-token-btn {
  margin-left: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: #f3f4f6;
  color: #374151;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.copy-token-btn:hover {
  background-color: #e5e7eb;
}

.email-table .actions,
.mail-table .actions {
  min-width: 500px;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #334155;
  background-color: #f8fafc;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
}

.action-btn.inbox {
  color: #075985;
  background-color: #f0f9ff;
  border-color: #bae6fd;
}

.action-btn.junk {
  color: #92400e;
  background-color: #fffbeb;
  border-color: #fde68a;
}

.action-btn.ai {
  color: #6d28d9;
  background-color: #f5f3ff;
  border-color: #ddd6fe;
}

.action-btn.danger {
  width: 32px;
  padding: 0;
  justify-content: center;
  color: #b91c1c;
  background-color: #fef2f2;
  border-color: #fecaca;
}

/* 分页样式 */
.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.pagination button {
  min-width: 34px;
  min-height: 34px;
  padding: 6px 12px;
  margin: 0;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background-color: #ffffff;
  color: #475569;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.pagination button.active {
  background-color: #1a1a1a;
  color: #ffffff;
}

.pagination button:hover {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
  color: #ffffff;
}

/* 无数据提示 */
.no-data {
  text-align: center;
  padding: 20px;
  color: #7f8c8d;
  font-size: 16px;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  padding: 24px;
  box-sizing: border-box;
  z-index: 1300;
}

.modal-content {
  position: relative;
  z-index: 1;
  background-color: #ffffff;
  padding: 0;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  max-width: 620px;
  width: 100%;
  max-height: min(760px, 88vh);
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 0;
  padding: 26px 28px 18px;
  color: #2c3e50;
  font-size: 24px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.modal-content p {
  color: #7f8c8d;
  margin: 0;
  padding: 0 28px;
  overflow-y: auto;
  flex: 1;
}

.ai-analysis-card {
  text-align: left;
  color: #1f2937;
  padding-bottom: 18px;
}

.ai-analysis-card .ai-summary {
  min-height: 76px;
  max-height: 180px;
  overflow-y: auto;
  padding: 18px;
  border-radius: 12px;
  background-color: #f5f3ff;
  color: #4c1d95;
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 18px;
  /* white-space: pre-wrap; */
}

.ai-analysis-card .ai-status {
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 10px;
}

.ai-analysis-card .ai-status.thinking::after {
  content: "";
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}

.ai-analysis-card .ai-thinking {
  display: none;
  max-height: 110px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 10px;
  background-color: #fafafa;
  border: 1px dashed #d1d5db;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.ai-analysis-card .ai-thinking.active {
  display: block;
}

@keyframes dots {
  0% {
    content: "";
  }

  25% {
    content: ".";
  }

  50% {
    content: "..";
  }

  75%,
  100% {
    content: "...";
  }
}

.ai-analysis-card .ai-details {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ai-analysis-card .ai-details.ready {
  opacity: 1;
  transform: translateY(0);
}

.ai-analysis-card .ai-field {
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 16px;
}

.ai-analysis-card .ai-field strong {
  min-width: 72px;
  color: #111827;
}

.ai-analysis-card .ai-suggestion {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background-color: #f9fafb;
  color: #374151;
  line-height: 1.6;
  font-size: 16px;
}

.ai-analysis-card .ai-cursor::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -2px;
  background-color: #7c3aed;
  animation: blink 0.8s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.modal-content button {
  padding: 8px 16px;
  background-color: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: fit-content;
  min-width: 88px;
  margin: 18px auto 24px;
  flex-shrink: 0;
}

.modal-content button:hover {
  background-color: #333333;
}

.confirm-modal-content {
  max-width: 430px;
  padding: 28px;
  text-align: left;
  gap: 14px;
}

.confirm-modal-content h3 {
  padding: 0;
  font-size: 22px;
}

.confirm-modal-content p {
  padding: 0;
  color: #4b5563;
  line-height: 1.7;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.confirm-actions button {
  margin: 0;
  border-radius: 8px;
  padding: 10px 18px;
}

.confirm-actions .cancel-btn {
  background-color: #f3f4f6;
  color: #374151;
}

.confirm-actions .cancel-btn:hover {
  background-color: #e5e7eb;
}

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

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

/* 邮件详情模态框样式 */
.mail-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

.mail-modal-content {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.mail-modal-content h3 {
  margin-top: 0;
  color: #2c3e50;
}

.mail-modal-content p {
  color: #7f8c8d;
  word-wrap: break-word;
}

.mail-modal-content button {
  padding: 8px 16px;
  background-color: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  position: sticky;
  bottom: 0;
  width: 100%;
  margin-top: 20px;
}

.mail-modal-content button:hover {
  background-color: #2980b9;
}

/* Loading 样式 */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

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

.toast {
  position: fixed;
  top: 86px;
  left: 50%;
  z-index: 1200;
  min-width: 160px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 18px;
  border-radius: 10px;
  background-color: rgba(26, 26, 26, 0.92);
  color: #ffffff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background-color: rgba(231, 76, 60, 0.94);
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* 淡入动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.email-handel {
  display: flex;
  align-items: center;
}

.email-handel .delimiter-input {
  justify-content: left;
  margin-top: 0px;
}

.delete-btn {
  background-color: #e74c3c !important;
  margin-left: 10px !important;
}

.delete-btn:hover {
  background-color: #e74c3c !important;
  opacity: 0.9 !important;
}

.batch-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 0;
  padding: 12px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.batch-actions span {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px;
}

.batch-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-actions .delete-btn,
.batch-actions .refresh-token-btn {
  border: none;
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.refresh-token-btn {
  background: linear-gradient(135deg, #111827, #334155);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.refresh-token-btn:hover {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  transform: translateY(-1px);
}

.batch-actions .delete-btn {
  margin-left: 0 !important;
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.14);
}

.batch-actions .delete-btn:hover {
  transform: translateY(-1px);
}

.confirm-actions .primary-btn {
  background-color: #1a1a1a;
}

.confirm-actions .primary-btn:hover {
  background-color: #333333;
}

.pagination-section {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.pagination-section .pagination {
  margin-top: 0px;
}

#items-per-page {
  /* height: 26px; */
  padding: 6px 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: white;
  color: #333;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" stroke="%23666" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.tips p {
  color: #1a1a1a;
}

.no-token {
  font-size: 10px;
  color: #000;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
}

.load-data-button {
  margin-right: 100px;
}

@media (max-width: 768px) {
  .content {
    padding: 18px;
  }

  .batch-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-buttons {
    width: 100%;
    flex-wrap: wrap;
  }

  .batch-actions .delete-btn,
  .batch-actions .refresh-token-btn {
    flex: 1;
  }

  .pagination-section {
    flex-direction: column;
    gap: 12px;
  }
}
