/* =============================================
   我要转 - 公共样式 (common.css)
   ============================================= */

/* --- Reset & Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif; background: #f8fafc; color: #333; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }

/* --- Theme Variable (each page overrides --theme) --- */
:root { --theme: #4f7cff; }

/* --- Header --- */
.header { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 24px; font-weight: 700; color: var(--theme); text-decoration: none; }
.header-right { display: flex; align-items: center; gap: 20px; }

/* --- Navigation --- */
.nav { display: flex; gap: 16px; align-items: center; }
.nav > a, .nav-dropdown > span { color: #666; text-decoration: none; font-size: 14px; transition: color 0.2s; cursor: pointer; }
.nav > a:hover, .nav > a.active, .nav-dropdown:hover > span { color: var(--theme); }
.nav-dropdown { position: relative; }
.nav-dropdown > span::after { content: ' ▾'; font-size: 10px; }

/* Dropdown menu — 修复: 用 padding-top 替代 margin-top 消除 hover 断裂间隙 */
.dropdown-menu {
    display: none; position: absolute; top: 100%; left: -12px;
    background: #fff; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 8px 0; min-width: 160px; z-index: 200;
    padding-top: 16px; margin-top: -8px;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 8px 16px; color: #333; text-decoration: none; font-size: 14px; white-space: nowrap; transition: background 0.15s; }
.dropdown-menu a:hover { background: #f0f4ff; color: var(--theme); }
.dropdown-menu a.active { color: var(--theme); font-weight: 500; background: #f0f4ff; }
.dropdown-menu a.nav-disabled { color: #bbb; cursor: default; }
.dropdown-menu a.nav-disabled:hover { background: transparent; color: #bbb; }
.dropdown-menu a.nav-disabled em { font-style: normal; font-size: 11px; color: #ccc; margin-left: 4px; }

/* --- Nav Actions (Login / Register) --- */
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-actions .btn-login { color: var(--theme); text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 16px; transition: all 0.2s; background: transparent; border: 1px solid rgba(79, 124, 255, 0.2); }
.nav-actions .btn-login:hover { background: rgba(79, 124, 255, 0.08); border-color: rgba(79, 124, 255, 0.4); }
.nav-actions .btn-register { color: var(--theme); text-decoration: none; font-size: 13px; font-weight: 500; padding: 6px 12px; background: transparent; border-radius: 16px; transition: all 0.2s; border: 1px solid rgba(79, 124, 255, 0.2); }
.nav-actions .btn-register:hover { background: rgba(79, 124, 255, 0.08); border-color: rgba(79, 124, 255, 0.4); }

/* --- Language Selector --- */
.lang-selector { position: relative; }
.lang-current { color: #666; font-size: 13px; cursor: pointer; padding: 6px 12px; border-radius: 16px; transition: all 0.2s; user-select: none; border: 1px solid #e8e8e8; }
.lang-current:hover { background: #f0f4ff; color: var(--theme); border-color: rgba(79,124,255,0.3); }
.lang-dropdown { display: none; position: absolute; top: 100%; right: 0; margin-top: 8px; background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); padding: 4px 0; min-width: 100px; z-index: 200; }
.lang-selector.show .lang-dropdown { display: block; }
.lang-option { display: block; padding: 8px 16px; color: #333; text-decoration: none; font-size: 13px; transition: background 0.15s; }
.lang-option:hover { background: #f0f4ff; color: var(--theme); }
.lang-option.active { color: var(--theme); font-weight: 500; background: #f0f4ff; }
.nav-user { display: none; align-items: center; gap: 10px; padding-left: 20px; border-left: 1px solid #eee; }
.nav-user .user-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #4f7cff, #764ba2); color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-user .user-center-link { color: #4f7cff; text-decoration: none; font-size: 13px; font-weight: 500; transition: color 0.2s; white-space: nowrap; }
.nav-user .user-center-link:hover { color: #3a5fd9; }
.nav-user .user-divider { width: 1px; height: 14px; background: #e0e0e0; }
.nav-user .btn-logout { color: #999; text-decoration: none; font-size: 13px; cursor: pointer; transition: color 0.2s; white-space: nowrap; }
.nav-user .btn-logout:hover { color: #ff4d4f; }

/* --- Modal --- */
.modal-mask { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 999; align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal-box { background: #fff; border-radius: 12px; padding: 32px; width: 360px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.15); animation: modalIn 0.2s ease; }
@keyframes modalIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; color: #333; }
.modal-box p { font-size: 14px; color: #888; margin-bottom: 28px; }
.modal-btns { display: flex; gap: 12px; justify-content: center; }
.modal-btns button { padding: 10px 28px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; }
.modal-btns .btn-cancel { background: #f5f5f5; color: #666; }
.modal-btns .btn-cancel:hover { background: #e8e8e8; }
.modal-btns .btn-confirm { background: #ff4d4f; color: #fff; }
.modal-btns .btn-confirm:hover { background: #e04042; }

/* --- Today Stats Watermark (inside upload-area) --- */
.today-stats { position: absolute; top: 10px; right: 12px; text-align: right; font-size: 13px; color: #ccc; pointer-events: none; z-index: 1; line-height: 1; }
.today-stats .n { color: var(--theme); font-weight: 600; font-size: 14px; }

/* --- Main Content --- */
.main { flex: 1; max-width: 720px; margin: 0 auto; padding: 40px 24px; width: 100%; }
.page-title { text-align: center; margin-bottom: 32px; }
.page-title h1 { font-size: 28px; font-weight: 600; color: #1a1a1a; margin-bottom: 8px; }
.page-title p { color: #888; font-size: 15px; }

/* --- Card --- */
.card { background: #fff; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); padding: 40px; }

/* --- Upload Area --- */
.upload-area { border: 2px dashed #d0d5dd; border-radius: 12px; padding: 48px 24px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; display: flex; flex-direction: column; align-items: center; }
.upload-area:hover, .upload-area.dragover { border-color: var(--theme); background: color-mix(in srgb, var(--theme) 5%, white); }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon { width: 56px; height: 56px; background: linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--theme) 80%, black)); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.upload-icon svg { width: 28px; height: 28px; fill: #fff; }
.upload-text { color: #666; font-size: 15px; }
.upload-text em { color: var(--theme); font-style: normal; font-weight: 500; }
.upload-hint { color: #aaa; font-size: 13px; margin-top: 8px; }

/* --- Summary Bar --- */
.summary { margin-top: 20px; padding: 12px 18px; background: color-mix(in srgb, var(--theme) 8%, white); border-radius: 10px; display: none; align-items: center; justify-content: space-between; font-size: 14px; color: var(--theme); font-weight: 500; }
.summary .clear-btn { color: #ff4d4f; cursor: pointer; font-size: 13px; font-weight: 400; }
.summary .clear-btn:hover { text-decoration: underline; }

/* --- File List --- */
.file-list { margin-top: 16px; max-height: 420px; overflow-y: auto; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid #eef2f7; border-radius: 10px; margin-bottom: 8px; transition: all 0.2s; }
.file-item.converting { border-color: var(--theme); background: color-mix(in srgb, var(--theme) 4%, white); }
.file-item.done { border-color: #b7eb8f; background: #f6ffed; }
.file-item.error { border-color: #ffa39e; background: #fff2f0; }
.file-item .f-icon { width: 32px; height: 32px; background: var(--theme); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-item.done .f-icon { background: #52c41a; }
.file-item.error .f-icon { background: #ff4d4f; }
.file-item .f-icon svg { width: 16px; height: 16px; fill: #fff; }
.file-item .f-info { flex: 1; overflow: hidden; }
.file-item .f-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .f-size { font-size: 12px; color: #999; }
.file-item .f-status { flex-shrink: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; min-width: 80px; justify-content: flex-end; }
.f-status .waiting { color: #999; }
.f-status .converting-text { color: var(--theme); }
.f-status .done-text { color: #52c41a; font-weight: 500; }
.f-status .error-text { color: #ff4d4f; }
.f-status .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--theme); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Progress Bar --- */
.progress-bar { width: 100%; height: 4px; background: #eef2f7; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--theme); border-radius: 2px; transition: width 0.3s; width: 0; }
.file-item.done .progress-bar .fill { background: #52c41a; width: 100%; }

/* --- Buttons --- */
.btn { display: block; width: 100%; margin-top: 20px; padding: 14px; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--theme) 80%, black)); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px color-mix(in srgb, var(--theme) 40%, transparent); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; gap: 12px; margin-top: 20px; align-items: center; }
.btn-row .btn { margin-top: 0; flex: 1; }
.add-more { display: none; text-align: center; margin-top: 16px; }
.add-more a { color: var(--theme); font-size: 14px; cursor: pointer; text-decoration: none; }
.add-more a:hover { text-decoration: underline; }

/* --- Result Summary --- */
.result-summary { margin-top: 20px; padding: 14px 18px; border-radius: 10px; font-size: 14px; display: none; }
.result-summary.success { display: block; background: #f6ffed; color: #389e0d; }
.result-summary.partial { display: block; background: #fff7e6; color: #d48806; }

/* --- Footer --- */
.footer { background: #1a1a2e; color: #aaa; padding: 24px; text-align: center; font-size: 13px; line-height: 1.8; }
.footer a { color: #4f7cff; text-decoration: none; }
