/* inter-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('/static/fonts/inter-v20-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* inter-500 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('/static/fonts/inter-v20-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* inter-600 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('/static/fonts/inter-v20-latin-600.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* inter-700 - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url('/static/fonts/inter-v20-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}


:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b; /* 用于打包按钮 和 修复按钮 */
    --info-color: #3b82f6; /* 【【新增】】 用于 zip.js 浏览按钮 和 新的下载按钮 */
    --font-family: 'Inter', 'Noto Sans SC', sans-serif;
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --vfs-item-height: 41px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}
body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}
.main-container {
    flex-grow: 1;
    display: flex;
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    overflow: hidden;
    align-items: flex-start;
    transition: justify-content 0.3s ease, opacity 0.2s ease;
    opacity: 0;
}
.main-container.layout-ready {
    opacity: 1;
}
.main-container.is-centered {
    justify-content: center;
    align-items: center;
}
.main-container.is-centered .right-panel {
    display: none;
}
.main-container.is-centered .left-panel {
    flex: 0 1 600px;
    padding-right: 0;
}
.left-panel {
    flex: 1;
    padding-right: 1.5rem;
    min-width: 400px;
    transition: flex 0.3s ease;
}
.right-panel {
    flex: 1;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 400px;
    min-height: 0;
    height: 100%;
    position: relative; /* 为返回顶部按钮定位 */
}
.card {
    background: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}
h1 { font-size: 2.25rem; font-weight: 700; margin: 0 0 0.75rem; letter-spacing: -0.025em; }
p.subtitle { font-size: 1rem; color: var(--text-secondary); margin: 0 0 2rem; line-height: 1.7; }
textarea {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.2s ease-in-out;
}
textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }

.password-field-container { margin-top: 1.5rem; }
.password-field-container label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.password-field-container input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
}
.password-field-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

button#submitBtn {
    background-color: var(--primary-color);
    color: white;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    margin-top: 1.5rem;
    transition: all 0.2s ease-in-out;
}
button#submitBtn:hover:not(:disabled) { background-color: var(--primary-hover); transform: translateY(-2px); }
button#submitBtn:disabled { background: #d1d5db; color: #9ca3af; cursor: not-allowed; transform: none; }

.right-panel::-webkit-scrollbar, .file-list-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.right-panel::-webkit-scrollbar-thumb, .file-list-wrapper::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.right-panel::-webkit-scrollbar-thumb:hover, .file-list-wrapper::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
#tasksContainer .task-panel { margin-bottom: 1.5rem; }
.task-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.task-title { font-size: 1rem; font-weight: 600; margin: 0; word-break: break-all; }
.task-body { padding: 1.5rem; }
.task-message { margin: 0 0 1rem; font-size: 0.95rem; color: var(--text-secondary); min-height: 20px; }
.progress-bar { width: 100%; background-color: var(--border-color); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.6s ease;
}
.task-panel.status-completed .progress-bar-inner { background-color: var(--success-color); }
.task-panel.status-failed .progress-bar-inner { background-color: var(--error-color); }


/* --- 【【【修改：VFS 样式 (zip.js)】】】 --- */
.file-list-wrapper { 
    margin-top: 1rem;
    position: relative;
    overflow-x: auto; 
    overflow-y: auto; 
    max-height: 400px; 
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.file-list-header {
    background-color: #f9fafb; 
    color: var(--text-secondary); 
    font-weight: 500; 
    border-bottom: 1px solid var(--border-color);
    height: var(--vfs-item-height);
    position: sticky; 
    top: 0;
    min-width: 550px; 
    z-index: 10;
}

.file-list {
    min-width: 550px; 
    z-index: 5;
}

/* --- 【【【修改：这是 3 列布局 (无复选框) 的默认设置】】】 --- */
.file-list-header, .file-list-item { 
    display: grid; 
    /* 默认 3 列 */
    grid-template-columns: 1fr 100px 150px; 
    gap: 1rem; 
    padding: 0.75rem 1rem; 
    font-size: 0.875rem; 
    align-items: center; 
}

/*
 * 默认 3 列布局的列分配
 */
.file-list-header span:nth-child(1) { 
    grid-column: 1; 
    text-align: left; /* <-- 【【【最终修复：显式左对齐】】】 */
}
.file-list-header span:nth-child(2) { 
    grid-column: 2; 
    text-align: right; 
}
.file-list-header span:nth-child(3) { 
    grid-column: 3; 
    text-align: right; 
}


.file-list-item .filename { grid-column: 1; }
.file-list-item .filesize { grid-column: 2; }
.file-list-item .filedate { grid-column: 3; }
/* --- 【【【默认 3 列布局结束】】】 --- */


.file-list-item { 
    border-top: 1px solid var(--border-color); 
    height: var(--vfs-item-height); 
    overflow: hidden;
    min-width: 550px; 
    background-color: var(--card-bg);
}

/* --- 【【【新增：VFS 浏览器增强 (复选框/按钮)】】】 --- */
.vfs-button-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0 0.5rem; /* 配合面包屑对齐 */
}

.vfs-download-selected-btn {
    background-color: var(--info-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.vfs-download-selected-btn:hover:not(:disabled) {
    background-color: #2563eb;
}
.vfs-download-selected-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
}

/* 【【【新增：4 列布局 (带复选框) 的 VFS 浏览器样式】】】 */
/* 当列表具有 .vfs-browser-list 类时，应用 4 列布局 */
.vfs-browser-list .file-list-header,
.vfs-browser-list .file-list-item { 
    grid-template-columns: 30px 1fr 100px 150px; 
}

/*
 * 4 列布局的列分配
 */
.vfs-browser-list .file-list-header input[type="checkbox"] { grid-column: 1; }
.vfs-browser-list .file-list-header span:nth-child(2) { 
    grid-column: 2; 
    text-align: left; /* <-- 【【【最终修复：显式左对齐】】】 */
} /* 名称 */
.vfs-browser-list .file-list-header span:nth-child(3) { 
    grid-column: 3; 
    text-align: right; 
} /* 大小 */
.vfs-browser-list .file-list-header span:nth-child(4) { 
    grid-column: 4; 
    text-align: right; 
} /* 日期 */


.vfs-browser-list .file-list-item input[type="checkbox"] {
    grid-column: 1;
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.vfs-browser-list .file-list-item .filename { grid-column: 2; }
.vfs-browser-list .file-list-item .filesize { grid-column: 3; }
.vfs-browser-list .file-list-item .filedate { grid-column: 4; }


/* ".." 返回上一级 样式 */
.vfs-browser-list .file-list-item.parent-dir {
    font-weight: 600;
    cursor: pointer;
    border-top: none; 
}
.vfs-browser-list .file-list-item.parent-dir .filename {
    grid-column: 1 / span 4; /* 跨越所有列 */
    color: var(--primary-color);
}
.vfs-browser-list .file-list-item.parent-dir:hover {
    background-color: #f9fafb;
}
.vfs-browser-list .file-list-item.parent-dir .filesize,
.vfs-browser-list .file-list-item.parent-dir .filedate,
.vfs-browser-list .file-list-item.parent-dir input[type="checkbox"] {
    display: none; /* 隐藏 ".." 目录的大小/日期/复选框 */
}
/* --- VFS 增强样式结束 --- */


.file-list-item .filename { 
    /* (grid-column 已在上面设置) */
    word-break: break-all; 
    font-weight: 500; 
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.file-list-item .filesize, .file-list-item .filedate { color: var(--text-secondary); text-align: right; }

.file-list-item.is-loading {
    color: var(--text-secondary);
    font-style: italic;
}

.action-area { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
a.action-button, button.action-button {
    display: block; text-decoration: none; text-align: center;
    width: 100%; padding: 0.75rem; font-size: 0.95rem; font-weight: 600;
    border-radius: 0.5rem; cursor: pointer; transition: all 0.2s ease;
    font-family: inherit;
    border: none;
}

/* --- 【【【新增：固定清除按钮的容器】】】 --- */
.sticky-button-wrapper {
    position: -webkit-sticky; /* 兼容 Safari */
    position: sticky;
    top: 0; /* 固定在滚动容器的顶部 */
    z-index: 20; /* 确保在任务卡片之上 */
    padding-top: 1rem; /* 在按钮上方留出空间 */
    background-color: var(--bg-color); /* 页面背景色，遮挡下方滚动内容 */
}

/* --- 【【【新增：清除按钮的特定样式】】】 --- */
#clearFinishedBtn {
    /* 从内联样式移动过来 */
    background-color: var(--text-secondary); 
    color: white; 
    margin-bottom: 1rem; /* 保持与下方任务列表的间距 */
    display: none; /* 默认隐藏，由JS控制 */
}
#clearFinishedBtn:hover:not(:disabled) {
    background-color: #4b5563; /* 深一点的灰色 */
}
/* --- 【【【新增结束】】】 --- */

/* === 样式修改：按钮统一为绿色 === */
.download-btn { background-color: var(--success-color); color: white; }
.download-btn:hover:not(:disabled) { background-color: #059669; }
.download-btn:disabled { 
     background: #d1d5db; color: #9ca3af; cursor: not-allowed; transform: none;
}

/* === 【【【移除：.browse-zip-btn 样式】】】 === */
/* (样式块已删除) */

/* === 样式修改：按钮统一为绿色 === */
.download-folder-zip-btn {
    background-color: var(--success-color);
    color: white;
}
.download-folder-zip-btn:hover:not(:disabled) {
    background-color: #059669;
}
.download-folder-zip-btn:disabled {
     background: #d1d5db; color: #9ca3af; cursor: not-allowed; transform: none;
}
/* === 样式修改结束 === */

.error-message { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 0.75rem; border-radius: 0.5rem; text-align: center; }

.retry-btn {
    background-color: var(--warning-color);
    color: white;
}
.retry-btn:hover:not(:disabled) {
    background-color: #d97706;
}
.retry-btn:disabled {
     background: #d1d5db; color: #9ca3af; cursor: not-allowed; transform: none;
}
.retry-btn:disabled[data-status="repairing"] {
     background-color: var(--warning-color); 
     color: white; 
     opacity: 0.7;
     cursor: not-allowed;
}


.footer {
    width: 100%;
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.footer a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s ease; }
.footer a:hover { color: var(--text-primary); text-decoration: underline; }

/* 【【修改】】 VFS 面包屑 */
.vfs-breadcrumb { margin-bottom: 1rem; font-size: 0.9rem; color: var(--text-secondary); word-break: break-all; }
.vfs-breadcrumb a { color: var(--primary-color); text-decoration: none; cursor: pointer; }
.vfs-breadcrumb a:hover { text-decoration: underline; }
.vfs-breadcrumb span { font-weight: 600; color: var(--text-primary); }

.file-list-item a.filename { color: var(--text-primary); text-decoration: none; font-weight: 500; cursor: pointer;}
.file-list-item a.filename:hover { color: var(--primary-color); text-decoration: underline; }

#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 40px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 12px 15px;
    border-radius: 50%;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
#backToTopBtn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 【【修改】】 VFS 加载指示器 (重命名) */
.vfs-loading-indicator {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}
 .vfs-loading-indicator progress {
    width: 100%;
    margin-top: 0.5rem;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    /* --- 进度条外观 --- */
    -webkit-appearance: none;
    appearance: none;
}
.vfs-loading-indicator progress::-webkit-progress-bar { 
    background-color: #e0e7ff; 
    border-radius: 4px;
}
.vfs-loading-indicator progress::-webkit-progress-value { 
    background-color: var(--primary-color); 
    border-radius: 4px;
    transition: width 0.3s ease;
}
.vfs-loading-indicator progress::-moz-progress-bar { 
    background-color: var(--primary-color); 
    border-radius: 4px;
    transition: width 0.3s ease;
}
/* --- 进度条外观结束 --- */

/* --- 服务声明样式 (已修复对齐) --- */
.agreement-container {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;  /* <-- 修复点 3：从 center 改为 flex-start */
    justify-content: center;
}
.agreement-container input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 0.15em; /* <-- 修复点 3：微调复选框，使其与第一行文字对齐 */
}
.agreement-container label {
    margin: 0;
    line-height: 1.5; /* 稍微增加行高，确保换行时也清晰 */
    text-align: left; /* 确保换行后文字是左对齐的 */
}
.agreement-container a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}
.agreement-container a:hover {
    text-decoration: underline;
}
/* --- 样式结束 --- */


/* --- Modal 弹窗样式 (通用) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* JS控制显示 */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
/* JS控制显示/隐藏 */
.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--card-bg);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}
.modal-overlay.is-visible .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
}
.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex-grow: 1;
}
.modal-body pre {
    white-space: pre-wrap; /* 自动换行 */
    word-wrap: break-word;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
    color: var(--text-primary);
}
/* --- 样式结束 --- */


/* --- 【【【新增：QQ群链接样式】】】 --- */
p.subtitle a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
p.subtitle a:hover {
    text-decoration: underline;
}
/* --- 【【【新增结束】】】 --- */

/* --- 【【【安全修复：为 showCustomAlert 添加的样式】】】 --- */
#customAlertBody {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 1.5rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap; /* 关键：允许换行符正常显示 */
    word-wrap: break-word; /* 确保长单词换行 */
}
/* --- 【【【修复结束】】】 --- */


@media (max-width: 1024px) {
    html, body { height: auto; overflow: visible; }
    .main-container, .main-container.is-centered {
        flex-direction: column; overflow: visible; padding: 1rem; align-items: stretch; flex-grow: 0;
    }
    .left-panel, .right-panel, .main-container.is-centered .left-panel {
        flex: 1; width: 100%; padding: 0; min-width: unset; max-width: unset;
    }
    .right-panel {
        display: flex !important; overflow-y: visible; margin-top: 2rem; height: auto; min-height: auto;
    }
    #backToTopBtn {
        bottom: 20px;
        right: 20px;
    }
    
    @media (max-width: 768px) {
        .modal-card {
            max-height: 90vh;
        }
        .modal-header, .modal-body {
            padding: 1.5rem;
        }
    }
}