/* 临时邮箱样式 - 独立于首页样式 */

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

body {
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'system-ui', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* 导航栏样式 */
.email-nav {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s;
}

.nav-back:hover {
  background: #f3f4f6;
  color: #333;
}

.nav-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #333;
}

.nav-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.nav-actions {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: #f3f4f6;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
  font-size: 1rem;
}

.nav-btn:hover {
  background: #e5e7eb;
  color: #333;
  transform: translateY(-2px);
}

/* 连接状态指示器 */
.connection-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: #f3f4f6;
  font-size: 0.875rem;
  transition: all 0.3s;
}

.connection-status.online {
  background: #dcfce7;
}

.connection-status.online i {
  animation: pulse-green 2s infinite;
}

.connection-status.offline {
  background: #fef2f2;
}

.connection-status.offline i {
  animation: pulse-red 1s infinite;
}

.status-text {
  font-size: 0.75rem;
  font-weight: 500;
}

.connection-status.online .status-text {
  color: #16a34a;
}

.connection-status.offline .status-text {
  color: #dc2626;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 刷新按钮动画 */
.nav-btn.refreshing {
  animation: spin 1s linear infinite;
}

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

/* 新邮件动画 */
.new-mail-animation {
  animation: bounce-in 0.5s ease-out;
}

@keyframes bounce-in {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* 新邮件标记 */
.new-mail {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-left: 3px solid #667eea;
}

.new-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 邮件列表空状态连接指示器 */
.connection-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #6b7280;
}

/* 主内容区 */
.email-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* 卡片样式 */
.email-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: all 0.3s;
}

.email-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  color: #333;
  font-weight: 600;
}

.card-header h2 i {
  color: #667eea;
}

.card-body {
  padding: 1.5rem;
}

/* 邮箱地址样式 */
.email-address-wrapper {
  margin-bottom: 1.5rem;
}

.email-address {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
  word-break: break-all;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-text {
  font-weight: 400;
  font-size: 1rem;
}

.email-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.3s;
}

.copy-btn {
  background: #10b981;
  color: white;
}

.copy-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.new-btn {
  background: #f59e0b;
  color: white;
}

.new-btn:hover {
  background: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.email-info {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
  font-size: 0.9375rem;
}

.info-item i {
  color: #667eea;
}

.info-item strong {
  color: #333;
}

/* 自动刷新控制 */
.auto-refresh-card {
  background: rgba(255, 255, 255, 0.9);
}

.auto-refresh-header {
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.auto-refresh-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

.auto-refresh-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #d1d5db;
  border-radius: 0.25rem;
  position: relative;
  transition: all 0.3s;
}

.auto-refresh-label input[type="checkbox"]:checked + .checkbox-custom {
  background: #667eea;
  border-color: #667eea;
}

.auto-refresh-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 0.75rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.refresh-interval {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #666;
}

.refresh-interval select {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: white;
  cursor: pointer;
  font-size: 0.9375rem;
}

/* 收件箱样式 */
.header-actions {
  display: flex;
  gap: 0.5rem;
}

.clear-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s;
}

.clear-btn:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

.mail-list {
  min-height: 200px;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #999;
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: #d1d5db;
}

.empty-state p {
  margin-bottom: 0.5rem;
}

.empty-hint {
  font-size: 0.875rem;
  color: #bbb;
}

/* 邮件项样式 */
.mail-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.mail-item:hover {
  background: white;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
  transform: translateY(-2px);
}

.mail-item.unread {
  background: #eff6ff;
  border-left: 4px solid #667eea;
}

.mail-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.mail-from {
  font-weight: 600;
  color: #333;
  font-size: 0.9375rem;
  word-break: break-all;
  flex: 1;
  margin-right: 1rem;
}

.mail-date {
  color: #999;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.mail-subject {
  color: #666;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.mail-preview {
  color: #999;
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 模态框样式 */
.mail-modal,
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}

.mail-modal.active,
.settings-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 1rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  word-break: break-all;
  flex: 1;
  margin-right: 1rem;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 0.5rem;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(80vh - 10rem);
}

.mail-meta {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

.meta-item {
  display: flex;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.meta-item:last-child {
  margin-bottom: 0;
}

.meta-label {
  color: #666;
  margin-right: 0.5rem;
  min-width: 4rem;
}

.meta-value {
  color: #333;
  word-break: break-all;
}

.mail-content {
  line-height: 1.6;
  color: #333;
  word-break: break-word;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.delete-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  transition: all 0.3s;
}

.delete-btn:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

/* 设置模态框 */
.settings-content {
  max-width: 400px;
}

.settings-item {
  margin-bottom: 1.5rem;
}

.settings-item:last-child {
  margin-bottom: 0;
}

.settings-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #333;
}

.settings-item select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

.settings-hint {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.4;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

/* Toast提示 */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s;
}

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

.toast.success {
  background: #10b981;
}

.toast.error {
  background: #ef4444;
}

/* 响应式设计 */
@media (max-width: 640px) {
  .nav-container {
    padding: 0.5rem;
  }

  .nav-back span {
    display: none;
  }

  .nav-title {
    font-size: 1rem;
  }

  .nav-icon {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }

  .email-main {
    padding: 1rem 0.5rem;
  }

  .card-body {
    padding: 1rem;
  }

  .email-address {
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }

  .email-actions {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    justify-content: center;
  }

  .email-info {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }

  .auto-refresh-header {
    flex-direction: column;
    align-items: stretch;
  }

  .refresh-interval {
    justify-content: center;
  }

  .mail-item {
    padding: 0.75rem;
  }

  .mail-item-header {
    flex-direction: column;
  }

  .mail-date {
    margin-top: 0.25rem;
  }

  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-body {
    max-height: calc(90vh - 10rem);
  }
}

/* 加载动画 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

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

/* 语言切换器样式 */
.lang-selector {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: #f3f4f6;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: #e5e7eb;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  min-width: 160px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  border: 1px solid #f3f4f6;
}

.lang-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-option:hover {
  background: #f9fafb;
}

.lang-option:first-child {
  border-radius: 0.75rem 0.75rem 0 0;
}

.lang-option:last-child {
  border-radius: 0 0 0.75rem 0.75rem;
}

.lang-option.active {
  background: #eff6ff;
  color: #8b5cf6;
}

.lang-flag {
  font-size: 1.25rem;
}

.lang-name {
  font-size: 0.875rem;
  color: #374151;
}

.lang-option.active .lang-name {
  color: #8b5cf6;
  font-weight: 500;
}

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

/* ============ 新增：配置修复相关样式 ============ */

/* 连接中状态 */
.connection-status.connecting {
  background: #fefce8;
}

.connection-status.connecting i {
  animation: pulse-yellow 1s infinite;
}

.connection-status.connecting .status-text {
  color: #ca8a04;
}

@keyframes pulse-yellow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 通用颜色工具类 */
.text-green-500 { color: #22c55e; }
.text-red-500 { color: #ef4444; }
.text-yellow-500 { color: #eab308; }
.text-orange-500 { color: #f97316; }

/* HTML 邮件 iframe 容器 */
.html-mail-container {
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.mail-iframe {
  width: 100%;
  min-height: 200px;
  display: block;
  background: #fff;
}

/* 附件区域 */
.attachments-section {
  font-size: 0.875rem;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.375rem;
  background: #f9fafb;
  border-radius: 0.375rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}

.attachment-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.attachment-item i {
  color: #6b7280;
}

.attachment-item a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  word-break: break-all;
}

.attachment-item a:hover {
  text-decoration: underline;
}
