* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  min-height: 100vh;
}

/* 登录页面 */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  text-align: center;
  min-width: 300px;
}

.login-box h2 {
  margin-bottom: 25px;
  color: #333;
}

.login-box input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e1e5eb;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus {
  border-color: #667eea;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.login-box button:hover {
  transform: scale(1.02);
}

.login-error {
  color: #ff4757;
  margin-top: 15px;
  font-size: 0.9rem;
}

/* 随机邮箱生成器 */
.random-email-box {
  padding: 12px 15px;
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  border-bottom: 1px solid #e1e5eb;
}

.random-email-display {
  background: white;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  word-break: break-all;
  margin-bottom: 10px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  cursor: pointer;
}

.random-email-display.has-email {
  color: #333;
  font-weight: 500;
}

.random-email-actions {
  display: flex;
  gap: 8px;
}

.random-email-actions button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.random-email-actions button:first-child {
  background: #667eea;
  color: white;
}

.random-email-actions button:last-child {
  background: #2ed573;
  color: white;
}

.random-email-actions button:hover {
  opacity: 0.9;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* 头部 */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.stats {
  display: flex;
  gap: 20px;
}

.stat-item {
  font-size: 0.9rem;
  opacity: 0.9;
}

.stat-item strong {
  font-weight: 600;
}

/* 主体布局 */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 左侧邮箱列表 */
.sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid #e1e5eb;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 15px;
  border-bottom: 1px solid #e1e5eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 1rem;
  color: #555;
}

.btn-refresh {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: background 0.2s;
}

.btn-refresh:hover {
  background: #f0f0f0;
}

.mailbox-list {
  flex: 1;
  overflow-y: auto;
}

.mailbox-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
}

.mailbox-item:hover {
  background: #f8f9fa;
}

.mailbox-item.active {
  background: #e8f0fe;
  border-left: 3px solid #667eea;
}

.mailbox-address {
  font-size: 0.85rem;
  color: #333;
  word-break: break-all;
  margin-bottom: 5px;
}

.mailbox-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #888;
}

.unread-badge {
  background: #ff4757;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
}

/* 中间邮件列表 */
.email-list-panel {
  width: 350px;
  background: white;
  border-right: 1px solid #e1e5eb;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 15px;
  border-bottom: 1px solid #e1e5eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  font-size: 0.95rem;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-delete-all, .btn-delete {
  background: #ff4757;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.btn-delete-all:hover, .btn-delete:hover {
  background: #ff3344;
}

.email-list {
  flex: 1;
  overflow-y: auto;
}

.email-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
}

.email-item:hover {
  background: #f8f9fa;
}

.email-item.active {
  background: #e8f0fe;
}

.email-item.unread {
  background: #fff8e6;
}

.email-item.unread .email-subject {
  font-weight: 600;
}

.email-from {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-subject {
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #888;
}

.verification-code {
  background: #2ed573;
  color: white;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 600;
  font-family: monospace;
}

/* 右侧邮件详情 */
.email-detail-panel {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
}

.email-detail {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.detail-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e1e5eb;
}

.detail-subject {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 15px;
}

.detail-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 15px;
  font-size: 0.9rem;
}

.detail-label {
  color: #888;
}

.detail-value {
  color: #333;
}

.detail-code {
  background: linear-gradient(135deg, #2ed573 0%, #1abc9c 100%);
  color: white;
  padding: 15px 25px;
  border-radius: 10px;
  font-size: 2rem;
  font-weight: 700;
  font-family: monospace;
  text-align: center;
  margin: 20px 0;
  letter-spacing: 5px;
  box-shadow: 0 4px 15px rgba(46, 213, 115, 0.3);
}

.detail-content {
  margin-top: 20px;
}

.detail-content h4 {
  color: #555;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.content-text {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.content-html {
  background: white;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.view-html-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-top: 10px;
}

.view-html-btn:hover {
  background: #5a6fd6;
}

/* 空状态 */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #888;
  font-size: 1rem;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #888;
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #e1e5eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1rem;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-body iframe {
  width: 100%;
  height: 500px;
  border: none;
}

/* 响应式 */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }
  .email-list-panel {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .main {
    flex-direction: column;
  }
  .sidebar, .email-list-panel, .email-detail-panel {
    width: 100%;
    height: auto;
  }
  .stats {
    display: none;
  }
}
