/**
 * 微软邮箱 API 短链生成器 - 极简精致版
 * 设计理念：Clean, Modern, Airy
 */

/* === 字体引入 === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* === 变量定义 === */
:root {
    /* 品牌色 - 更加清新的蓝紫色调 */
    --brand-primary: #4f46e5;
    --brand-secondary: #818cf8;
    --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);

    /* 功能色 */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* 背景色 */
    --bg-page: #f5f5f7;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-hover: #f1f5f9;

    /* 文字色 */
    --text-main: #1e293b;
    --text-sub: #64748b;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;

    /* 边框与阴影 - 极致细腻版 (Apple Style) */
    --border-light: rgba(0, 0, 0, 0.06);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.1);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 8px;
}

/* === 全局重置 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* 禁止水平滚动 */
    zoom: 0.95;
    /* 整体缩放 95% */
}

/* === 布局容器 === */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px;
    flex: 1;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    /* align-items: start; Removed to allow equal height */
}

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

/* === 头部设计 === */
.header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.header h1 i {
    color: var(--brand-primary);
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 28px;
}

.header p {
    color: var(--text-sub);
    font-size: 14px;
    max-width: 600px;
    margin: 0 auto;
}

.btn-buy-header {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    color: var(--brand-primary);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.btn-buy-header:hover {
    background: white;
    border-color: var(--brand-primary);
    transform: translateY(-50%) translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    color: var(--brand-dark);
}

.btn-buy {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
    border: 1px solid transparent;
    /* Ensure height consistency */
    text-decoration: none;
    padding: 10px 16px;
    /* Reduced padding */
}

.btn-buy:hover {
    box-shadow: 0 8px 20px rgba(244, 63, 94, 0.4);
    transform: translateY(-2px);
    color: white;
    border-color: transparent;
}

@media (max-width: 768px) {
    .btn-buy-header {
        position: static;
        margin-top: 16px;
        transform: none;
        display: inline-flex;
    }

    .btn-buy-header:hover {
        transform: translateY(-2px);
    }
}

/* === 卡片通用样式 === */
.section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
    border: 1px solid var(--border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: visible;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* #settings-section removed */

.section:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.section-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    position: relative;
    z-index: 50;
    overflow: visible !important;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--brand-primary);
    opacity: 0.8;
}

/* === 导入方式切换 === */
.import-methods {
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 4px;
}

.method-btn {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.method-btn:hover {
    color: var(--text-main);
}

.method-btn.active {
    background: var(--bg-card);
    color: var(--brand-primary);
    box-shadow: var(--shadow-xs);
    font-weight: 600;
}

/* === 内容区域 === */
.import-method {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 12px;
}

.format-tip {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 8px;
}

/* 输入框美化 */
textarea,
input[type="text"],
input[type="password"],
input[type="url"] {
    width: 100%;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-main);
    transition: all 0.2s ease;
    resize: vertical;
}

textarea:focus,
input:focus {
    outline: none;
    background: var(--bg-card);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

textarea {
    flex: 1;
    min-height: 250px;
    line-height: 1.8;
    resize: none;
}

.line-count {
    /* float: right; Removed float as we use flex now */
    font-size: 12px;
    color: #15803d;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    /* Prevent line break */
    display: inline-block;
    /* Ensure proper box model */
}

textarea::placeholder,
input::placeholder {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    opacity: 0.8;
    font-weight: 400;
}

/* 按钮美化 */
.input-actions {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-sub);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background: var(--bg-hover);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

/* 上传区域 */
.upload-area {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    /* Reduced from 48px */
    text-align: center;
    background: var(--bg-input);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    min-height: 180px;
    /* Ensure sufficient height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-area:hover {
    border-color: var(--brand-primary);
    background: rgba(79, 70, 229, 0.02);
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-content {
    pointer-events: none;
    /* Prevent clicks on children blocking the input */
}

.upload-content i {
    font-size: 36px;
    /* Reduced from 48px */
    color: var(--brand-primary);
    margin-bottom: 12px;
    /* Reduced margin */
    opacity: 0.8;
}

.upload-content h3 {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 6px;
}

.upload-content p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-content .btn {
    padding: 6px 16px;
    font-size: 12px;
}

/* 上传预览区域 */
.upload-preview {
    margin-top: 12px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.preview-header {
    padding: 8px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-sub);
}

.preview-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-content {
    padding: 12px 16px;
    max-height: 150px;
    overflow-y: auto;
    background: #ffffff;
}

/* 自定义滚动条样式 */
.preview-content::-webkit-scrollbar {
    width: 4px;
}

.preview-content::-webkit-scrollbar-track {
    background: transparent;
}

.preview-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.preview-code-block {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-sub);
    white-space: pre;
    margin: 0;
}

/* 设置区域 */
.settings-grid {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.setting-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 13px;
}

.setting-item label i {
    color: var(--brand-primary);
    font-size: 14px;
}

.setting-item small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.setting-item input {
    padding: 10px 12px;
    font-size: 13px;
}

/* 设置区域按钮 */
.settings-actions {
    padding: 0 20px 20px 20px;
    display: flex;
    gap: 10px;
}

.settings-actions .btn {
    padding: 10px 20px;
    font-size: 13px;
}

.settings-actions .btn-block {
    flex: 1;
}

/* 预览表格 */
.preview-stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-table-container {
    overflow-x: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table th {
    background: var(--bg-page);
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    color: var(--text-sub);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.preview-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-page);
    color: var(--text-main);
}

.preview-table tr:last-child td {
    border-bottom: none;
}

.preview-table tr:hover td {
    background: var(--bg-hover);
}

/* === 结果区域新样式 === */
.header-actions {
    display: flex;
    align-items: center;
}

.search-box {
    position: relative;
    width: 240px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    font-size: 13px;
    border-radius: 20px;
    background: var(--bg-input);
    border: 1px solid transparent;
    height: 36px;
}

.search-box input:focus {
    background: white;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.result-toolbar {
    padding: 16px 32px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}

.result-stats-bar {
    display: flex;
    gap: 12px;
}

.stat-tag {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    background: white;
    border: 1px solid var(--border-light);
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-tag b {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.stat-tag.total b {
    color: var(--brand-primary);
}

.stat-tag.success b {
    color: var(--color-success);
}

.stat-tag.error b {
    color: var(--color-danger);
}

.result-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.result-table-container {
    overflow-x: auto;
    max-height: 600px;
    position: relative;
    z-index: 5;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.result-table th {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-sub);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.result-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--bg-page);
    color: var(--text-main);
    vertical-align: middle;
    font-size: 13px;
}

.result-empty-state {
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.result-empty-state i {
    font-size: 56px;
    opacity: 0.2;
    color: var(--text-main);
    margin-bottom: 8px;
}

.result-empty-state p {
    font-size: 14px;
    font-weight: 500;
    color: #c9ced6;
}

.data-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
}

.data-cell span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-copy-mini {
    opacity: 0;
    border: none;
    background: transparent;
    color: var(--brand-primary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 12px;
}

.data-cell:hover .btn-copy-mini,
.link-cell-compact:hover .btn-copy-mini {
    opacity: 1;
    background: rgba(79, 70, 229, 0.1);
}

.link-cell-compact {
    display: flex;
    align-items: center;
    gap: 8px;
}

.short-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.short-link:hover {
    text-decoration: underline;
}

.index-badge {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    font-size: 12px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    /* 强制不换行 */
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: white;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: var(--bg-hover);
}

.btn-icon.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-input);
}

/* 简要说明 */
.simple-help {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 13px;
    background: rgba(255, 255, 255, 0.5);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.simple-help code {
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--brand-primary);
    font-size: 12px;
}

/* 操作按钮区 */
.action-section {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: auto;
}

/* 辅助类 */
.hidden {
    display: none !important;
}

/* 状态颜色 */
.text-success {
    color: var(--color-success);
}

.text-error {
    color: var(--color-danger);
}

/* 邮件查看器特定样式 */
.mail-container {
    max-width: 1120px;
    /* 宽度减少 1/5 (原 1400px) */
    width: 95%;
    margin: 0 auto;
    padding: 24px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.mail-header {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 0;
    /* 移除内边距，由内容控制 */
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    /* 确保圆角 */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    width: 100%;
}

.mail-header h1 {
    font-size: 20px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    white-space: nowrap;
}

.mail-header h1 i {
    font-size: 24px;
    background: var(--brand-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.account-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    padding: 8px 20px;
    border-radius: 20px;
    margin: 0 32px;
    /* 增加左右间距 */
    flex: 1;
    /* 占据中间空间 */
    justify-content: center;
    max-width: 600px;
    /* 限制最大宽度 */
}

.account-info i {
    color: var(--brand-primary);
    font-size: 16px;
}

#email-display {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: #10b981;
    font-size: 15px;
    /* 增大字体 */
    display: flex;
    align-items: center;
    gap: 12px;
}

#email-display small {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12px;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    box-shadow: var(--shadow-xs);
}

.header-actions {
    display: flex;
    gap: 16px;
    /* 增加按钮间距 */
    align-items: center;
}

.header-actions .btn {
    padding: 8px 20px;
    font-size: 13px;
}

.mailbox-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.tab-btn {
    background: var(--bg-card);
    border: 1px solid transparent;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.tab-btn.active {
    background: var(--brand-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.mail-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mail-item {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.mail-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary);
}

.mail-subject {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.mail-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-sub);
    font-size: 13px;
    margin-bottom: 12px;
}

.verification-code {
    display: inline-block;
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
    margin-top: 12px;
}

/* === 布局优化 === */
.main-grid {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

.main-grid .section {
    margin-bottom: 0;
    height: 100%;
}

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

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

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

    .section-header {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .import-methods {
        width: 100%;
        flex-wrap: wrap;
        /* 允许换行 */
        gap: 8px;
        /* 增加间距 */
    }

    .method-btn {
        flex: 1 0 45%;
        /* 基础宽度45%，强制一行两个 */
        justify-content: center;
        margin: 0 !important;
        /* 清除可能的外边距 */
    }

    .action-section {
        flex-direction: column;
    }

    .btn-large {
        width: 100%;
    }

    /* 结果工具栏适配 */
    .result-toolbar {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        padding: 16px;
    }

    .result-stats-bar {
        justify-content: space-between;
        width: 100%;
    }

    .result-buttons {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        /* 允许换行 */
        gap: 8px;
        /* 间距保持一致 */
    }

    .result-buttons .btn {
        flex: 1 0 45%;
        /* 基础宽度45%，2x2布局 */
        margin: 0;
        justify-content: center;
    }

    /* 分页控件适配 */
    .pagination-toolbar {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
        align-items: center;
    }

    .pagination-info {
        text-align: center;
        width: 100%;
        margin-bottom: 0;
    }

    .pagination-controls {
        flex-direction: column;
        width: 100%;
        align-items: center;
        gap: 12px;
    }

    .page-size-selector {
        width: 100%;
        justify-content: center;
        background: var(--bg-input);
        padding: 8px;
        border-radius: var(--radius-sm);
    }

    .page-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .page-jump-container {
        display: flex;
        align-items: center;
    }

    .btn-page {
        width: 36px;
        /* 稍微加大触摸区域 */
        height: 36px;
    }

    /* 邮箱页面适配 */
    .mail-container {
        padding: 12px;
        padding-bottom: 40px;
        height: auto;
        min-height: 100vh;
    }

    .header-content {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .account-info {
        margin: 0;
        width: 100%;
        max-width: none;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .header-actions .btn {
        flex: 1;
    }

    .split-view {
        flex-direction: column;
        height: auto;
        gap: 16px;
    }

    .mail-column {
        min-height: 500px;
        height: auto;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    text-align: center;
    color: var(--brand-primary);
}

.loading-spinner i {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Password Modal */
.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-content h2 i {
    color: var(--brand-primary);
}

.modal-content p {
    color: var(--text-sub);
    margin-bottom: 24px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Toast */
.toast {
    position: fixed;
    top: 32px;
    left: 50%;
    /* 居中显示 */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 8px 20px 8px 8px;
    /* 调整内边距 */
    border-radius: 50px;
    /* 胶囊形状 */
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.1),
        0 4px 10px -2px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    /* 增加内发光质感 */
    z-index: 10000;
    transform: translate(-50%, -150%) scale(0.9);
    /* 初始位置在顶部上方 */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    /* 内容居中 */
    gap: 10px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 14px;
    /* 稍微加大字体 */
    min-width: auto;
    /* 移除最小宽度限制 */
    width: fit-content;
    /* 宽度自适应内容 */
    max-width: 90vw;
    /* 防止在移动端过宽 */
}

.toast.show {
    transform: translate(-50%, 0) scale(1);
}

/* Toast 图标容器 */
.toast i {
    width: 32px;
    /* 加大图标区域 */
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* Toast 类型样式 */
.toast-success i {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #15803d;
    box-shadow: 0 2px 4px rgba(21, 128, 61, 0.1);
}

.toast-error i {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #b91c1c;
    box-shadow: 0 2px 4px rgba(185, 28, 28, 0.1);
}

.toast-warning i {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    box-shadow: 0 2px 4px rgba(180, 83, 9, 0.1);
}

.toast-info i {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
    box-shadow: 0 2px 4px rgba(67, 56, 202, 0.1);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === 分页控件 === */
.pagination-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--bg-page);
    background: var(--bg-card);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-sub);
}

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

.page-size-selector {
    font-size: 13px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-page {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background: white;
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: var(--bg-hover);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-input);
}

.page-current {
    font-weight: 600;
    color: var(--text-main);
    min-width: 20px;
    text-align: center;
}

/* === 邮件分栏视图样式 === */
.split-view {
    display: flex;
    gap: 24px;
    height: calc(85vh - 200px);
    /* 高度减少约 1/6 */
    padding-bottom: 0;
    margin-bottom: 40px;
}

.mail-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-light);
}

.inbox-column {
    background: linear-gradient(to bottom, #f0f9ff, #f8fafc);
    border-color: #bae6fd;
}

.junk-column {
    background: linear-gradient(to bottom, #fff1f2, #ffffb8);
    /* 稍微带点警告色 */
    border-color: #fecdd3;
    background: linear-gradient(to bottom, #fff7ed, #fffbeb);
    /* 或者是橙色系 */
}

/* 修正垃圾箱背景色，保持清新 */
.junk-column {
    background: linear-gradient(to bottom, #fff5f5, #f8fafc);
    border-color: #ffe4e6;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.column-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.column-header h2 small {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.5);
    padding: 2px 8px;
    border-radius: 10px;
}

.column-header h2 i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-xs);
    font-size: 16px;
}

.inbox-column .column-header h2 i {
    color: var(--brand-primary);
}

.junk-column .column-header h2 i {
    color: var(--color-danger);
}

.latest-mail-container {
    flex: 1;
    position: relative;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* 邮件卡片样式 */
.mail-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.mail-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--bg-input);
}

.sender-avatar .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    box-shadow: var(--shadow-sm);
}

.sender-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sender-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 16px;
    margin-bottom: 4px;
}

.mail-date {
    font-size: 12px;
    color: var(--text-muted);
}

.mail-card-body {
    flex: 1;
    overflow-y: auto;
}

.mail-subject {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.badge-code {
    font-size: 11px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    vertical-align: middle;
}

.verification-codes-area {
    background: #f0fdf4;
    border: 1px dashed #86efac;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.codes-label {
    font-size: 12px;
    font-weight: 600;
    color: #15803d;
    margin-bottom: 8px;
}

.codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.code-chip {
    background: white;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-chip:hover {
    background: #dcfce7;
    transform: scale(1.02);
}

.code-chip i {
    font-size: 12px;
    opacity: 0.5;
}

.mail-preview-content {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.mail-card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--bg-input);
    text-align: right;
}

.btn-text {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.btn-text:hover {
    background: rgba(79, 70, 229, 0.05);
}

/* 空状态 */
.empty-state {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    border: 2px dashed rgba(0, 0, 0, 0.05);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-light);
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 13px;
}

/* === 动态背景球效果 === */
.blob-container {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.4;
    z-index: -1;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    width: 120px;
    height: 120px;
    background: #e0e7ff;
    top: -20px;
    right: -20px;
    animation-delay: 0s;
}

.blob-2 {
    width: 100px;
    height: 100px;
    background: #f0fdf4;
    bottom: -20px;
    left: -20px;
    animation-delay: 2s;
}

.blob-3 {
    width: 80px;
    height: 80px;
    background: #fff1f2;
    top: 40%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(10px, -15px) scale(1.1);
    }

    66% {
        transform: translate(-5px, 10px) scale(0.9);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

/* 确保内容在球之上 */
.mail-card,
.section,
.mail-header {
    position: relative;
    overflow: hidden;
    /* 限制球在卡片内 */
}

/* 使用 :not(.blob) 排除背景球，防止它们变成 relative 定位 */
.mail-card>*:not(.blob),
.section>*:not(.blob),
.mail-header>*:not(.blob) {
    position: relative;
    z-index: 2;
}

/* 针对不同区域的球色微调 */
.inbox-column .blob-1 {
    background: #dbeafe;
}

.inbox-column .blob-2 {
    background: #e0f2fe;
}

.junk-column .blob-1 {
    background: #fee2e2;
}

.junk-column .blob-2 {
    background: #ffedd5;
}

/* === 呼吸图标动画 === */
@keyframes breathe-glow {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(79, 70, 229, 0.3));
    }

    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 8px rgba(79, 70, 229, 0.6));
    }
}

.breathing-icon {
    display: inline-block;
    animation: breathe-glow 3s infinite ease-in-out;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* 确保渐变背景生效 */
    background-clip: text;
    color: transparent;
    /* 兼容性回退 */
}

.apple-brand-icon {
    /* 扁平有质感的设计 */
    background: linear-gradient(to bottom right, #ff3b30, #c0251e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
    font-size: 1.3em;
    /* 增大图标比例 */
    position: relative;
    top: -1px;
    /* 微调垂直位置 */
}

/* 页面顶部品牌标题 */
.page-brand-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 5;
    /* 确保在背景球之上 */
}

.page-brand-header h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    /* 增加一点立体感 */
}

/* === 错误页面样式 === */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-page);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.error-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    max-width: 420px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: modalSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px;
    box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.3);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.error-card h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.error-card p {
    color: var(--text-sub);
    margin-bottom: 32px;
    font-size: 15px;
    line-height: 1.6;
}

.error-container .blob {
    position: absolute;
    z-index: 1;
}

.error-container .blob-1 {
    top: 20%;
    left: 20%;
    width: 300px;
    height: 300px;
    background: rgba(99, 102, 241, 0.2);
    filter: blur(60px);
}

.error-container .blob-2 {
    bottom: 20%;
    right: 20%;
    width: 250px;
    height: 250px;
    background: rgba(236, 72, 153, 0.2);
    filter: blur(60px);
}

.error-container .blob-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: rgba(16, 185, 129, 0.15);
    filter: blur(50px);
}

/* 邮件内容视图 */
.mail-content-view {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    overflow-x: auto;
    word-wrap: break-word;
    /* 针对 Firefox 的滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

/* 针对 Webkit 浏览器 (Chrome, Safari, Edge) 的滚动条美化 */
.mail-content-view::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.mail-content-view::-webkit-scrollbar-track {
    background: transparent;
}

.mail-content-view::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.mail-content-view::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.mail-content-view img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.mail-content-view a {
    color: var(--brand-primary);
    text-decoration: underline;
}

.mail-content-view blockquote {
    border-left: 4px solid var(--border-light);
    margin: 0;
    padding-left: 16px;
    color: var(--text-sub);
}

.mail-content-view pre {
    background: var(--bg-input);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.mail-content-view pre::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.mail-content-view pre::-webkit-scrollbar-track {
    background: transparent;
}

.mail-content-view pre::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.mail-content-view pre::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* 状态栏美化 */
.status-bar {
    margin-top: 20px;
    /* 改为固定间距，不再强制推到底部 */
    padding: 0;
    display: inline-flex;
    /* 改为 inline-flex 以适应内容宽度 */
    align-self: flex-start;
    /* 左对齐 */
    align-items: center;
    font-size: 13px;
    color: var(--text-sub);
    max-width: 100%;
}

.status-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.status-content i {
    color: var(--brand-primary);
    font-size: 14px;
    margin-top: 4px;
    flex-shrink: 0;
}

.highlight-email {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-main);
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin: 0 4px;
}

.status-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
    padding-bottom: 1px;
    margin-left: 4px;
}

.status-link:hover {
    color: var(--brand-dark);
    border-bottom-style: solid;
    border-bottom-color: var(--brand-dark);
}

@media (max-width: 768px) {
    .status-bar {
        width: 100%;
        /* 手机端占满宽度 */
        display: flex;
        margin-top: 16px;
    }

    /* 修复分栏视图在手机端的高度问题，覆盖后面的桌面端样式 */
    .split-view {
        height: auto;
        flex-direction: column;
    }

    .mail-column {
        min-height: 500px;
        height: auto;
    }

    /* 分页控件适配 */
    .pagination-toolbar {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
        align-items: center;
    }

    .pagination-info {
        text-align: center;
        width: 100%;
        margin-bottom: 0;
    }

    .pagination-controls {
        flex-direction: column;
        width: 100%;
        align-items: center;
        gap: 12px;
    }

    .page-size-selector {
        width: 100%;
        justify-content: center;
        background: var(--bg-input);
        padding: 8px;
        border-radius: var(--radius-sm);
    }

    .page-nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .page-jump-container {
        display: flex;
        align-items: center;
    }

    .btn-page {
        width: 36px;
        /* 稍微加大触摸区域 */
        height: 36px;
    }
}

/* Loading Placeholder */
.loading-placeholder {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}

/* 进度条样式 */
.progress-container {
    margin-top: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    animation: slideDown 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
}

.progress-track {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--brand-gradient);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(45deg,
            rgba(255, 255, 255, 0.15) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(255, 255, 255, 0.15) 75%,
            transparent 75%,
            transparent);
    background-size: 1rem 1rem;
    animation: progress-stripe 1s linear infinite;
}

@keyframes progress-stripe {
    0% {
        background-position: 1rem 0;
    }

    100% {
        background-position: 0 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === 分页增强样式 === */
.page-jump-container {
    display: flex;
    align-items: center;
    margin: 0 8px;
    font-size: 14px;
    color: var(--text-sub);
}

.page-jump-input {
    width: 50px;
    height: 32px;
    padding: 0 5px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    text-align: center;
    margin-right: 5px;
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-input);
    transition: all 0.2s;
}

.page-jump-input:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* 移除数字输入框的箭头 */
.page-jump-input::-webkit-outer-spin-button,
.page-jump-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.page-jump-input {
    -moz-appearance: textfield;
}

.page-separator {
    margin: 0 5px;
    color: var(--text-sub);
}

.page-total-count {
    font-weight: 600;
    color: var(--text-main);
}

/* 调整分页按钮样式以适应更多按钮 */
.page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-page {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-page);
}

/* === 模态框样式 === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
    /* 确保隐藏时不占用空间 */
}

.modal-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-light);
}

.modal-overlay.hidden .modal-container {
    transform: scale(0.95);
}

.modal-header {
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    margin-bottom: 24px;
    color: var(--text-sub);
    font-size: 15px;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* 历史记录下拉菜单 */
.header-right-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-dropdown-trigger {
    position: relative;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--text-muted);
    background: transparent;
}

.history-dropdown-trigger:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--brand-primary);
}

.history-dropdown-trigger i {
    font-size: 14px;
}

.history-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;
    transform-origin: top right;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.history-header {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    background: rgba(248, 250, 252, 0.8);
    border-bottom: 1px solid var(--border-light);
}

.history-list {
    max-height: 250px;
    overflow-y: auto;
}

.history-item {
    padding: 10px 16px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    cursor: default;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--bg-page);
}

.history-main-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow: hidden;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background: rgba(79, 70, 229, 0.04);
}

.export-btn-xs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 4px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid var(--brand-primary);
    color: var(--brand-primary);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.export-btn-xs:hover {
    background: var(--brand-primary);
    color: white;
}

.export-btn-xs i {
    margin-right: 4px;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.history-content {
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.history-empty {
    padding: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* 修正生成结果头部的布局以适应历史按钮 */
.section-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 确保 Label 布局能够撑开 */
.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* === 自定义工具提示 (Tooltip) === */
.tooltip-top,
.tooltip-bottom {
    position: relative;
}

/* 上方提示 */
.tooltip-top::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 11px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 6px;
    visibility: hidden;
}

.tooltip-top::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    visibility: hidden;
}

.tooltip-top:hover::before,
.tooltip-top:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

/* 下方提示 */
.tooltip-bottom::before {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    padding: 2px 6px;
    /* 极小内边距 */
    background: rgba(239, 246, 255, 0.95);
    backdrop-filter: blur(4px);
    color: var(--brand-primary);
    font-size: 10px;
    /* 最小字号 */
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(191, 219, 254, 0.5);
    margin-top: 4px;
    /* 减小间距 */
    visibility: hidden;
}

.tooltip-bottom::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 3px solid transparent;
    /* 缩小箭头 */
    border-bottom-color: rgba(239, 246, 255, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    visibility: hidden;
    margin-top: -1px;
}

.tooltip-bottom:hover::before,
.tooltip-bottom:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

/* === 自定义下拉菜单 (Custom Select) === */
.custom-select-container {
    position: relative;
    min-width: 80px;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    /* 进一步缩小按钮内边距 */
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    font-size: 12px;
    /* 字体缩小到12px */
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.custom-select-trigger:hover {
    border-color: var(--brand-secondary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
    transform: translateY(-0.5px);
}

.custom-select-trigger.active {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.custom-select-trigger i {
    font-size: 10px;
    color: #94a3b8;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.custom-select-container.open .custom-select-trigger i {
    transform: rotate(180deg);
    color: var(--brand-primary);
}

.custom-select-options {
    position: absolute;
    bottom: 100%;
    /* 向上弹出，因为在底部工具栏 */
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
    margin-bottom: 8px;
    padding: 5px;
    min-width: 100%;
    width: max-content;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.3, 0, 0, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-select-container.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.custom-option {
    padding: 4px 10px;
    /* 进一步缩小选项内边距 */
    font-size: 12px;
    /* 字体缩小 */
    color: var(--text-main);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    text-align: center;
    font-weight: 500;
}

.custom-option:hover {
    background: #f1f5f9;
    color: var(--brand-primary);
}

.custom-option.selected {
    background: rgba(79, 70, 229, 0.05);
    color: var(--brand-primary);
    font-weight: 600;
}

/* === 移动端排版优化 (Plan A) === */
.input-label-wrapper {
    margin-bottom: 8px;
    width: 100%;
}

.input-label-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap;
    /* 不允许换行 */
}

.input-label-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    width: auto;
    white-space: nowrap;
    /* 标题不换行 */
    margin-bottom: 0 !important;
    /* 覆盖旧 label 样式 */
}

/* 覆盖旧规则 */
.input-group label {
    display: block !important;
    /* 解除原本的flex */
    margin-bottom: 0 !important;
}

.format-tip {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: normal;
}

/* 移动端特殊微调 */
@media (max-width: 768px) {
    .input-label-top {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        margin-bottom: 2px !important;
    }

    /* 左侧标题 - 允许在小屏幕收缩 */
    .input-label-title {
        font-size: 15px;
        white-space: nowrap !important;
        flex-shrink: 1 !important;
        /* 关键修改：允许收缩 */
        overflow: hidden;
        text-overflow: ellipsis;
        /* 超长省略 */
        margin-bottom: 0 !important;
        margin-right: 8px;
        /* 增加右侧间距，避免紧贴 */
    }

    /* 右侧容器（行数+历史按钮）- 保持原样不收缩 */
    .header-right-tools {
        display: flex !important;
        align-items: center !important;
        margin-left: auto !important;
        /* 仍然靠右，但配合flex-shrink:1的标题，不会溢出 */
        flex-shrink: 0 !important;
        /* 保证右侧工具完整显示 */
        white-space: nowrap !important;
        gap: 8px;
    }

    /* 确保提示语一定换行 */
    .format-tip {
        display: block !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 2px !important;
        font-size: 11px;
    }
}