/* 
下载文件组件样式
作者: Bill 
创建时间: 24/12/09:19:20
使用者: postRead.html
功能: 文章附件下载区域的美化样式
*/

/* 下载区域容器 */
.download-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.download-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8, #3b82f6);
    background-size: 200% 100%;
    animation: downloadGradient 3s ease-in-out infinite;
}

@keyframes downloadGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 标题区域 */
.download-section h3 {
    margin-bottom: 1rem;
    color: #1f2937;
    font-weight: 600;
}

.download-section h3 i {
    color: #3b82f6;
    margin-right: 8px;
}

/* 文件计数徽章 */
.download-section .badge {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* 文件网格 */
.download-files-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* 文件卡片 */
.download-file-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.download-file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.download-file-card:hover::before {
    transform: translateX(100%);
}

.download-file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

/* 文件图标 */
.download-file-card .file-icon {
    font-size: 2rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.file-icon.pdf { color: #dc2626; }
.file-icon.word { color: #2563eb; }
.file-icon.excel { color: #059669; }
.file-icon.powerpoint { color: #ea580c; }
.file-icon.image { color: #7c3aed; }
.file-icon.archive { color: #ca8a04; }
.file-icon.video { color: #ec4899; }
.file-icon.audio { color: #6366f1; }
.file-icon.default { color: #6b7280; }

/* 文件信息 */
.download-file-card .file-info {
    flex: 1;
    min-width: 0;
}

.download-file-card .file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.download-file-card:hover .file-name {
    color: #3b82f6;
}

.download-file-card .file-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.download-file-card .file-meta i {
    margin-right: 0.25rem;
}

/* 下载按钮 */
.download-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    flex-shrink: 0;
}

.download-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
    color: white;
    text-decoration: none;
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.download-btn i {
    font-size: 0.75rem;
}

/* 下载提示区域 */
.download-notice {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #1e40af;
}

.download-notice i {
    color: #3b82f6;
    margin-right: 0.5rem;
}

.download-notice .notice-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .download-files-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .download-section {
        margin: 1rem 0 0;
        padding: 1rem;
        border-radius: 8px;
    }
    
    .download-section h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .download-file-card {
        padding: 0.875rem;
        border-radius: 8px;
    }
    
    .download-file-card .flex-shrink-0 {
        margin-right: 0.5rem;
    }
    
    .download-file-card .flex-shrink-0 i {
        font-size: 1.5rem;
    }
    
    .download-file-card .file-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.7rem;
    }
    
    .download-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
        min-height: 44px; /* 确保触摸友好 */
        border-radius: 6px;
    }
}

@media (max-width: 640px) {
    .download-section {
        margin: 1rem -0.5rem 0;
        border-radius: 8px;
        padding: 0.875rem;
    }
    
    .download-file-card {
        border-radius: 6px;
        padding: 0.75rem;
    }
    
    /* 文件信息行样式 */
    .download-file-card .file-info-row {
        margin-bottom: 0.75rem;
    }
    
    .download-file-card .flex-1 h4 {
        font-size: 0.8rem;
        line-height: 1.3;
        margin-bottom: 0.375rem;
    }
    
    /* 下载按钮行样式 */
    .download-btn-row .download-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
        font-weight: 600;
        min-height: 48px;
    }
}

@media (max-width: 480px) {
    .download-section {
        margin: 1rem -1rem 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 0.75rem;
    }
    
    .download-files-grid {
        gap: 0.5rem;
    }
    
    .download-file-card {
        padding: 0.75rem;
        margin: 0;
    }
    
    /* 图标和文件信息保持在同一行 */
    .download-file-card .flex > .flex {
        align-items: center;
        gap: 0.5rem;
    }
    
    .download-file-card .flex-shrink-0 i {
        font-size: 1.25rem;
    }
    
    .download-file-card .flex-1 h4 {
        font-size: 0.75rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }
    
    .download-file-card .file-meta {
        font-size: 0.65rem;
        gap: 0.375rem;
        margin-top: 0.25rem;
    }
    
    .download-file-card .file-meta .flex {
        margin-right: 0.5rem;
    }
    
    /* 下载按钮独占一行，拉长 */
    .download-btn {
        width: 100%;
        padding: 0.875rem;
        font-size: 0.8rem;
        min-height: 48px;
        border-radius: 6px;
        margin-top: 0.5rem;
        justify-content: center;
    }
    
    /* 优化文件名显示 */
    .download-file-card .flex-1 h4 {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .download-section h3 {
        font-size: 0.9rem;
    }
    
    .download-file-card {
        padding: 0.625rem;
    }
    
    /* 图标和文件信息的间距 */
    .download-file-card .flex > .flex {
        gap: 0.375rem;
    }
    
    .download-file-card .flex-shrink-0 i {
        font-size: 1.125rem;
    }
    
    .download-file-card .flex-1 h4 {
        font-size: 0.7rem;
    }
    
    .download-file-card .file-meta {
        font-size: 0.6rem;
    }
    
    /* 下载按钮保持拉长布局 */
    .download-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }
}

/* 动画效果 */
.download-file-card {
    animation: fadeInUp 0.5s ease-out;
}

.download-file-card:nth-child(2) { animation-delay: 0.1s; }
.download-file-card:nth-child(3) { animation-delay: 0.2s; }
.download-file-card:nth-child(4) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载状态 */
.download-section.loading {
    opacity: 0.7;
    pointer-events: none;
}

.download-section.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
} 