/* File Downloads Styles */

.file-downloads-wrapper {
    margin: 20px 0;
    padding: 25px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-downloads-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
}

.file-downloads-header-left {
    flex: 1;
}

.file-downloads-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.file-list-count {
    font-size: 14px;
    color: #666;
}

/* Sort Controls */
.file-sort-controls {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.file-sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
}

.file-sort-btn:hover {
    background: #f8f9fa;
    border-color: #ff69b4;
    color: #ff69b4;
}

.file-sort-btn.active {
    background: #ff69b4;
    border-color: #ff69b4;
    color: white;
}

.file-sort-btn svg {
    width: 16px;
    height: 16px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.file-item:hover {
    background: #f8f9fa;
    border-color: #ff69b4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.2);
}

.file-icon {
    font-size: 32px;
    margin-right: 16px;
    flex-shrink: 0;
}

.file-thumbnail {
    width: 80px;
    height: 80px;
    margin-right: 16px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-info,
.file-details {
    flex: 1;
    min-width: 0;
    margin-right: 16px;
}

.file-name {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

.file-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #666;
}

.file-size,
.file-download-stats {
    display: inline-flex;
    align-items: center;
}

.download-count-number {
    font-weight: 600;
    color: #444;
}

.download-btn {
    padding: 10px 24px;
    background: #ff69b4;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(255, 105, 180, 0.3);
}

.download-btn:hover {
    background: #ff1493;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 105, 180, 0.5);
}

.download-btn:active {
    transform: scale(0.98);
}

.download-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.download-btn-loading {
    display: inline-block;
    animation: loading-pulse 1s infinite;
}

@keyframes loading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error messages */
.file-error {
    color: #d32f2f;
    background: #ffebee;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #d32f2f;
    margin: 10px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .file-downloads-wrapper {
        padding: 16px;
    }
    
    .file-downloads-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .file-sort-controls {
        width: 100%;
    }
    
    .file-sort-btn {
        flex: 1;
        justify-content: center;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .file-icon,
    .file-thumbnail {
        margin-right: 0;
        margin-bottom: 8px;
    }
    
    .file-thumbnail {
        width: 100%;
        height: 150px;
    }
    
    .file-info,
.file-details {
        width: 100%;
    }
    
    .file-meta {
        flex-direction: column;
        gap: 4px;
    }
    
    .download-btn {
        width: 100%;
    }
}

/* Loading state */
.file-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success animation */
.file-item.downloaded .download-btn {
    background: #28a745;
}

@keyframes download-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.file-item.downloaded {
    animation: download-success 0.5s ease;
}

/* Search + Pagination (v1.2.0) */
.file-downloads-controls {
    display: flex;
    gap: 10px;
    /*
     * Align controls to the top so the search input (which can include helper
     * text below) doesn't vertically center the whole group.
     */
    align-items: flex-start;
    flex-wrap: wrap;
}

.file-search {
    padding: 10px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    min-width: 220px;
    height: 40px;
    box-sizing: border-box;
}

.file-pagination {
    margin-top: 18px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.file-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

.file-page-link.is-active {
    font-weight: 700;
}


/* Search UX */
.file-search-wrapper {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
}

.file-search-clear {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid #e1e8ed;
    background: #fff;
    cursor: pointer;
    line-height: 22px;
    font-size: 16px;
    padding: 0;
}

.file-search-note {
    font-size: 12px;
    color: #666;
}

/* Per-page selector */
.file-perpage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.file-perpage-select {
    padding: 8px 10px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    height: 40px;
    box-sizing: border-box;
}
