/* ═══════════════════════════════════════════════════════════════
   style.css — 文件加解密 Web 版
   ═══════════════════════════════════════════════════════════════ */

:root {
    --primary:    #2563eb;
    --primary-h:  #1d4ed8;
    --success:    #059669;
    --success-h:  #047857;
    --danger:     #dc2626;
    --warning:    #d97706;
    --bg:         #f8fafc;
    --card:       #ffffff;
    --border:     #e2e8f0;
    --text:       #1e293b;
    --text-2:     #64748b;
    --text-3:     #94a3b8;
    --radius:     12px;
    --shadow:     0 1px 3px rgba(0,0,0,0.08);
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container { width: 100%; max-width: 560px; }

/* ── 头部 ──────────────────────────────────────────────────── */
.header { text-align: center; margin-bottom: 24px; }
.header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 4px; }
.subtitle { font-size: 0.875rem; color: var(--text-2); }

/* ── 模式切换 ──────────────────────────────────────────────── */
.mode-tabs {
    display: flex; background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border); border-bottom: none; overflow: hidden;
}
.mode-tab {
    flex: 1; padding: 14px 20px; border: none;
    background: #f1f5f9; font-size: 0.95rem; font-weight: 500;
    color: var(--text-2); cursor: pointer; transition: all var(--transition);
    position: relative;
}
.mode-tab:first-child { border-right: 1px solid var(--border); }
.mode-tab.active { background: var(--card); color: var(--primary); font-weight: 600; }
.mode-tab.active::after {
    content: ''; position: absolute; bottom: 0; left: 20%; right: 20%;
    height: 3px; background: var(--primary); border-radius: 3px 3px 0 0;
}
.mode-tab:hover:not(.active) { background: #e8ecf1; color: var(--text); }

/* ── 主卡片 ────────────────────────────────────────────────── */
.main-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow); padding: 32px; min-height: 420px;
}

/* ── 上传区 ────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer;
    transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: #eff6ff; }
.upload-zone.has-file { border-style: solid; border-color: var(--success); background: #f0fdf4; }
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-text { font-size: 0.95rem; color: var(--text-2); line-height: 1.7; }
.upload-hint { font-size: 0.8rem; color: var(--text-3); }

/* ── 文件信息 ──────────────────────────────────────────────── */
.file-info {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: #f0fdf4;
    border: 1px solid #bbf7d0; border-radius: var(--radius);
}
.file-info.hidden { display: none; }
.file-icon { font-size: 1.5rem; flex-shrink: 0; }
.file-details { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 0.8rem; color: var(--text-2); }
.file-remove {
    width: 28px; height: 28px; border: none; background: #fecaca;
    color: var(--danger); border-radius: 50%; cursor: pointer;
    font-weight: 600; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); flex-shrink: 0;
}
.file-remove:hover { background: #fca5a5; }

/* ── 密码区 ────────────────────────────────────────────────── */
.password-section { margin-top: 20px; }
.password-label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.password-input-wrap { position: relative; }

#password {
    width: 100%; padding: 12px 44px 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.95rem; outline: none; transition: border-color var(--transition);
}
#password:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
#password.valid { border-color: var(--success); }

.toggle-password {
    position: absolute; right: 6px; top: 50%;
    transform: translateY(-50%); border: none; background: none;
    font-size: 1.1rem; cursor: pointer; padding: 6px 8px;
    border-radius: 6px; transition: background var(--transition);
}
.toggle-password:hover { background: #f1f5f9; }

/* ── 密码强度条 ────────────────────────────────────────────── */
.strength-bar {
    height: 4px; background: #e2e8f0; border-radius: 2px;
    margin-top: 8px; overflow: hidden;
}
.strength-fill {
    height: 100%; width: 0%; border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}
.strength-fill.weak   { background: #ef4444; }
.strength-fill.medium { background: #f59e0b; }
.strength-fill.strong { background: #10b981; }

.strength-text { font-size: 0.75rem; margin-top: 4px; color: var(--text-2); min-height: 18px; }

.strength-rules {
    display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px;
}
.rule {
    font-size: 0.75rem; color: var(--text-3);
    transition: color var(--transition);
}
.rule.passed { color: var(--success); font-weight: 500; }

.password-hint { margin-top: 6px; font-size: 0.8rem; color: var(--text-3); }

/* ── 按钮 ──────────────────────────────────────────────────── */
.action-section { display: flex; gap: 10px; margin-top: 24px; }
.btn {
    padding: 12px 24px; border: none; border-radius: var(--radius);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all var(--transition);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { flex: 1; background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-secondary { background: #f1f5f9; color: var(--text-2); }
.btn-secondary:hover { background: #e2e8f0; color: var(--text); }
.btn-success { width: 100%; background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--success-h); }

/* ── 进度条 ────────────────────────────────────────────────── */
.progress-section { margin-top: 24px; text-align: center; }
.progress-bar { width: 100%; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-fill {
    height: 100%; width: 0%; background: var(--primary);
    border-radius: 3px; transition: width 0.4s ease;
}
.progress-text { margin-top: 10px; font-size: 0.85rem; color: var(--text-2); }

/* ── 结果 ──────────────────────────────────────────────────── */
.result-section {
    margin-top: 24px; text-align: center; padding: 20px;
    background: #f0fdf4; border: 1px solid #bbf7d0;
    border-radius: var(--radius);
}
.result-icon { font-size: 2.5rem; margin-bottom: 8px; }
.result-text { font-size: 0.9rem; color: var(--success); margin-bottom: 16px; line-height: 1.6; }

/* ── 错误 ──────────────────────────────────────────────────── */
.error-section {
    margin-top: 24px; text-align: center; padding: 20px;
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: var(--radius);
}
.error-icon { font-size: 2.5rem; margin-bottom: 8px; }
.error-text { font-size: 0.9rem; color: var(--danger); margin-bottom: 16px; line-height: 1.6; }

.hidden { display: none !important; }

/* ── 底部 ──────────────────────────────────────────────────── */
.footer { margin-top: 20px; text-align: center; }
.footer p { font-size: 0.75rem; color: var(--text-3); }

/* ── 响应式 ────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .main-card { padding: 20px; }
    .upload-zone { padding: 30px 16px; }
    .action-section { flex-direction: column; }
    .strength-rules { flex-direction: column; gap: 3px; }
    .header h1 { font-size: 1.4rem; }
}
