* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 认证界面样式 */
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
    font-size: 24px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.auth-form {
    display: block;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

/* 登录/注册表单中的主按钮保持通栏 */
.auth-form .btn-primary {
    width: 100%;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

.email-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.email-item:hover {
    background-color: #f8f9fa;
}

.email-content {
    flex: 1;
    min-width: 0;
}

.email-actions {
    margin-left: 15px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
/* 将按钮组右对齐，保留“全选”在左侧 */
.email-actions .btn:first-of-type {
    margin-left: auto;
}
/* 强制“全选 + 删除已选 + 刷新”同一行显示 */
.email-actions { flex-wrap: nowrap; }
.select-all { width: auto; order: 0; white-space: nowrap; }

.select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #495057;
}

.email-item {
    position: relative;
}

.email-item .email-select {
    margin-right: 10px;
}

.email-item.selected {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.email-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eee;
    position: fixed; /* 固定在视口底部 */
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 100;
    box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.04);
}

.email-detail-actions .btn {
    padding: 10px 16px; /* 更大按钮 */
    font-size: 14px;
}

.modal-body {
    padding: 20px 0;
    text-align: center;
}

.modal-body p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* 主界面样式 */
.main-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

.header {
    background: #667eea;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 20px;
    overflow-y: auto;
}

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

.section-header h3 {
    color: #495057;
    font-size: 16px;
}

.mailbox-list {
    list-style: none;
}

.mailbox-item {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mailbox-item:hover {
    background: #667eea;
    color: #fff;
    transform: translateX(5px);
}

.mailbox-item.active {
    background: #667eea;
    color: white;
}

/* 悬停/选中时，标题、地址与统计都变为白色，保证可读性 */
.mailbox-item:hover .mailbox-info h4,
.mailbox-item:hover .mailbox-info p,
.mailbox-item:hover .mailbox-info .counts,
.mailbox-item:hover .mailbox-info .counts .unread,
.mailbox-item.active .mailbox-info h4,
.mailbox-item.active .mailbox-info p,
.mailbox-item.active .mailbox-info .counts,
.mailbox-item.active .mailbox-info .counts .unread {
    color: #fff;
}

.mailbox-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.mailbox-info p {
    font-size: 12px;
    color: #6c757d;
}

.mailbox-info .counts {
    margin-top: 6px;
    font-size: 12px;
    color: #6c757d;
}
.mailbox-info .counts .unread {
    color: #2e7d32;
    font-weight: 600;
}

.mailbox-item.active .mailbox-info p {
    color: rgba(255, 255, 255, 0.8);
}

.mailbox-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mailbox-copy-btn {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

/* 在紫色底（仅当鼠标悬停在按钮本身时）按钮改为白字 */
.mailbox-actions .mailbox-copy-btn:hover {
	color: #fff !important;
	background: #667eea !important;
	border-color: #667eea !important;
}

/* 取消卡片悬停或激活时强制白色，保持默认深色 */
.mailbox-item:hover .mailbox-actions .mailbox-copy-btn,
.mailbox-item.active .mailbox-actions .mailbox-copy-btn {
	color: #495057 !important;
	border-color: #dee2e6 !important;
	background: transparent !important;
}

/* 当卡片本身处于悬停或选中状态，并且鼠标悬停在按钮上时，强制白字（优先级更高） */
.mailbox-item:hover .mailbox-actions .mailbox-copy-btn:hover,
.mailbox-item.active .mailbox-actions .mailbox-copy-btn:hover {
	color: #fff !important;
	background: rgba(255,255,255,0.22) !important;
	border-color: rgba(255,255,255,0.95) !important;
}

/* 普通白底列表项时，悬停保持深色文字不影响可读性 */
.mailbox-item:not(.active):not(:hover) .mailbox-copy-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.delete-mailbox-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.delete-mailbox-btn:hover {
    background: #c82333;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.welcome-screen {
    text-align: center;
    margin-top: 100px;
}

.welcome-screen h2 {
    color: #667eea;
    margin-bottom: 15px;
}

.welcome-screen p {
    color: #6c757d;
    font-size: 16px;
}

.email-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.email-header h2 {
    color: #495057;
}

.email-list {
    flex: 1;
    overflow-y: auto;
}

.email-item {
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.email-item:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 未读邮件列表项浅绿色背景 */
.email-item.unread {
    border-left: 4px solid #2e7d32;
    background: #f1fff1;
    font-weight: 600;
}

.email-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.email-from {
    font-weight: 500;
    color: #495057;
}

.email-date {
    font-size: 12px;
    color: #6c757d;
}

.email-subject {
    font-size: 16px;
    color: #212529;
    margin-bottom: 5px;
}

.email-preview {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.4;
}

.email-detail {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); /* 与较高操作条匹配 */
    position: relative;
}

/* 确保 iframe 不会盖住底部操作条 */
.email-detail iframe {
    display: block;
    width: 100%;
    background: #fff;
    border-radius: 8px;
    position: relative;
    z-index: 0;
}

.email-detail-header {
    margin-bottom: 20px;
}

.email-detail h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 24px;
}

.email-detail-meta {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.email-detail-meta p {
    margin-bottom: 5px;
    font-size: 14px;
}

.email-detail-meta strong {
    color: #495057;
}

.email-body {
    line-height: 1.6;
    font-size: 16px;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    color: #495057;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

.close-btn:hover {
    color: #495057;
}

.email-input {
    display: flex;
    align-items: center;
    border: 2px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.email-input input {
    flex: 1;
    border: none;
    padding: 12px;
    font-size: 16px;
}

.email-input input:focus {
    outline: none;
}

.email-input span {
    background: #f8f9fa;
    padding: 12px;
    color: #6c757d;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh; /* 增大“我的邮箱”可视区域 */
        overscroll-behavior: contain;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .header h1 {
        font-size: 18px;
    }
}

/* 顶部邮件操作区按钮统一尺寸 */
.email-header .btn {
    padding: 8px 14px;
    font-size: 14px;
}

/* 放大复选框（列表与全选） */
.select-all input[type="checkbox"],
.email-item .email-select {
    transform: scale(1.4);
    transform-origin: left center;
    accent-color: #667eea;
}

.email-item .email-select {
    margin-right: 12px;
}

.mailbox-manage-list .mailbox-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}
.mailbox-row .left {
    display: flex;
    flex-direction: column;
}
.mailbox-row .left small {
    color: #6c757d;
}

/* 链接型按钮：去除下划线，保持白色文字 */
a.btn, a.btn:visited {
	text-decoration: none;
	color: inherit;
}

a.btn:hover, a.btn:focus, a.btn:active {
	text-decoration: none;
	color: inherit;
}

/* 背景模糊开关：当 body 有 .blurred 时，让主容器模糊 */
body.blurred .main-container {
	filter: blur(3px);
	transition: filter 0.2s ease;
}

/* 提升模态层级与阴影 */
.modal {
	z-index: 2000;
	backdrop-filter: blur(2px);
}
.modal .modal-content {
	box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}

/* 移动端优化 */
@media (max-width: 768px) {
	/* 侧边栏与标题字号缩小 */
	.mailbox-info h4 { font-size: 13px; }
	.section-header h3 { font-size: 15px; }
	.email-header h2 { font-size: 16px; line-height: 1.3; }

	/* 邮件列表项留白更紧凑 */
	.email-item { padding: 12px; }
	.email-meta { margin-bottom: 6px; }
	.email-subject { font-size: 15px; }

	/* 顶部操作区域可换行，按钮不截断 */
	.email-header { flex-direction: column; align-items: stretch; gap: 8px; }
	.email-actions { display: flex; flex-wrap: wrap; gap: 8px; }
	.email-header .btn { padding: 8px 10px; font-size: 13px; }
	.select-all { font-size: 13px; }
	.select-all input[type="checkbox"], .email-item .email-select { transform: scale(1.2); }
}

@media (max-width: 420px) {
	/* 顶部栏缩小，避免按钮换行 */
	.header { padding: 8px 10px; }
	.header h1 { font-size: 16px; }
	.user-info { gap: 6px; }
	.user-info .btn { padding: 6px 10px; font-size: 12px; white-space: nowrap; }

	/* 邮件列表标题与按钮更紧凑 */
	.email-header h2 { font-size: 14px; }
	.email-header .btn { padding: 6px 10px; font-size: 12px; }
	.select-all { font-size: 12px; width: auto; order: 0; margin-right: 0; }
	.email-actions { gap: 6px; flex-wrap: nowrap; margin-left: 0; }
	.email-detail {
		padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
	}
	.email-detail-actions { padding: 10px 12px; gap: 10px; }
	.email-detail-actions .btn { padding: 9px 14px; font-size: 14px; }
}

/* 临时邮箱样式 */
.temp-badge {
    display: inline-block;
    background: #ffc107;
    color: #856404;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    margin-top: 4px;
}

.claim-btn {
    background: #007bff !important;
    color: white !important;
}

.claim-btn:hover {
    background: #0056b3 !important;
}

.delete-btn {
    background: #dc3545 !important;
    color: white !important;
}

.delete-btn:hover {
    background: #c82333 !important;
}
