/* ============================================
   工具页组件样式 — 所有工具详情页加载
   ============================================ */

/* ── 文本域 ── */
.tool-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: white;
    resize: vertical;
    transition: var(--transition-fast);
}

.tool-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.tool-output {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 60px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.tool-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--gray-800);
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tool-input:focus {
    border-color: var(--border-focus);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.input-hint {
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 4px;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.input-row:last-child {
    margin-bottom: 0;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.tool-statbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 0 4px;
}

.tool-error-msg {
    color: #ef4444;
    font-size: 13px;
}

/* ── 按钮 ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-500), #059669);
    color: white;
    margin-top: 16px;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-sm:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger-500);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ── 上传区域 ── */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    background: white;
}

.upload-zone:hover {
    border-color: var(--primary-400);
    background: var(--bg-card-hover);
    transform: scale(1.01);
}

.upload-zone.drag-over {
    border-color: var(--success-500);
    background: #f0fdf4;
    border-style: solid;
}

.upload-zone.has-file {
    border-color: var(--primary-500);
    background: #f0f9ff;
    border-style: solid;
}

.upload-icon {
    font-size: 52px;
    margin-bottom: 16px;
    display: block;
}

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 14px;
    color: var(--gray-400);
}

/* ── 文件信息 ── */
.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #bae6fd;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 16px;
}

.file-info #fileName,
.file-info .file-name {
    flex: 1;
    font-weight: 600;
    color: var(--gray-800);
    word-break: break-all;
}

.file-info #fileSize,
.file-info .file-size {
    color: var(--gray-500);
    font-size: 13px;
    white-space: nowrap;
}

/* ── 文件列表 ── */
.file-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.file-list-index {
    width: 24px;
    height: 24px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    flex-shrink: 0;
}

.file-list-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    word-break: break-all;
}

.file-list-size {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

.file-list-remove {
    background: none;
    border: none;
    color: var(--danger-500);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.file-list-remove:hover {
    background: #fee2e2;
}

/* ── 进度条 ── */
.progress {
    margin-top: 20px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.progress-bar {
    height: 8px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
    border-radius: 4px;
    width: 0%;
    margin-bottom: 12px;
    transition: width 0.4s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

#statusText {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

/* ─�� 错误提示 ── */
.error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-top: 16px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
}

/* ── 结果显示 ── */
.result {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 16px;
    text-align: center;
}

.result p {
    font-size: 18px;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 16px;
}

.result-box {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.result-row:last-child { border-bottom: none; }

.result-label {
    flex: 0 0 80px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
}

.result-value {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    color: var(--gray-800);
    word-break: break-all;
}

/* ── 说明区域 ── */
.note {
    margin-top: 40px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.note h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note ul {
    padding-left: 20px;
    color: var(--gray-600);
    font-size: 14px;
}

.note li { margin-bottom: 8px; }

/* ── 算法选择器 ── */
.algo-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.algo-option {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.2s ease;
}

.algo-option:hover {
    border-color: var(--primary-400);
    background: var(--bg-card-hover);
}

.algo-option:has(input:checked) {
    border-color: var(--primary-500);
    background: #eff6ff;
    color: var(--primary-700);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.algo-option input[type="radio"] { display: none; }

/* ── 哈希结果 ── */
.hash-result-box {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}

.hash-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.hash-label {
    flex-shrink: 0;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
    color: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.hash-value {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    color: var(--gray-800);
    word-break: break-all;
    line-height: 1.6;
    background: var(--gray-50);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

/* ── 哈希比对 ── */
.compare-result {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
}

.compare-result.match {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.compare-result.mismatch {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    color: #dc2626;
}

/* ── 压缩级别选择器 ── */
.level-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.level-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.level-option:hover {
    border-color: var(--primary-400);
    background: var(--bg-card-hover);
}

.level-option.selected,
.level-option:has(input:checked) {
    border-color: var(--primary-500);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.level-option input[type="radio"] { display: none; }

.level-info { flex: 1; }

.level-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.level-desc {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.5;
}

.level-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--success-500), #059669);
    color: white;
    border-radius: var(--radius-sm);
    vertical-align: middle;
    margin-left: 6px;
}

/* ── 密码组 ── */
.password-group { margin-bottom: 16px; }

.password-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.password-group input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--gray-800);
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.password-group input[type="password"]:focus {
    border-color: var(--border-focus);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.password-hint {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 6px;
}

/* ── 参数组 ── */
.param-group { margin-top: 16px; }

.param-row { margin-bottom: 16px; }
.param-row:last-child { margin-bottom: 0; }

.param-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.param-value {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.param-hint {
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* ── 滑块组 ── */
.slider-group { margin-bottom: 16px; }

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.slider-value { color: var(--primary-600); font-weight: 700; }

.slider-group input[type="range"] {
    width: 100%;
    accent-color: var(--primary-500);
}

/* ── OCR 切换 ── */
.ocr-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ocr-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-500);
    cursor: pointer;
}

.ocr-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.ocr-hint {
    font-size: 13px;
    color: var(--gray-400);
    margin-left: 28px;
    margin-bottom: 12px;
}

.ocr-option {
    margin-left: 28px;
    margin-bottom: 12px;
}

/* ── 示例 ── */
.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.example-chip {
    padding: 6px 14px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-chip:hover {
    background: var(--primary-500);
    color: white;
    border-color: var(--primary-500);
}

.sample-btn {
    padding: 6px 14px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.sample-btn:hover {
    background: var(--primary-500);
    color: white;
    border-color: var(--primary-500);
}

/* ── 提示区块 ── */
.tip {
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: #92400e;
    margin-bottom: 16px;
}

/* ════════════════════════════════════════
   夜间模式
   ════════════════════════════════════════ */

[data-theme="dark"] .upload-zone {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .upload-zone:hover {
    background: var(--bg-card-hover);
}

[data-theme="dark"] .upload-text { color: var(--text-primary); }

[data-theme="dark"] .upload-hint,
[data-theme="dark"] .input-hint { color: var(--text-muted); }

[data-theme="dark"] .input-label { color: var(--text-secondary); }

[data-theme="dark"] .tool-input,
[data-theme="dark"] .tool-textarea,
[data-theme="dark"] .tool-output,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .tool-input:focus,
[data-theme="dark"] .tool-textarea:focus {
    border-color: var(--border-focus);
    background: var(--bg-card);
}

[data-theme="dark"] .btn-sm {
    background: #333;
    color: #e5e5e5;
}

[data-theme="dark"] .btn-sm:hover { background: #444; }

[data-theme="dark"] .note {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .note h3,
[data-theme="dark"] .note li { color: var(--text-secondary); }

[data-theme="dark"] .file-info {
    background: linear-gradient(135deg, #1e3a5f, #172554);
    border-color: #3b82f6;
}

[data-theme="dark"] .progress { background: #2a2a2a; }

[data-theme="dark"] .result {
    background: linear-gradient(135deg, #064e3b, #065f46);
    border-color: #10b981;
}

[data-theme="dark"] .error {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    border-color: #ef4444;
}

[data-theme="dark"] .password-group input[type="password"] {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .password-group input[type="password"]:focus {
    border-color: var(--border-focus);
    background: var(--bg-card);
}

[data-theme="dark"] .password-group label { color: var(--text-secondary); }

[data-theme="dark"] .param-label { color: var(--text-secondary); }

[data-theme="dark"] .file-list li {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .file-list-index {
    background: var(--bg-input);
    color: var(--text-secondary);
}

[data-theme="dark"] .file-list-name { color: var(--text-primary); }
[data-theme="dark"] .file-list-size { color: var(--text-muted); }

[data-theme="dark"] .file-list-remove:hover {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .algo-option {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .algo-option:hover { background: var(--bg-card-hover); }

[data-theme="dark"] .algo-option:has(input:checked) {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--border-focus);
    color: var(--primary-500);
}

[data-theme="dark"] .hash-result-box {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .hash-value {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .level-option {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .level-option:hover { background: var(--bg-card-hover); }

[data-theme="dark"] .level-option.selected,
[data-theme="dark"] .level-option:has(input:checked) {
    border-color: var(--border-focus);
}

[data-theme="dark"] .level-title { color: var(--text-primary); }
[data-theme="dark"] .level-desc { color: var(--text-secondary); }

[data-theme="dark"] .result-box {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .result-value { color: var(--text-primary); }
[data-theme="dark"] .result-row { border-bottom-color: var(--border-color); }
[data-theme="dark"] .result-label { color: var(--text-muted); }

[data-theme="dark"] .example-chip {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .example-chip:hover {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}

[data-theme="dark"] .sample-btn {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .sample-btn:hover {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}

[data-theme="dark"] .tip {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

[data-theme="dark"] .ocr-label { color: var(--text-secondary); }

[data-theme="dark"] .slider-label { color: var(--text-secondary); }
[data-theme="dark"] .slider-value { color: var(--primary-500); }
