/* 全局重置 + 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}
html, body {
    height: 100%;
    overflow-x: hidden;
    background: var(--light-bg);
    transition: background 0.3s ease !important;
    min-height: 100vh;
}
body {
    color: var(--light-text);
    scrollbar-width: none;
    -ms-overflow-style: none;
}
body.dark-mode {:
    background: var(--dark-bg) !important;
}
body::-webkit-scrollbar {
    display: none;
}
/* 主题色定义 */
:root {
    /* 亮色模式 */
    --light-bg: #f5f7fa;
    --light-card-bg: #fff;
    --light-text: #333;
    --light-subtext: #666;
    --light-border: #eee;
    --light-hover: #f5f5f5;
    --light-checked: #e6f7ff;
    /* 按钮基础色（返回+下载未激活） */
    --btn-default-bg: #f5f7fa;
    --btn-default-text: #666;
    --btn-default-hover: #e8e8e8;
    --btn-default-disabled: #f0f0f0;
    --btn-default-disabled-text: #999;
    /* 下载激活蓝色 */
    --btn-download-active-bg: #1890ff;
    --btn-download-active-text: #fff;
    --btn-download-active-hover: #40a9ff;
    /* 暗色模式 */
    --dark-bg: #1f1f1f;
    --dark-card-bg: #2d2d2d;
    --dark-sort-bg: #383838;
    --dark-text: #eaeaea;
    --dark-subtext: #aaa;
    --dark-border: #444;
    --dark-hover: #444;
    --dark-checked: #1890ff26;
    /* 暗色按钮基础色 */
    --dark-btn-default-bg: #444;
    --dark-btn-default-text: #eaeaea;
    --dark-btn-default-hover: #555;
    --dark-btn-default-disabled: #333;
    --dark-btn-default-disabled-text: #888;
    /* 暗色下载激活色 */
    --dark-btn-download-active-bg: #1890ff;
    --dark-btn-download-active-text: #fff;
    --dark-btn-download-active-hover: #40a9ff;
    /* 面包屑 */
    --breadcrumb-text: #666;
    --dark-breadcrumb-text: #aaa;
    /* 炫彩进度条 */
    --progress-gradient: linear-gradient(90deg, #1890ff, #40a9ff, #69c0ff, #91d5ff, #69c0ff, #40a9ff, #1890ff);
}

/* 加载弹窗 */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--light-card-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    transition: background 0.3s ease, opacity 0.8s ease-out !important;
}
body.dark-mode .loading-modal {
    background: var(--dark-card-bg);
}
.loading-icon {
    font-size: 80px;
    color: var(--btn-download-active-bg);
    animation: rotate 2s linear infinite;
}
@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.loading-modal h2 {
    font-size: 28px;
    color: var(--light-text);
    font-weight: 600;
    transition: color 0.3s ease;
}
body.dark-mode .loading-modal h2 {
    color: var(--dark-text);
}
.progress-bar {
    width: 380px;
    height: 12px;
    background: var(--light-hover);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    transition: background 0.3s ease;
}
body.dark-mode .progress-bar {
    background: var(--dark-hover);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
.progress-fill {
    height: 100%;
    width: 0;
    background: var(--progress-gradient);
    background-size: 200% 100%;
    border-radius: 6px;
    position: absolute;
    top: 0;
    left: 0;
    animation: flow 3s linear infinite;
    transition: width 0.2s ease-in-out !important;
}
@keyframes flow {
    0% { background-position: 0 0; }
    100% { background-position: 200% 0; }
}
.fade-out {
    opacity: 0;
    transition: opacity 0.8s ease-out !important;
}

/* 禁用右键等 */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
}
document, body {
    cursor: default;
}

/* 滚动区域：水平可滑 + 垂直可滑 */
.scroll-container::-webkit-scrollbar {
    display: block;
    width: 4px;
    height: 4px;
    opacity: 0.3;
}
.scroll-container::-webkit-scrollbar-thumb {
    background: rgba(150,150,150,0.3);
    border-radius: 2px;
}
.scroll-container {
    scrollbar-width: thin;
    -ms-overflow-style: auto;
    overflow-x: auto !important;
    overflow-y: scroll !important;
}

.preview-content::-webkit-scrollbar {
    display: none;
}
.preview-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 顶部导航 */
.header-fixed {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--light-card-bg);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100vw;
    overflow-x: hidden;
}
body.dark-mode .header-fixed {
    background: var(--dark-card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

/* 顶部标题栏 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--light-border);
    transition: border-color 0.3s ease;
    width: 100%;
}
body.dark-mode .header {
    border-bottom-color: var(--dark-border);
}
.header h1 {
    font-size: 20px;
    color: var(--btn-download-active-bg);
    display: flex;
    align-items: center;
    gap: 8px;
}
.theme-switch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--btn-default-bg);
    color: var(--btn-default-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
body.dark-mode .theme-switch {
    background: var(--dark-btn-default-bg);
    color: var(--dark-btn-default-text);
}
.theme-switch:hover {
    background: var(--btn-default-hover);
}
body.dark-mode .theme-switch:hover {
    background: var(--dark-btn-default-hover);
}

/* 操作栏 */
.operate-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 12px 0;
    gap: 12px;
    width: 100%;
}
.breadcrumb-wrap {
    width: 100%;
}
.breadcrumb {
    font-size: 14px;
    color: var(--breadcrumb-text);
    transition: color 0.3s ease !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
body.dark-mode .breadcrumb {
    color: var(--dark-breadcrumb-text) !important;
}
.breadcrumb span {
    color: var(--btn-download-active-bg);
    cursor: pointer;
    margin: 0 4px;
}
.breadcrumb span:hover {
    text-decoration: underline;
}
.breadcrumb span:disabled {
    color: inherit;
    cursor: default;
    text-decoration: none;
}
.func-group {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
/* 按钮样式 */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    font-weight: 500;
    background: var(--btn-default-bg) !important;
    color: var(--btn-default-text) !important;
}
.btn:not(:disabled):hover {
    background: var(--btn-default-hover) !important;
}
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.8 !important;
    background: var(--btn-default-disabled) !important;
    color: var(--btn-default-disabled-text) !important;
}
body.dark-mode .btn {
    background: var(--dark-btn-default-bg) !important;
    color: var(--dark-btn-default-text) !important;
}
body.dark-mode .btn:not(:disabled):hover {
    background: var(--dark-btn-default-hover) !important;
}
body.dark-mode .btn:disabled {
    background: var(--dark-btn-default-disabled) !important;
    color: var(--dark-btn-default-disabled-text) !important;
}
/* 下载按钮激活样式 */
.btn-download.active {
    background: var(--btn-download-active-bg) !important;
    color: var(--btn-download-active-text) !important;
}
.btn-download.active:not(:disabled):hover {
    background: var(--btn-download-active-hover) !important;
}
body.dark-mode .btn-download.active {
    background: var(--dark-btn-download-active-bg) !important;
    color: var(--dark-btn-download-active-text) !important;
}

/* 可滚动内容区 */
.scroll-container {
    padding: 0 !important;
    margin: 0 auto !important;
    overflow-x: auto !important;
    overflow-y: scroll !important;
    height: calc(100vh - 168px) !important;
    min-height: 300px !important;
    background: var(--light-card-bg) !important;
    transition: background 0.3s ease !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100vw !important;
    border: none !important;
    border-radius: 0 !important;
    position: relative;
}
body.dark-mode .scroll-container {
    background: var(--dark-card-bg) !important;
}
.scroll-container::after {
    content: '';
    display: block;
    height: 1px;
    background: inherit;
    border-bottom: 1px solid var(--light-border);
    transition: all 0.3s ease !important;
}
body.dark-mode .scroll-container::after {
    border-bottom-color: var(--dark-border) !important;
}

/* 排序栏 */
.sort-bar {
    display: flex;
    align-items: center;
    height: 48px;
    border-bottom: 1px solid var(--light-border);
    background: var(--light-hover);
    transition: all 0.3s ease !important;
    white-space: nowrap;
    width: 100%;
    min-width: 768px;
}
body.dark-mode .sort-bar {
    background: var(--dark-sort-bg) !important;
    border-bottom-color: var(--dark-border) !important;
}

/* 列基础样式 */
.sort-col,
.item > div {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 0 10px;
    font-size: 14px;
    flex-shrink: 0;
}

.check-col {
    width: 50px;
    justify-content: center;
    padding: 0;
}

.name-col {
    flex: 1;
    min-width: 240px;
    justify-content: flex-start;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-col {
    width: 150px;
    min-width: 150px;
    justify-content: flex-start;
    white-space: nowrap;
}

.size-col {
    width: 90px;
    min-width: 90px;
    justify-content: flex-start;
    white-space: nowrap;
}

/* 复选框 */
.check-all, .file-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--light-border);
    border-radius: 2px;
    background: #fff;
    position: relative;
    transition: all 0.2s ease;
}
.check-all:checked, .file-check:checked {
    background: var(--btn-download-active-bg);
    border-color: var(--btn-download-active-bg);
}
.check-all:checked::after, .file-check:checked::after {
    content: '︎★';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}
body.dark-mode .check-all, body.dark-mode .file-check {
    border: 1px solid var(--dark-border) !important;
    background: var(--dark-sort-bg) !important;
}

/* 排序项 */
.sort-item {
    font-weight: 500;
    color: var(--light-text);
    transition: color 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    cursor: default !important;
}
body.dark-mode .sort-item {
    color: var(--dark-text) !important;
}
.arrow-group {
    display: none !important;
}

/* 文件列表 */
.file-list {
    width: 100% !important;
    min-width: 768px;
    background: inherit !important;
    transition: background 0.3s ease !important;
    min-height: calc(100% - 48px) !important;
}
body.dark-mode .file-list {
    background: var(--dark-card-bg) !important;
}

/* 行样式 */
.item {
    display: flex;
    align-items: center;
    height: 48px;
    border-bottom: 1px solid var(--light-border);
    transition: all 0.3s ease !important;
    font-size: 14px;
    white-space: nowrap;
    width: 100%;
    min-width: 768px;
    background: transparent;
    border-radius: 0 !important;
    padding: 0 4px;
}
body.dark-mode .item {
    border-bottom-color: var(--dark-border) !important;
}
.item:hover {
    background: var(--light-hover);
}
body.dark-mode .item:hover {
    background: var(--dark-hover) !important;
}
.item.checked {
    background: var(--light-checked);
    color: var(--light-text) !important;
}
body.dark-mode .item.checked {
    background: var(--dark-checked) !important;
    color: var(--dark-text) !important;
}

/* 图标 */
.item .icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Solid', sans-serif !important;
    font-weight: 900 !important;
}

/* 图标颜色 */
.folder-icon { color: #ffb800; }
.file-icon-pdf { color: #e53e3e; }
.file-icon-word { color: #2b6cb0; }
.file-icon-excel { color: #38a169; }
.file-icon-img { color: #d69e2e; }
.file-icon-video { color: #9c27b0; }
.file-icon-audio { color: #1890ff; }
.file-icon-code { color: #667eea; }
.file-icon-txt { color: #666; }

body.dark-mode .folder-icon { color: #ffd566; }
body.dark-mode .file-icon-txt { color: #aaa; }
body.dark-mode .file-icon-pdf { color: #f56565; }
body.dark-mode .file-icon-word { color: #63b3ed; }
body.dark-mode .file-icon-excel { color: #68d391; }
body.dark-mode .file-icon-img { color: #ffce56; } 
body.dark-mode .file-icon-video { color: #b794f4; }
body.dark-mode .file-icon-audio { color: #64b5f6; }
body.dark-mode .file-icon-code { color: #90caf9; }

/* 文件名 */
.item .file-name {
    color: var(--light-text);
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    flex: 1;
    padding-right: 4px;
}
body.dark-mode .item .file-name {
    color: var(--dark-text) !important;
}

/* 时间、大小 */
.item .time-col,
.item .size-col {
    color: var(--light-subtext);
    transition: color 0.3s ease;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
}
body.dark-mode .item .time-col,
body.dark-mode .item .size-col {
    color: var(--dark-subtext) !important;
}

/* 空文件夹 */
.empty-tip {
    text-align: center;
    padding: 60px 0;
    color: var(--light-subtext);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: color 0.3s ease;
    background: inherit !important;
    width: 100%;
    height: calc(100% - 48px);
    min-height: 240px;
}
body.dark-mode .empty-tip {
    color: var(--dark-subtext) !important;
}

/* 预览 */
.preview-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.preview-content {
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    background: var(--light-card-bg);
    border-radius: 8px;
    padding: 10px;
    position: relative;
    overflow: auto;
    transition: background 0.3s ease;
}
body.dark-mode .preview-content {
    background: var(--dark-card-bg);
}
.preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
#previewContainer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}
#previewContainer img, #previewContainer video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}
.tip-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
.tip-toast.show {
    opacity: 1;
}

/* ========================================================================== */
/* ====================== 【PC端专用修复：仅≥769px生效】====================== */
/* ========================================================================== */
@media screen and (min-width: 769px) {
    /* 强制所有列垂直居中对齐，彻底解决错位 */
    .sort-col,
    .item > div {
        display: flex !important;
        align-items: center !important;
        vertical-align: middle !important;
        height: 48px !important;
        line-height: 1 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
    }
    /* 取消过度撑开，右侧不再溢出屏幕 */
    .sort-bar,
    .file-list,
    .item {
        min-width: unset !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* 时间、大小列固定合理宽度，居左、不溢出、紧凑 */
    .time-col { width: 160px !important; min-width: 160px !important; }
    .size-col { width: 100px !important; min-width: 100px !important; }
    /* 文件名占满剩余空间 */
    .name-col { flex: 1 !important; min-width: 300px !important; }
}

/* ========================================================================== */
/* ======================== 【手机端完全原样，一行没改】======================= */
/* ========================================================================== */
@media (max-width: 768px) {
    .header h1 { font-size: 18px; }
    .scroll-container {
        height: calc(100vh - 176px) !important;
        min-height: 200px !important;
    }
    .loading-icon { font-size: 60px; }
    .loading-modal h2 { font-size: 22px; }
    .progress-bar { width: 280px; }

    .sort-col, .item > div {
        padding: 0 6px;
    }
    .check-col {
        width: 44px;
    }
    .name-col {
        min-width: 220px;
        width: auto;
        flex: 1;
        gap: 8px;
    }
    .time-col {
        width: 135px;
        min-width: 135px;
        font-size: 12px;
    }
    .size-col {
        width: 80px;
        min-width: 80px;
        font-size: 12px;
    }

    .item .icon { font-size: 18px; }
    .item { height: 46px; }
    .btn { padding: 7px 16px; font-size: 13px; }
}

@media (max-width: 480px) {
    .container { padding: 0 10px; }
    .progress-bar { width: 220px; }
    .name-col { min-width: 200px; }
    .func-group { gap: 8px; }
    .btn { padding: 6px 12px; }
}

@media (max-width: 375px) {
    .name-col { min-width: 180px; }
    .time-col { width: 125px; min-width: 125px; }
    .size-col { width: 75px; min-width: 75px; }
}
