:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --danger: #ef4444;
    --success: #22c55e;
}

/* 深色模式适配修复 */
[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --bg-color: #111827;
    --card-bg: #1f2937;
    --text-color: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: #374151;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* 头部与导航 */
.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.header-tools {
    position: absolute;
    right: 0;
    top: 0;
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* 基础组件 */
.upload-area,
.paste-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-color);
    margin-bottom: 20px;
}

.upload-area:hover,
.paste-area:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.btn-mini,
.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 13px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.btn-mini:hover,
.copy-btn:hover {
    background-color: var(--bg-color);
    border-color: var(--text-secondary);
}

.btn-mini:active {
    transform: translateY(1px);
}

/* 历史列表的多选样式 */
.history-card {
    position: relative;
    /* 为了定位勾选框 */
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
}

/* 选中状态的高亮 */
.history-card.selected {
    border: 1px solid var(--primary-color);
    background-color: rgba(59, 130, 246, 0.03);
}

[data-theme="dark"] .history-card.selected {
    background-color: rgba(59, 130, 246, 0.1);
}

/* 覆盖在左上角的复选框区域 */
.checkbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 100%;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15px;
    cursor: pointer;
}

.history-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* 给主内容留出勾选框的位置 */
.history-main-row {
    display: flex;
    align-items: center;
    padding: 12px 12px 12px 45px;
    /* 左边距增加，给 checkbox 让位 */
    gap: 15px;
}

/* 其他历史记录样式 */
.history-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f3f4f6;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.history-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-badge {
    background-color: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.history-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 多选工具栏 */
.multi-select-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.multi-actions {
    display: flex;
    gap: 10px;
}

/* 模态框 (用于显示说明文件结果) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.modal-title {
    font-weight: bold;
    font-size: 16px;
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body textarea {
    width: 100%;
    height: 200px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px;
    font-family: monospace;
    border-radius: 4px;
    resize: vertical;
}

.modal-footer {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    margin-top: 10px;
    font-size: 14px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

/* 通用辅助 */
.url-box {
    background: var(--card-bg);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin: 15px 0;
    word-break: break-all;
    transition: all 0.2s;
}

.url-box:hover {
    border-color: var(--primary-color);
}

.url-box a {
    color: var(--primary-color);
    text-decoration: none;
}

.input-text {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.input-text:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}