/**
 * Download 页面样式
 * 文件位置: themes/blo/assets/css/download-page.css
 *
 * 布局：左侧分类导航 + 右侧资源列表
 * 左侧分类带颜色小圆点（颜色值由后台 fase_termmeta 表的 _download_cat_color 字段控制）
 */

/* 修复主题 gutenberg-custom.css 中 body{overflow-x:hidden} 导致 position:sticky 失效的问题。
   使用 !important 覆盖主题样式（主题样式在页面样式之后加载）。 */
body {
    overflow-x: visible !important;
    overflow-x: clip !important;
}

/* ===== 页面整体容器 ===== */
.efh-download-page {
    padding: 40px 0 60px !important;
    min-height: 600px;
}

/* 覆盖 Bootstrap container 的最大宽度限制，与 gallery 页面保持一致的全宽布局 */
.efh-download-page .container {
    max-width: none;
    width: 92%;
}

/* 页面标题区域：与 header logo 左对齐 */
.efh-download-header {
    margin-bottom: 30px;
    text-align: left;
}

.efh-download-title {
    font-size: 34px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.efh-download-subtitle {
    font-size: 15px;
    color: #777;
    margin: 0;
}

/* ===== 主布局：左右分栏 ===== */
.efh-download-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    position: relative;
}

/* ===== 左侧侧边栏 ===== */
.efh-download-sidebar-wrap {
    width: 380px;
    flex-shrink: 0;
}

.efh-download-sidebar {
    width: 380px;
    /* 桌面端由 JS 控制：滚动时切换为 fixed 跟随页面，到底部时切换为 absolute */
}

/* ===== 搜索框 ===== */
.efh-download-search-wrap {
    position: relative;
}

.efh-download-search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.efh-download-search-input:focus {
    border-color: #E87722;
}

.efh-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 14px;
    pointer-events: none;
}

/* ===== 分类列表 ===== */
.efh-download-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.efh-cat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 4px;
    user-select: none;
}

.efh-cat-item:hover {
    background-color: #f5f5f5;
}

.efh-cat-item.active {
    background-color: #f5f5f5;
    font-weight: 700;
    color: #000;
    border-left: 3px solid #000;
    padding-left: 13px;
}

.efh-cat-count {
    font-size: 12px;
    font-weight: 600;
    color: #000;
    border-radius: 10px;
    padding: 2px 8px;
    min-width: 22px;
    text-align: center;
    margin-left: auto;
    transition: all 0.2s;
}

.efh-cat-item.active .efh-cat-count {
    color: #000;
    font-weight: 700;
}

/* 分类颜色小圆点 */
.efh-cat-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 12px;
    /* 背景色由 JS 动态设置（来自后台 _download_cat_color 字段） */
}

.efh-cat-name {
    flex: 1;
    font-size: 18px;
    color: #333;
}

.efh-cat-count {
    font-size: 13px;
    color: #000;
    border-radius: 12px;
    padding: 2px 10px;
    min-width: 24px;
    text-align: center;
}


/* ===== 右侧资源列表 ===== */
.efh-download-content {
    flex: 1;
    min-width: 0;
}

/* ===== 分组区块：每个分类一个 section，纵向排列 ===== */
.efh-download-section {
    padding-bottom: 48px;
}

.efh-download-section:last-child {
    padding-bottom: 0;
}

/* 当前分类标题行 */
.efh-content-header {
    position: relative;
    z-index: 10;
    background: #f2f2f2;
    margin-bottom: 20px;
    padding-bottom: 14px;
    padding-top: 14px;

    border-bottom: 3px solid #333;
}

/* 分组视图中的分类标题行使用原生 sticky 吸顶，滚动时不再移动标题 */
.efh-download-section > .efh-content-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
}

.efh-content-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.efh-content-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.efh-content-title {
    font-size: 25px;
    font-weight: 700;
    color: #333;
    margin: 0;
    letter-spacing: 0.5px;
}

.efh-content-count {
    font-size: 15px;
    color: #999;
    margin-left: auto;
    font-weight: 400;
}

/* 分类 Description 说明（分割线下方） */
.efh-content-desc {
    font-size: 13px;
    color: #777;
    line-height: 1.6;
    margin: 12px 0 20px 0;
    padding: 0;
}

/* ===== 资源卡片列表 ===== */
.efh-resource-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.efh-resource-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e6e1d4;
    margin-bottom: 0;
    cursor: pointer;
}

.efh-resource-item:hover {
    /* 不修改悬停样式 */
}


/* 资源封面图/图标 */
.efh-resource-thumb {
    width: 56px;
    height: 72px;
    flex-shrink: 0;
    margin-right: 20px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.efh-resource-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.efh-file-placeholder {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    letter-spacing: 0.5px;
}

/* 资源信息 */
.efh-resource-info {
    flex: 1;
    min-width: 0;
}

.efh-resource-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.efh-resource-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.efh-resource-meta-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.efh-resource-version {
    font-size: 15px;
    color: #ccc;
    margin: 0;
}

.efh-resource-cat {
    font-size: 15px;
    color: #bbb;
    margin: 0;
}

/* 资源右侧：文件类型标签 + 下载按钮 */
.efh-resource-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    margin-left: 20px;
}

.efh-file-type-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #666;
}

.efh-file-type-badge.pdf {
    /* background: #fee2e2;
    color: #dc2626; */
    color: #666; 
}

.efh-file-type-badge.doc {
    /* background: #dbeafe;
    color: #2563eb; */
    color: #666; 
}

.efh-file-type-badge.xls {
    /* background: #d1fae5;
    color: #059669; */
    color: #666; 
}

.efh-file-type-badge.zip {
    /* background: #fef3c7;
    color: #d97706; */
    color: #666; 
}

.efh-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    color: #E87722;
    text-decoration: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
    /* button 元素样式重置 */
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}


.efh-download-btn i {
    font-size: 15px;
}

.efh-download-btn-disabled {
    color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.efh-download-btn-disabled i {
    color: #ccc;
}

/* ===== 加载状态 ===== */
.efh-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: #888;
    font-size: 13px;
    gap: 12px;
}

.efh-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #E87722;
    border-radius: 50%;
    animation: efh-spin 0.8s linear infinite;
}

@keyframes efh-spin {
    to { transform: rotate(360deg); }
}

/* ===== 搜索结果数量条 ===== */
.efh-download-search-result {
    font-size: 16px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
    margin:10px
}

.efh-download-search-result strong {
    color: #333;
    font-weight: 600;
}

.efh-download-search-result .efh-clear-search {
    margin-left: auto;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.efh-download-search-result .efh-clear-search:hover {
    color: #333;
}

/* ===== 无结果提示 ===== */
.efh-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.efh-no-results i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    color: #ddd;
}

/* ===== 响应式：小屏幕适配 ===== */
@media (max-width: 991px) {
    .efh-download-layout {
        flex-direction: column;
    }

    .efh-download-sidebar-wrap {
        width: 100%;
    }

    .efh-download-sidebar {
        width: 100%;
    }

    /* 小屏幕下分类列表横向滚动 */
    .efh-download-categories {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .efh-cat-item {
        display: inline-flex;
        padding: 8px 14px;
        margin-bottom: 0;
    }

    .efh-cat-count {
        display: none;
    }
}

@media (max-width: 575px) {
    .efh-download-title {
        font-size: 24px;
    }

    .efh-resource-item {
        flex-wrap: wrap;
    }

    .efh-resource-thumb {
        width: 48px;
        height: 60px;
        margin-right: 12px;
    }

    .efh-resource-actions {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }

    .efh-download-btn {
        flex: 1;
        justify-content: center;
    }
}
