/* ============================================================
   文件下载 / 文件库模块样式（前台）
   挂接：index.html 的 #files 卡片 + #filesModalOverlay 弹窗
   ============================================================ */

/* ===== 文件下载卡片（与项目/帖子卡片同款透明风格） ===== */
.files-card,
.files-card:hover {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 28px 0 0;
    margin-bottom: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* 文件下载（左）与番剧素材（右）并排放同一行 */
.files-materials-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}
.files-materials-row > .files-card,
.files-materials-row > .materials-card {
    min-width: 0;
    /* 让入口按钮吃掉标题以外的剩余高度，两个入口才等高
       （不能写 height:100%，那样会把上方标题的高度也算进去导致溢出） */
    display: flex;
    flex-direction: column;
}
.files-materials-row .files-entry,
.files-materials-row .materials-entry { flex: 1 1 auto; }

.files-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-top: 14px;
    padding: 22px 20px;
    /* 并排后宽度只剩一半，用更高的高度把它撑起来，显得更大 */
    min-height: 108px;
    text-align: left;
    font: inherit;
    color: var(--text);
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(120%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(120%);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}
.files-entry:hover {
    background: var(--card-bg-hover);
    border-color: var(--card-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}
.files-entry:active { transform: translateY(0); }

/* 这两个卡片的区块标题也一并放大（只作用于文件下载 / 番剧素材） */
.files-card .section-title,
.materials-card .section-title {
    font-size: 22px;
    margin-bottom: 18px;
}

.files-entry-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 18px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
}
.files-entry-icon svg { width: 46px; height: 46px; }

.files-entry-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.files-entry-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}
.files-entry-sub {
    font-size: 13.5px;
    color: var(--text-muted);
    /* 列变窄后不再单行截断，改成换行显示两行，信息更完整 */
    line-height: 1.55;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.files-entry-count {
    flex: 0 0 auto;
    min-width: 30px;
    padding: 4px 11px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.files-entry-arrow {
    flex: 0 0 auto;
    display: flex;
    color: var(--text-muted);
    transition: transform 0.25s ease, color 0.25s ease;
}
.files-entry-arrow svg { width: 22px; height: 22px; }
.files-entry:hover .files-entry-arrow {
    transform: translateX(3px);
    color: var(--text);
}

/* ===== 文件库弹窗（与商铺弹窗同款质感） ===== */
.files-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.files-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.files-modal-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 40, 0.92);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 640px;
    width: 100%;
    max-height: min(86vh, 780px);
    overflow: hidden;
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.25s ease;
}
.files-modal-overlay.show .files-modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.files-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 18px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.files-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
}
.files-modal-subtitle {
    margin: 5px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.files-modal-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s;
}
.files-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: rotate(90deg);
}
.files-modal-close svg { width: 100%; height: 100%; }

.files-modal-toolbar {
    padding: 12px 18px 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.files-manage-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(130,180,255,0.35);
    background: rgba(130,180,255,0.12);
    color: inherit;
    font: inherit;
    font-size: 12.5px;
    cursor: pointer;
}
.files-manage-btn:hover { background: rgba(130,180,255,0.22); }
.files-manage-btn:disabled { opacity: .5; cursor: default; }

.files-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.files-search-icon {
    position: absolute;
    left: 12px;
    width: 15px;
    height: 15px;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}
.files-search-input {
    width: 100%;
    height: 38px;
    padding: 0 36px 0 34px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.files-search-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.files-search-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}
.files-search-clear {
    position: absolute;
    right: 8px;
    width: 22px;
    height: 22px;
    padding: 5px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.15s;
}
.files-search-clear:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.files-search-clear svg { width: 100%; height: 100%; }

.files-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.files-modal-body::-webkit-scrollbar { width: 6px; }
.files-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

/* ===== 文件列表 ===== */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.file-row:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
}

.file-row-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 34px;
    padding: 0 6px;
    border-radius: 9px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
}
.file-row-icon.fi-generic { background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.8); }
.file-row-icon.fi-archive { background: rgba(255, 159, 67, 0.22); color: #ffbe82; }
.file-row-icon.fi-pdf     { background: rgba(255, 82, 82, 0.2);  color: #ff8a8a; }
.file-row-icon.fi-image   { background: rgba(83, 190, 133, 0.2); color: #8fe0b0; }
.file-row-icon.fi-audio   { background: rgba(155, 111, 236, 0.24); color: #c0a5ff; }
.file-row-icon.fi-video   { background: rgba(79, 172, 254, 0.2); color: #9bceff; }
.file-row-icon.fi-doc     { background: rgba(64, 156, 255, 0.2); color: #a5cdff; }
.file-row-icon.fi-code    { background: rgba(120, 200, 90, 0.18); color: #b3e39b; }

.file-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-decoration: none;
    color: inherit;
}
.file-row-name {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-row-meta {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.45);
}

/* 右侧操作区：下载 + 预览（预览由后台为每个文件单独设置） */
.file-row-acts {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.file-row-act {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.2s;
}
.file-row-act svg { width: 16px; height: 16px; }
.file-row:hover .file-row-act {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}
.file-row-pv:hover {
    background: rgba(79, 172, 254, 0.26);
    color: #c3e2ff;
}

/* 加载 / 空状态 */
.files-loading,
.files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 42px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}
.files-spinner {
    width: 22px;
    height: 22px;
    animation: filesSpin 1s linear infinite;
}
@keyframes filesSpin { to { transform: rotate(360deg); } }

.files-modal-footer {
    flex-shrink: 0;
    padding: 10px 18px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
}

/* ===== 移动端适配 ===== */
@media (max-width: 560px) {
    .files-modal-overlay { padding: 0; align-items: flex-end; }
    .files-modal-dialog {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
    }
    /* 窄屏放不下两列，改回上下堆叠 */
    .files-materials-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .files-entry { padding: 16px; gap: 12px; min-height: 0; }
    .files-entry-icon { width: 42px; height: 42px; }
    .files-entry-icon svg { width: 22px; height: 22px; }
    .files-entry-sub { white-space: normal; font-size: 13px; }
    .files-entry-title { font-size: 16.5px; }
    .files-card .section-title,
    .materials-card .section-title { font-size: 20px; }
    .file-row { padding: 10px; gap: 9px; }
    .file-row-icon { min-width: 38px; height: 30px; }
}

@media (max-width: 860px) and (min-width: 561px) {
    /* 中等宽度：并排但把入口压扁一点，避免文字挤成一团 */
    .files-entry { padding: 18px 16px; min-height: 96px; }
    .files-entry-title { font-size: 16.5px; }
    .files-entry-sub { font-size: 12.5px; }
}

/* ===== 文件库：按文件夹分组 =====
   每个文件夹一个分组标题（图标 + 名称 + 文件数），下面跟该组的文件行。
   「未分类」分组排在最后，用略微不同的色调区分。 */
.files-group-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 10px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.files-group-head:first-child { margin-top: 0; }

.files-group-ico {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: rgba(130, 180, 255, 0.95);
    background: rgba(130, 180, 255, 0.16);
}
/* 未分类：偏中性色，和真实文件夹区分开 */
.files-group-head.is-uncat .files-group-ico {
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.09);
}

.files-group-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    overflow-wrap: anywhere;
}

.files-group-count {
    flex: 0 0 auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .files-group-head { margin: 14px 0 8px; padding: 8px 10px; }
    .files-group-name { font-size: 13px; }
}

/* ===== 文件库：文件夹列表（第一级） =====
   像文件管理器：先列文件夹，点进去再开第二层窗口看文件。 */
.files-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
/* 第二层窗口里也能显示子文件夹卡片，和下面的文件行拉开一点距离 */
.files-list > .files-folder-grid { margin-bottom: 10px; }

.files-folder-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 14px;
    text-align: left;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.files-folder-card:hover,
.files-folder-card:focus-visible {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    outline: none;
}

.files-folder-card-ico {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    color: rgba(130, 180, 255, 0.95);
    background: rgba(130, 180, 255, 0.16);
}
/* 未分类：中性色，和真实文件夹区分 */
.files-folder-card.is-uncat .files-folder-card-ico {
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.09);
}

.files-folder-card-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.files-folder-card-name {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.files-folder-card-count {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.5);
}

.files-folder-card-go {
    flex: 0 0 auto;
    opacity: 0.45;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.files-folder-card:hover .files-folder-card-go {
    opacity: 0.9;
    transform: translateX(2px);
}

/* ===== 第二层：文件夹内容窗口 ===== */
/* 叠在文件库弹窗之上，所以 z-index 要更高 */
.files-folder-overlay {
    z-index: 10012;
    background: rgba(0, 0, 0, 0.72);
}
.files-folder-dialog {
    max-width: 700px;
}

.files-folder-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.files-folder-back:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.24);
}

@media (max-width: 768px) {
    .files-folder-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .files-folder-card { padding: 11px 12px; gap: 10px; }
    .files-folder-card-ico { width: 32px; height: 32px; }
    .files-folder-card-name { font-size: 12.5px; }
}
