/* ================= 全局基础与字体设置 ================= */
:root {
    --sidebar-width: 320px;
    --mail-list-width: 400px;
    --border-color: #e2e8f0;
    --bg-gray: #f8fafc;
    --bg-white: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-placeholder: #94a3b8;
    --primary-color: #3b82f6;
    --primary-light: #eff6ff;
    --hover-bg: #f1f5f9;
    --active-bg: #eff6ff;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-md: 6px;
    --radius-lg: 10px;
}

body, html {
    margin: 0; padding: 0; height: 100vh; overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px; color: var(--text-primary);
    background-color: var(--bg-gray);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

/* 美化滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 复制图标 */
.hover-copy-icon { cursor: pointer; color: var(--text-placeholder); transition: all 0.2s; font-size: 16px; }
.hover-copy-icon:hover { color: var(--primary-color); transform: scale(1.1); }

/* ================= PC 端现代 3 栏架构 ================= */
.pc-app-view { display: flex; height: 100vh; width: 100vw; overflow: hidden; background: var(--bg-gray); }

/* 第一栏：侧边导航 */
.pc-sidebar {
    width: var(--sidebar-width); min-width: var(--sidebar-width);
    background: var(--bg-white); 
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; flex-shrink: 0; z-index: 10;
    box-shadow: var(--shadow-sm);
}
.pc-sidebar-header {
    height: 60px; display: flex; align-items: center; padding: 0 20px;
    font-size: 18px; font-weight: 700; color: var(--text-primary);
    letter-spacing: -0.5px;
}
.pc-sidebar-menu { flex: 1; overflow-y: auto; padding: 8px 12px; }

.pc-menu-item {
    padding: 10px 12px; display: flex; align-items: center; margin-bottom: 2px;
    color: var(--text-secondary); font-weight: 500; cursor: pointer; transition: all 0.15s ease;
    border-radius: var(--radius-md); font-size: 15px;
}
.pc-menu-item:hover { background: var(--hover-bg); color: var(--text-primary); }
.pc-menu-item.active { background: var(--primary-light); color: var(--primary-color); font-weight: 600; }
.pc-menu-item .el-icon { font-size: 20px; margin-right: 12px; opacity: 0.8; }
.pc-menu-item.active .el-icon { opacity: 1; }

.pc-sidebar-divider { height: 1px; background: var(--border-color); margin: 12px 10px; opacity: 0.6; }

.pc-group-header {
    padding: 8px 12px; display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: var(--text-secondary); font-weight: 600; cursor: pointer;
    margin-top: 4px;
}
.pc-group-header:hover { color: var(--text-primary); }

.pc-account-list { display: flex; flex-direction: column; margin-top: 2px; }
.pc-account-item {
    padding: 10px 12px; display: flex; align-items: center; margin: 0 0 2px 0;
    cursor: pointer; transition: 0.15s; position: relative; border-radius: var(--radius-md);
}
.pc-account-item:hover { background: var(--hover-bg); }
.pc-account-item.active { background: var(--primary-light); }

.acc-email { flex: 1; font-size: 15px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 10px;}
.pc-account-item.active .acc-email { color: var(--primary-color); font-weight: 500; }
.acc-badge { 
    background: var(--primary-color); color: #fff; font-size: 12px; 
    padding: 1px 8px; border-radius: 12px; font-weight: 600; min-width: 18px; text-align: center;
}


/* 第二栏：邮件列表 */
.pc-mail-list-panel {
    width: var(--mail-list-width); min-width: var(--mail-list-width);
    background: var(--bg-white); border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; flex-shrink: 0; z-index: 5;
}
.pc-mail-list-header { 
    padding: 16px 20px; border-bottom: 1px solid var(--border-color); 
    background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 2;
}
.mail-list-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mail-box-title { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.mail-count { font-size: 13px; color: var(--text-placeholder); font-weight: 500; margin-left: 8px; background: var(--bg-gray); padding: 2px 8px; border-radius: 12px; }
.mail-sort-btn { font-size: 13px; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; padding: 4px 8px; border-radius: 4px; transition: 0.2s; }
.mail-sort-btn:hover { background: var(--bg-gray); }

.pc-mail-list-items { flex: 1; overflow-y: auto; }
.pc-mail-item {
    padding: 14px 20px; border-bottom: 1px solid var(--border-color);
    cursor: pointer; display: flex; transition: all 0.15s; position: relative;
    background: var(--bg-white);
}
.pc-mail-item:hover { background: var(--hover-bg); }
.pc-mail-item.active { background: var(--primary-light); border-left: 3px solid var(--primary-color); padding-left: 17px; }
.pc-mail-dot {
    position: absolute; left: 8px; top: 20px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.pc-mail-info { flex: 1; min-width: 0; }
.pc-mail-top { display: flex; justify-content: space-between; margin-bottom: 4px; align-items: center; }
.pc-mail-sender { font-size: 15px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.pc-mail-date { font-size: 12px; color: var(--text-placeholder); flex-shrink: 0; font-weight: 500; }
.pc-mail-subject { font-size: 15px; color: var(--text-secondary); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pc-mail-item.active .pc-mail-subject { color: var(--text-primary); font-weight: 600; }
.pc-mail-preview { font-size: 13px; color: var(--text-placeholder); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
.empty-list-state { padding: 60px 20px; text-align: center; color: var(--text-placeholder); font-size: 15px; }


/* 第三栏：内容显示区 */
.pc-main-content {
    flex: 1; display: flex; flex-direction: column;
    background: var(--bg-white); min-width: 0;
}
.pc-topbar {
    height: 60px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: var(--bg-white); border-bottom: 1px solid var(--border-color);
}
.pc-search-box { flex: 1; max-width: 480px; }
.pc-search-box .el-input__wrapper {
    background-color: var(--bg-gray); border-radius: 8px; 
    box-shadow: none !important; padding: 6px 12px;
    border: 1px solid transparent; transition: 0.2s;
}
.pc-search-box .el-input__wrapper:hover { border-color: #cbd5e1; }
.pc-search-box .el-input__wrapper.is-focus { background: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1) !important; }

.pc-top-actions { display: flex; gap: 8px; }
.pc-top-actions .el-button.is-circle { width: 32px; height: 32px; border: 1px solid var(--border-color); box-shadow: none; }

/* 场景 A：账号总览表格 */
.pc-dashboard-view { padding: 20px 24px; flex: 1; overflow-y: auto; background: var(--bg-gray); }
.pc-table-card {
    background: var(--bg-white); padding: 24px; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
}
.dashboard-toolbar { margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; }
.el-table { border-radius: 6px; overflow: hidden; border: 1px solid var(--border-color); }
.el-table th.el-table__cell { background-color: #f8fafc !important; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); height: 44px; font-size: 14px; }
.el-table td.el-table__cell { border-bottom: 1px solid var(--border-color); padding: 10px 0; font-size: 14px; }
.pagination-container { margin-top: 24px; display: flex; justify-content: flex-end; }

/* 场景 B：邮件正文详情 */
.pc-mail-detail-view {
    flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 0; background: var(--bg-white);
}
.pc-detail-card {
    flex: 1; display: flex; flex-direction: column;
    background: var(--bg-white); border-radius: 0; border: none;
    box-shadow: none; overflow: hidden;
}
.pc-detail-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; border-bottom: 1px solid var(--border-color); background: var(--bg-white);
}
.pc-action-icons { display: flex; align-items: center; gap: 8px; }
.pc-action-icons .el-icon {
    padding: 6px; border-radius: 4px; cursor: pointer; color: var(--text-secondary); font-size: 18px; transition: 0.2s;
}
.pc-action-icons .el-icon:hover { background: var(--hover-bg); color: var(--text-primary); }

.pc-detail-header { padding: 24px 32px 20px; border-bottom: 1px solid var(--border-color); background: var(--bg-white); }
.pc-detail-subject { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; line-height: 1.3; letter-spacing: -0.3px; }
.pc-sender-info { display: flex; align-items: center; font-size: 15px; }
.sender-avatar { 
    width: 44px; height: 44px; border-radius: 50%; background: #e0e7ff; color: var(--primary-color);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; margin-right: 14px;
}
.sender-meta { display: flex; flex-direction: column; }
.sender-name { font-weight: 600; color: var(--text-primary); font-size: 16px; }
.sender-email { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }

.pc-iframe-container {
    flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg-white); position: relative;
}
.safe-iframe {
    flex: 1; width: 100%; height: 100%; border: none; display: block;
}

.empty-mail-view { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-placeholder); }
.empty-mail-view .el-icon { font-size: 80px; margin-bottom: 24px; color: #e2e8f0; }
.empty-mail-view p { font-size: 16px; color: var(--text-secondary); }


/* 弹窗底部按钮栏可见性修复 - 手动模拟 Footer - 终极修复 */
.manual-dialog-footer {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border-color);
    display: flex !important;
    justify-content: flex-end;
    gap: 12px;
    background: #fff; /* 确保背景不透明 */
    position: relative; /* 确保层级 */
    z-index: 10;
    margin-top: 20px; /* 增加一点顶部间距 */
}

/* ================= 完美的移动端 App UI 恢复 ================= */
@media screen and (max-width: 768px) {
    /* 主容器 */
    .m-app-view { display: flex; flex-direction: column; height: 100vh; background: #f8fafc; }
    
    /* 顶部导航 */
    .m-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
    .m-header h2 { margin: 0; font-size: 20px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
    .m-header-actions { font-size: 20px; color: var(--primary-color); }
    
    /* 中间列表区 */
    .m-body { flex: 1; overflow-y: auto; padding: 16px; }
    .m-card { background: #fff; border-radius: 16px; padding: 0 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); margin-bottom: 20px; border: 1px solid #f1f5f9; }
    
    /* 分组头部 */
    .m-group-header { display: flex; align-items: center; padding: 16px 0; border-bottom: 1px solid #f1f5f9; }
    .m-group-icon { width: 40px; height: 40px; background: #eff6ff; border-radius: 10px; display: flex; justify-content: center; align-items: center; color: var(--primary-color); font-size: 20px; margin-right: 14px; }
    .m-group-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
    .m-group-subtitle { font-size: 12px; color: var(--text-placeholder); margin-top: 2px; }
    
    /* 账号列表条目 */
    .m-item { display: flex; align-items: center; padding: 18px 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
    .m-item:last-child { border-bottom: none; }
    .m-avatar { width: 48px; height: 48px; border-radius: 50%; background: #f1f5f9; color: var(--text-secondary); display: flex; justify-content: center; align-items: center; font-size: 20px; font-weight: bold; margin-right: 16px; flex-shrink: 0; }
    .m-info { flex: 1; min-width: 0; }
    .m-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .m-subtitle { font-size: 13px; color: var(--text-placeholder); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    
    /* 状态圆点与角标 */
    .m-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-left: 12px; }
    .m-dot { width: 8px; height: 8px; border-radius: 50%; }
    .dot-green { background: var(--success-color); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
    .dot-red { background: var(--danger-color); }
    .m-badge { background: var(--primary-color); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; min-width: 16px; text-align: center; }
    
    /* 底部悬浮按钮 */
    .m-bottom-bar { background: #fff; padding: 16px 24px; border-top: 1px solid #f1f5f9; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 -4px 12px rgba(0,0,0,0.02); }
    .m-add-btn { flex: 1; display: flex; justify-content: center; align-items: center; height: 48px; background: var(--primary-color); color: white; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; margin-right: 16px; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
    .m-icon-btn { width: 48px; height: 48px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; font-size: 20px; display: flex; justify-content: center; align-items: center; color: var(--text-secondary); }
    
    /* 移动端专属二级/三级页面结构 */
    .m-mail-list-view, .m-mail-detail-view { display: flex; flex-direction: column; height: 100vh; background: #fff; }
    .m-detail-back { display: flex; align-items: center; padding: 16px 20px; background: #fff; color: var(--primary-color); font-weight: 600; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 15px; }
    .pc-mail-list-items { height: calc(100vh - 55px); overflow-y: auto; background: #fff; }
}
