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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

header {
    background: #0078d4;
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

header h1 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 5px;
}

.header-description {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

.settings-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 400px;
    height: calc(100vh - 68px);
}

/* 侧边栏 */
.sidebar {
    background: #fafafa;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    padding: 20px;
}

.sidebar h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #666;
}

.login-section {
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #0078d4;
}

.error-message {
    padding: 10px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #d32f2f;
    font-size: 13px;
    margin-top: 10px;
}

.logged-in-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.current-account {
    padding: 15px;
    background: #e6f4ff;
    border: 2px solid #0078d4;
    border-radius: 6px;
}

.account-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}

.current-email {
    font-weight: 600;
    font-size: 14px;
    color: #0078d4;
    word-break: break-all;
}

.btn-primary,
.btn-secondary {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    margin-top: 8px;
}

.btn-primary {
    background: #0078d4;
    color: white;
}

.btn-primary:hover {
    background: #005a9e;
}

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

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 邮件列表 */
.email-list-section {
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.toolbar {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.toolbar .btn-secondary {
    width: auto;
    margin: 0;
    padding: 8px 16px;
}

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

.pagination .btn-secondary {
    padding: 6px 12px;
    font-size: 13px;
}

#pageInfo {
    font-size: 14px;
    color: #666;
}

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

.email-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

.email-item:hover {
    background: #f9f9f9;
}

.email-item.active {
    background: #e6f4ff;
    border-left: 3px solid #0078d4;
}

.email-item.unread {
    background: #fff;
    font-weight: 500;
}

.email-subject {
    font-size: 15px;
    margin-bottom: 6px;
    color: #333;
}

.email-from {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

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

.email-preview {
    font-size: 13px;
    color: #888;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 邮件详情 */
.email-detail-section {
    background: white;
    overflow-y: auto;
}

.email-detail {
    padding: 30px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #999;
    font-size: 16px;
}

.detail-header {
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.detail-subject {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.detail-meta {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
}

.detail-meta-row {
    display: flex;
    margin-bottom: 6px;
}

.detail-meta-label {
    font-weight: 600;
    min-width: 80px;
}

.detail-body {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

.detail-body-html {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    background: #fafafa;
    max-height: 600px;
    overflow-y: auto;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.error {
    text-align: center;
    padding: 40px;
    color: #d32f2f;
    font-size: 14px;
}

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

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

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

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

/* 响应式 */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 260px 1fr 350px;
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar,
    .email-detail-section {
        display: none;
    }
}

/* 模态框样式 */
.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-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.add-key-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.add-key-section h3,
.key-list-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #555;
}

.key-list-section {
    margin-top: 20px;
}

.key-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.key-item-info {
    flex: 1;
}

.key-item-email {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.key-item-key {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

.delete-btn {
    padding: 6px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

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