/* ========== 免费学习资料页面样式 ========== */

/* ========== 筛选区域 ========== */
.resources-filter {
    background: #fff;
    padding: 24px 0;
    border-bottom: 1px solid #eee;
}

.resources-filter .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 10px 20px;
    font-size: 14px;
    color: #666;
    background: #f5f7fb;
    border: 1px solid #e8e8e8;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.filter-tab:hover {
    border-color: #FF6B35;
    color: #FF6B35;
    background: #fff;
}

.filter-tab.active {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8F66 100%);
    color: #fff;
    border-color: #FF6B35;
    box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}

/* ========== 搜索框 ========== */
.filter-search {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}

.search-input {
    width: 220px;
    height: 42px;
    padding: 0 16px;
    font-size: 14px;
    border: 1px solid #e8e8e8;
    border-right: none;
    border-radius: 21px 0 0 21px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: #FF6B35;
}

.search-btn {
    width: 48px;
    height: 44px;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8F66 100%);
    border: none;
    border-radius: 0 21px 21px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-btn:hover {
    opacity: 0.9;
}

/* ========== 资料列表区域 ========== */
.resources-section {
    padding: 40px 0 60px;
    background: #f8f9fb;
    min-height: 500px;
}

.resources-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ========== 资料卡片 ========== */
.resource-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.resource-cover {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.resource-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.resource-card:hover .resource-cover img {
    transform: scale(1.08);
}

.resource-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    font-size: 12px;
    color: #fff;
    background: linear-gradient(135deg, #FF6B35, #FF8F66);
    border-radius: 12px;
    z-index: 1;
}

.resource-info {
    padding: 20px;
}

.resource-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.resource-author {
    font-size: 12px;
    color: #999;
}

.resource-views {
    font-size: 12px;
    color: #999;
}

.resource-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-preview {
    background: #f5f7fb;
    color: #666;
    border: 1px solid #e8e8e8;
}

.action-preview:hover {
    background: #fff;
    border-color: #FF6B35;
    color: #FF6B35;
}

.action-download {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8F66 100%);
    color: #fff;
    border: none;
}

.action-download:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* ========== 预览弹窗 ========== */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.preview-modal.active {
    display: block;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
}

.preview-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.preview-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.preview-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #999;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-close:hover {
    background: #f5f5f5;
    color: #333;
}

.preview-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f8f9fb;
    min-height: 400px;
}

.preview-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-download {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8F66 100%);
    border: none;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(255,107,53,0.4);
}

/* ========== 预览内容样式 ========== */
.preview-video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
}

.preview-iframe {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 8px;
    background: #fff;
}

.preview-text {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
}

.preview-code {
    background: #282c34;
    padding: 24px;
    border-radius: 8px;
    overflow-x: auto;
}

.preview-code pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #abb2bf;
}

.preview-image {
    text-align: center;
}

.preview-image img {
    max-width: 100%;
    border-radius: 8px;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    color: #999;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    color: #bbb;
}

/* ========== 加载状态 ========== */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #f0f0f0;
    border-top-color: #FF6B35;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    font-size: 14px;
    color: #999;
}


/* ========== 下载弹窗（助理二维码） ========== */
.download-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
}

.download-modal.active {
    display: block;
}

.download-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
}

.download-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90vw;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.download-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 12px;
}

.download-title {
    font-size: 19px;
    font-weight: 700;
    color: #333;
}

.download-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #999;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.download-close:hover {
    background: #f5f5f5;
    color: #333;
    border-radius: 50%;
}

.download-body {
    padding: 8px 28px 24px;
    text-align: center;
}

.download-subtitle {
    font-size: 15px;
    color: #666;
    margin-bottom: 18px;
}

.qr-code-wrapper {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 16px 16px;
    margin-bottom: 18px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.qr-code-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.qr-code-wrapper.has-img .qr-code-img {
    display: block;
}

.qr-code-wrapper.has-img .qr-placeholder {
    display: none;
}

.qr-placeholder {
    font-size: 14px;
    color: #bbb;
    user-select: none;
}

.download-hint {
    font-size: 13px;
    color: #888;
}

.download-hint .highlight {
    color: #FF3B30;
    font-weight: 600;
}

.download-footer {
    padding: 0 24px 24px;
}

.btn-complaint {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 0;
    font-size: 14px;
    font-weight: 500;
    color: #007AFF;
    background: rgba(0,122,255,0.08);
    border: 1px solid rgba(0,122,255,0.2);
    border-radius: 22px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.btn-complaint:hover {
    background: rgba(0,122,255,0.14);
    border-color: rgba(0,122,255,0.35);
}

.info-icon {
    font-style: normal;
    font-weight: 700;
    font-size: 15px;
}


/* ========== 移动端适配 ========== */
@media screen and (max-width: 768px) {
    /* 筛选区域 */
    .resources-filter {
        padding: 16px 0;
    }

    .resources-filter .container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .filter-tab {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 13px;
    }

    .filter-search {
        width: 100%;
    }

    .search-input {
        flex: 1;
        width: auto;
    }

    /* 资料列表 */
    .resources-section {
        padding: 24px 0 40px;
    }

    .resources-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .resource-cover {
        height: 140px;
    }

    .resource-info {
        padding: 14px;
    }

    .resource-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .resource-desc {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .resource-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .resource-actions {
        margin-top: 12px;
    }

    .action-btn {
        padding: 8px;
        font-size: 12px;
    }

    /* 预览弹窗 */
    .preview-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
    }

    .preview-header {
        padding: 16px;
    }

    .preview-title {
        font-size: 16px;
    }

    .preview-body {
        padding: 16px;
        min-height: 300px;
    }

    .preview-iframe {
        height: 350px;
    }

    .preview-footer {
        padding: 12px 16px;
    }

    .btn-download {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    /* 下载弹窗 */
    .download-content {
        width: 90vw;
    }

    .download-header {
        padding: 20px 20px 10px;
    }

    .download-title {
        font-size: 17px;
    }

    .download-body {
        padding: 8px 20px 18px;
    }

    .qr-code-wrapper {
        padding: 24px 12px;
        min-height: 180px;
    }
}

/* ========== 分页样式（与 .local/best_course/css/main.css 完全一致）========== */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-bottom: 20px;
}

.pagination-wrap .pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    color: #666;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    line-height: 1;
}

.pagination-wrap .pagination-btn:hover:not(.disabled):not(.active) {
    border-color: #FF6B35;
    color: #FF6B35;
}

.pagination-wrap .pagination-btn.active {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8F66 100%);
    color: #fff;
    border-color: #FF6B35;
}

.pagination-wrap .pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-wrap .pagination-ellipsis {
    padding: 0 8px;
    color: #999;
}

@media screen and (max-width: 768px) {
    .pagination-wrap {
        gap: 6px;
        margin-top: 30px;
        padding-bottom: 15px;
    }

    .pagination-wrap .pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* ========== 小屏手机适配 ========== */
@media screen and (max-width: 480px) {
    .resources-list {
        grid-template-columns: 1fr;
    }

    .resource-cover {
        height: 160px;
    }

    .preview-iframe {
        height: 300px;
    }

    .pagination-wrap {
        gap: 4px;
    }

    .pagination-wrap .pagination-btn {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 12px;
    }
}
